Makes a connection between your Bluetooth-equipped device and another Bluetooth-equipped device. Click for a short example of using bluetooth, or here for Rhodes-System-Api-Samples – BluetoothChat.
You need to enable Bluetooth on the device. Do this by adding that capability to the build.yml file:
capabilities: - bluetooth
Returns true if Bluetooth is available on the device, false otherwise.
Rho::BluetoothManager.is_bluetooth_available
Turn Bluetooth off for existing Bluetooth session instance. It DOES NOT turn off the BT adapter.
Rho::BluetoothManager.off_bluetooth
Change the local device name.
Rho::BluetoothManager.set_device_name(name)
name |
String. The new name for the device. |
Get local device name for current device (the name displayed on another device).
Rho::BluetoothManager.get_device_name
Returns the last error: OK or ERROR or CANCEL.
Rho::BluetoothManager.get_last_error
Creates a Bluetooth session. Returns OK or ERROR.
Rho::BluetoothManager.create_session(role, callback_url)
role |
ROLE_SERVER or ROLE_CLIENT |
callback_url |
url to a callback method called after the Bluetooth session is created or canceled. Parameters received in the callback: status of OK or ERROR or CANCEL; and connected_device_name , the name of the device connected via Bluetooth.
|
Connect without a user interface. Makes the current device discoverable for another device, and waits for the client connection from the other device.
Rho::BluetoothManager.create_server_and_wait_for_connection(callback_url)
callback_url |
url to a callback method called after the Bluetooth session is created or canceled. Parameters received in the callback: status of OK or ERROR or CANCEL; and connected_device_name , the name of the device connected via Bluetooth.
|
Connect without user interface. Make the client connection to another device.
Rho::BluetoothManager.create_client_connection_to_device(server_name, callback_url)
server_name |
The name of the other device. If you connect with user interface, you receive this name as connected_device_name. |
callback_url |
url to a callback method called after the Bluetooth session is created or canceled. Parameters received in the callback: status , OK or ERROR or CANCEL, and connected_device_name , the name of the Bluetooth connected device.
|
When connecting without user interface (create_server_and_wait_for_connection
), cancel the current connection.
Rho::BluetoothManager.stop_current_connection_process