internal WidcommBluetoothRadio(WidcommBluetoothFactoryBase factory)
        {
            System.Threading.ThreadStart handleError = delegate { };
#if !NETCF
            // On my old iPAQ the radio info functions fail sometimes even though
            // the stack is working fine so we ignored the errors in the first
            // release.  On Win32 this is a problem when the stack is installed
            // but no radio is attached, so fail in that case.
            handleError = delegate {
                throw new PlatformNotSupportedException(
                          "Widcomm Bluetooth stack not supported (Radio).");
            };
#endif
            //
            Debug.Assert(factory != null);
            _factory = factory;
            var  tmp = BtIf;
            bool ret;
            ret = BtIf.GetLocalDeviceVersionInfo(ref m_dvi);
            Debug.Assert(ret, "GetLocalDeviceVersionInfo failed");
            if (!ret)
            {
                handleError();
                // Call handleError first so that one Win32 we don't get the Assert if there's no stack present.
                Debug.Assert(ret, "GetLocalDeviceVersionInfo failed");
                m_dvi = new DEV_VER_INFO(HciVersion.Unknown); // Reset to overwrite any garbage returned by GetLocalDeviceVersionInfo.
            }
            byte[] bdName = new byte[WidcommStructs.BD_NAME_LEN];
            ret = BtIf.GetLocalDeviceName(bdName);
            Debug.Assert(ret, "GetLocalDeviceName failed");
            if (ret)
            {
                m_name = WidcommUtils.BdNameToString(bdName);
            }
            else
            {
                bdName = null;
                handleError();
            }
            //
            // Did GetLocalDeviceVersionInfo get the address?  It doesn't work on
            // my iPAQ, but then again this way doesn't work either!
            if (LocalAddress == null || LocalAddress.ToInt64() == 0)
            {
                Utils.MiscUtils.Trace_WriteLine("GetLocalDeviceVersionInfo's bd_addr is empty, trying GetLocalDeviceInfoBdAddr...");
                if (m_dvi.bd_addr == null)
                {
                    m_dvi.bd_addr = new byte[WidcommStructs.BD_ADDR_LEN];
                }
                ret = BtIf.GetLocalDeviceInfoBdAddr(m_dvi.bd_addr);
                Debug.Assert(ret, "GetLocalDeviceInfoBdAddr failed");
                if (!ret)
                {
                    m_dvi.bd_addr = new byte[WidcommStructs.BD_ADDR_LEN];
                    handleError();
                }
            }
        }