locked
enable/disable Bluetooth radio with socket interface on CE 5.0 RRS feed

  • Question

  •  

    I am looking for a way to enable/disable the Bluetooth radio using the socket interface on CE 5. I doesn't seem like getsockopt has an option to do this and the btdrt dll appears to be unlinkable from an unmanaged C++ dll. Any thoughts on this matter would be appreciated.
    Wednesday, February 13, 2008 4:19 AM

Answers

  • Hi sienaman,

    Getsockopt method don't have a option to set bluetooth radio, you can find the all the options here.

     

    As a workaround, you can BthSetMode API to enable or disable Bluetooth radio, you can use the API to set three status:

    BTH_POWER_OFF
    Turn off the Bluetooth radio.
    BTH_CONNECTABLE
    Turn on the Bluetooth radio, and make it connectable.
    BTH_DISCOVERABLE
    Turn on the Bluetooth radio, and make it both connectable and discoverable.

    Here is a sample:

    http://msdn2.microsoft.com/en-us/library/bb416244.aspx

     

    Best regards,

    Guang-Ming Bian - MSFT

    Friday, February 15, 2008 6:10 AM

All replies

  • Hi sienaman,

    Getsockopt method don't have a option to set bluetooth radio, you can find the all the options here.

     

    As a workaround, you can BthSetMode API to enable or disable Bluetooth radio, you can use the API to set three status:

    BTH_POWER_OFF
    Turn off the Bluetooth radio.
    BTH_CONNECTABLE
    Turn on the Bluetooth radio, and make it connectable.
    BTH_DISCOVERABLE
    Turn on the Bluetooth radio, and make it both connectable and discoverable.

    Here is a sample:

    http://msdn2.microsoft.com/en-us/library/bb416244.aspx

     

    Best regards,

    Guang-Ming Bian - MSFT

    Friday, February 15, 2008 6:10 AM
  • Unfortunately BthSetMode/BthGetMode functions as well as bthutil.dll library are unavailable for CE 5.0. They exist on PPC2003, WM5, etc, but not on CE 5.0. Anyway I have not seen a controller with CE 5.0 that supports these functionality.

    All the other Microsoft Bluetooth API functions (except for BthSetMode/BthGetMode) exist and work perfectly... If you know how to turn Bluetooth power on, of course.

    I am used to using special libraries from the controller manufacturer for Bluetooth power management, but I would appreciate if somebody knows a universal approach that works on any CE 5.0 controller with the Micrtosoft Bluetooth stack.
    Thursday, March 6, 2008 1:17 PM
  • According to the documentation, it is supposed to be available from CE 4.2 on. I looked at a couple of bluetooth related projects I did for Mobile 5 and Pocket PC 2003. In both I had added bthutil.lib to the linker command line to get the power APIs. If that isn't an option though, I think you are out of luck for a "universal" solution.

     

    Thursday, March 6, 2008 4:35 PM
  • Is it possible to use the bthutil.dll library on WM6 ...? Till now i dont think i could find the library and had to rely on a third party stack like inthehand .. to use bluetooth functions...?

     

     

    Wednesday, June 25, 2008 1:01 AM