This stream is used to listen for new bluetooth devices. In other words, this stream
emits new bluetooth devices. Unlike the getBondedDevices function which returns a list
of bluetooth devices, this stream emits one device at a time so you would want to store the device
in a list when it is emitted. For instance
This stream is used to listen for bluetooth connections.
This connection contains the ConnectionResult, that is, the status, the response message of
that connection, and if the connection was successful, there will also be a BluetoothDevice
object also.
The stream for listening for data/messages across a bluetooth connection. Make sure you use it with the
listenForConnection stream so that you will be sure you are send across a proper connection
This stream is used to listen to the state of your device's bluetooth, whether it is
turned on/off.
If you change the state of your device bluetooth, this stream will
emit a value corresponding to that state. So if you turn the bluetooth on, you get
true and vice versa.
This function is used to connect to another bluetooth device, using the other device's
address. For this function to be successful, make sure the other device is connecting as
a server because you connecting are the client
Use this function to send data across your bluetooth connection. Your data is sent as raw text
so you might want to perform your own encoding to ensure security when send and receiving
the data.
This function is used to open a server socket if you want to connect as a server. The opened socket
will keep listening for clients unless you explictly close the bluetooth server with
closeConnection function
This function is used to start bluetooth discovery of unpaired or new devices. This function should be used
together with discoverDevices stream in order in get discovered devices. If you are not getting
the devices as expected, just call stopDiscovery, and startDiscovery again.