Bluetooth On|Off


Bluetooth On|Off

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.

Bluetooth On

timeout = time() + 10000
Do While BTGetState(1) = 6 and time() < timeout
Wait 1000
Loop

if BTGetState(1) = 1 then
print "Bluetooth Enabled"
else
print "Bluetooth Not Enabled"
endif

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.




Pairing a Bluetooth device.


BTGetPaired$()


BTConnect


BTDiscoverable


BTListen


BTGetSize()


BTGetState()


BTGetError$()


BTRead$()


BTWrite


BTGetName$()


BTClose







Become a Patron