Allows access to serial data over Bluetooth SPP
Events
bluetoothsppopened
Fired when an SPP connection has been sucessfully opened.
Event data
{String} A connection identifier that represents the opened connection.
bluetoothsppclosed
Fired when an SPP connection has been sucessfully closed.
Event data
{String} A connection identifier that represents the connection that has closed.
bluetoothsppnewdata
Fired when new data has been received on an SPP connection.
Event data
{Object}
Example
{ conn:{String}, // A connection identifier object data:{String}, // The new data that has been received on the SPP connection, encoded in Base64 }
bluetoothspperror
Fired when an error has occured with the SPP connection.
Event data
{Object}
Example
{ conn:{String}, // A connection identifier object errno:{Number}, // The errno for the error that occured }
Methods
-
close
-
Close an SPP connection
Parameters:
Name Type Description conn
Object The SPP connection to close. -
open
-
Open an SPP stream
Parameters:
Name Type Description mac
String The MAC addresss of the Bluetooth device to open the SPP connection on. service_id
String The UUID that identifies the SPP service to open. Returns:
The object for this connection. Returns undefined if there was an error.- Type
-
- Object
-
write
-
Write the specified Base64-encoded data to the SPP connection
Parameters:
Name Type Description conn
Object The SPP connection to write the data to. data
String The Base64-encoded data to write to the SPP connection.