Bluetooth IO functions.
This is a connectivity layer and uses rfcomm. Protocols, such as AVDTP, should be implemented at a layer above this one. The generic rfcomm uuid that the vast majority of devices use is 00001101-0000-1000-8000-00805f9b34fb.
Supported OS:
◆ M_io_bluetooth_enum_t
◆ M_io_bluetooth_enum()
Create a bluetooth enumeration object.
Use to determine what bluetooth devices are connected and what services are being offered. This is a list of associated devices not necessarily what's actively connected.
The enumeration is based on available services. Meaning a device may be listed multiple times if it exposes multiple services.
- Returns
- Bluetooth enumeration object.
◆ M_io_bluetooth_enum_destroy()
Destroy a bluetooth enumeration object.
- Parameters
-
[in] | btenum | Bluetooth enumeration object. |
◆ M_io_bluetooth_enum_count()
Number of bluetooth objects in the enumeration.
- Parameters
-
[in] | btenum | Bluetooth enumeration object. |
- Returns
- Count of bluetooth devices.
◆ M_io_bluetooth_enum_name()
Name of bluetooth device as reported by the device.
- Parameters
-
[in] | btenum | Bluetooth enumeration object. |
[in] | idx | Index in bluetooth enumeration. |
- Returns
- String.
◆ M_io_bluetooth_enum_mac()
MAC of bluetooth device.
- Parameters
-
[in] | btenum | Bluetooth enumeration object. |
[in] | idx | Index in bluetooth enumeration. |
- Returns
- String.
◆ M_io_bluetooth_enum_connected()
Whether the device is connected.
Not all systems are able to report the connected status making this function less useful than you would think.
- Returns
- M_TRUE if the device is connected, otherwise M_FALSE. If it is not possible to determine the connected status this function will return M_TRUE.
◆ M_io_bluetooth_enum_service_name()
Name of service reported by device.
- Parameters
-
[in] | btenum | Bluetooth enumeration object. |
[in] | idx | Index in bluetooth enumeration. |
- Returns
- String.
◆ M_io_bluetooth_enum_service_uuid()
Uuid of service reported by device.
- Parameters
-
[in] | btenum | Bluetooth enumeration object. |
[in] | idx | Index in bluetooth enumeration. |
- Returns
- String.
◆ M_io_bluetooth_create()
M_io_error_t M_io_bluetooth_create |
( |
M_io_t ** |
io_out, |
|
|
const char * |
mac, |
|
|
const char * |
uuid |
|
) |
| |
Create a bluetooth connection.
- Parameters
-
[out] | io_out | io object for communication. |
[in] | mac | Required MAC of the device. |
[in] | uuid | Optional UUID of the device. For rfcomm (used by this io interface) the uuid is almost always 00001101-0000-1000-8000-00805f9b34fb unless the device is providing multiple services. Such as a device that can do multiple things like bar code scanner, and integrated printer. If not specified the generic rfcomm uuid will be used. |
- Returns
- Result.