![]() If (Radio.SetRadioState(State, 10) != 0x00000000)Īs you can see this way gives you more control and also can be used with WiFi adapter (with querying WiFi Radio interface). State = DEVICE_RADIO_STATE.DRS_SW_RADIO_OFF If (RadioMan.GetRadioInstances(out Radios) != 0x00000000) IMediaRadioManager RadioMan = oRadioMan as IMediaRadioManager Typeof(IMediaRadioManager).GUID, out oRadioMan) Int32 Res = CoCreateInstance(CLSID_BluetoothRadioManager, IntPtr.Zero, CLSCTX_INPROC_SERVER, Try to get Bluetooth Radio Manager interface. Private Boolean ChangeRadioState(Boolean TurnOn) ![]() DEVICE_RADIO_STATE radioState,ĭRS_RADIO_MAX = DRS_HW_RADIO_OFF_UNCONTROLLABLE Private interface IRadioInstanceCollection out IRadioInstanceCollection ppCollection) Public static extern Int32 CoCreateInstance( Public const UInt32 CLSCTX_INPROC_SERVER = 1 Private static readonly Guid CLSID_BluetoothRadioManager = new Guid("") ![]() So instead of using that API you can directly call to RadioManager interface (and object): RadioState (when you set it) simple checks if the RadioManager is registered by calling CoCreateInstance() and then calls its methods (see code below that does exactly the same what WinRT API does). 32bits app on 64bits OS will not work because the RadioManager interface (internally it uses COM based Managers that actually does the job) registered only for 64bits (as 64bits inproc COM server). If your application runs on 64bit OS it (the app) must be 64bits as well. However it has one very important limitation: the application uses it must has the same "bits" as the OS. The second part of the answer above is correct. If you have paired device with, let say, Serial Port Profile, you can use this method to install vCOMs for that service and/or removes them. It simple adds/removes drivers for paired Bluetooth enabled device. BluetoothSetServiceState, as described above, does nothing with Bluetooth hardware itself. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |