Turning Bluetooth on/off in Windows Mobile

Two APIs BthGetMode and BthSetMode can be used to get or set Bluetooth mode in Windows Mobile. The enumeration BTH_RADIO_MODE contains the Bluetooth modes. These functions are defined in bthutil.h header file and the library file is bthutil.lib. The following code snippet toggles the bluetooth on/off:

DWORD dwMode;

BthGetMode(&dwMode);

if(BTH_DISCOVERABLE == dwMode || BTH_CONNECTABLE == dwMode) dwMode = BTH_POWER_OFF;
else dwMode = BTH_DISCOVERABLE;

BthSetMode(dwMode);

2 Comments

Add yours →

  1. Nice code snippet

  2. Nice code snippet

Leave a Reply