Mstdlib-1.24.0

Typedefs

typedef struct M_io_bluetooth_enum M_io_bluetooth_enum_t
 

Functions

M_io_bluetooth_enum_tM_io_bluetooth_enum (void)
 
void M_io_bluetooth_enum_destroy (M_io_bluetooth_enum_t *btenum)
 
size_t M_io_bluetooth_enum_count (const M_io_bluetooth_enum_t *btenum)
 
const char * M_io_bluetooth_enum_name (const M_io_bluetooth_enum_t *btenum, size_t idx)
 
const char * M_io_bluetooth_enum_mac (const M_io_bluetooth_enum_t *btenum, size_t idx)
 
M_bool M_io_bluetooth_enum_connected (const M_io_bluetooth_enum_t *btenum, size_t idx)
 
const char * M_io_bluetooth_enum_service_name (const M_io_bluetooth_enum_t *btenum, size_t idx)
 
const char * M_io_bluetooth_enum_service_uuid (const M_io_bluetooth_enum_t *btenum, size_t idx)
 
M_io_error_t M_io_bluetooth_create (M_io_t **io_out, const char *mac, const char *uuid)
 

Detailed Description

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:

Typedef Documentation

◆ M_io_bluetooth_enum_t

Function Documentation

◆ M_io_bluetooth_enum()

M_io_bluetooth_enum_t * M_io_bluetooth_enum ( void  )

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()

void M_io_bluetooth_enum_destroy ( M_io_bluetooth_enum_t btenum)

Destroy a bluetooth enumeration object.

Parameters
[in]btenumBluetooth enumeration object.

◆ M_io_bluetooth_enum_count()

size_t M_io_bluetooth_enum_count ( const M_io_bluetooth_enum_t btenum)

Number of bluetooth objects in the enumeration.

Parameters
[in]btenumBluetooth enumeration object.
Returns
Count of bluetooth devices.

◆ M_io_bluetooth_enum_name()

const char * M_io_bluetooth_enum_name ( const M_io_bluetooth_enum_t btenum,
size_t  idx 
)

Name of bluetooth device as reported by the device.

Parameters
[in]btenumBluetooth enumeration object.
[in]idxIndex in bluetooth enumeration.
Returns
String.

◆ M_io_bluetooth_enum_mac()

const char * M_io_bluetooth_enum_mac ( const M_io_bluetooth_enum_t btenum,
size_t  idx 
)

MAC of bluetooth device.

Parameters
[in]btenumBluetooth enumeration object.
[in]idxIndex in bluetooth enumeration.
Returns
String.

◆ M_io_bluetooth_enum_connected()

M_bool M_io_bluetooth_enum_connected ( const M_io_bluetooth_enum_t btenum,
size_t  idx 
)

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()

const char * M_io_bluetooth_enum_service_name ( const M_io_bluetooth_enum_t btenum,
size_t  idx 
)

Name of service reported by device.

Parameters
[in]btenumBluetooth enumeration object.
[in]idxIndex in bluetooth enumeration.
Returns
String.

◆ M_io_bluetooth_enum_service_uuid()

const char * M_io_bluetooth_enum_service_uuid ( const M_io_bluetooth_enum_t btenum,
size_t  idx 
)

Uuid of service reported by device.

Parameters
[in]btenumBluetooth enumeration object.
[in]idxIndex 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_outio object for communication.
[in]macRequired MAC of the device.
[in]uuidOptional 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.