This command turns the Bluetooth adapter on or off.
There is a delay from the time you issue a Bluetooth On command and when the Bluetooth adapter becomes ready. So you need to uses something like the following code to insure the adapter is ready before using it.
timeout = time() + 10000
Do While BTGetState(1) = 6 and time() < timeout
if BTGetState(1) = 1 then
print "Bluetooth Enabled"
print "Bluetooth Not Enabled"
BTGetState(n) will return 1 (closed) when the adapter is on and ready to be used. When the adapter is disabled BTGetState(n) will return 6 (disabled).
When a Bluetooth Off command is executed the adapter is immediately turned off and no extra code is needed. Remember that when you execute a Bluetooth Off command the adapter will be shut off for all apps.