2007-02-16

Disabling BlueTooth on a Pocket PC

We use wireless printing through a COM port over BlueTooth. Having BlueTooth on all of the time can contribute towards energy consumption and cause the battery life on the Pocket PC to deplete faster. Now I disable BT when the application starts, and then re-enable it to print and disable it immediately afters. This adds about 1 second to each print job but it should save the battery power.


[DllImport("BthUtil.dll")]
private static extern int BthGetMode(out BlueToothRadioMode dwMode);

[DllImport("BthUtil.dll")]
private static extern int BthSetMode(BlueToothRadioMode dwMode);

public static BlueToothRadioMode BlueToothRadioMode
{
get
{
BlueToothRadioMode result;
BthGetMode(out result);
return result;
}
set
{
if (value != BlueToothRadioMode)
BthSetMode(value);
}
}

No comments: