Original Author Paul Laughton, 2011
Page 128
De Re BASIC!
connection with one Bt.open command because the Android API requires declaring a specific
secure/insecure open.
If Bt.open is used in graphics mode (after Gr.open), you will need to insert a Pause 500 statement after
the Bt.open statement.
Bt.close
Closes any previously opened Bluetooth connection. Bluetooth will automatically be closed when the
program execution ends.
Bt.connect {0|1}
Commands BASIC! to connect to a particular device. Executing this command will cause a list of paired
devices to be displayed. When one of these devices is selected the Bt.status will become "Connecting"
until the device has connected.
The optional parameter determines if BT will seek a secure or insecure connection. If no parameter is
given or if the parameter is 1, then a secure connection will be requested. Otherwise, an insecure
connection will be requested.
Bt.disconnect
Disconnects from the connected Bluetooth device and goes into the Listen status. This avoids having to
use Bt.close + Bt.open to disconnect and wait for a new connection.
Bt.reconnect
This command will attempt to reconnect to a device that was previously connected (during this Run)
with Bt.connect or a prior Bt.reconnect. The command cannot be used to reconnect to a device that
was connected following a Bt.open or Bt.disconnect command (i.e. from the Listening status).
You should monitor the Bluetooth status for Connected (3) after executing Bt.reconnect.
Bt.status {{<connect_var>}{, <name_svar>}{, <address_svar>}}
Gets the current Bluetooth status and places the information in the return variables. The available data
are the current connection status (in <connect_var>), and the friendly name and MAC address of your
Bluetooth hardware (in <name_svar> and <address_svar>).
All parameters are optional; use commas to indicate omitted parameters (see Optional Parameters).
If the connection status variable <connect_var> is present, it may be either a numeric variable or a string
variable. The table shows the possible return values of each type:
Numeric Value
String Value
Meaning
-1
Not enabled
Bluetooth not enabled
0
Idle
Nothing going on