|
SWILIB API (X75)
|
Bluetooth functions.
Usage: #include <swilib.h> or #include <swilib/bluetooth.h>
Data Structures | |
| struct | SDEV |
| SDev endpoint. More... | |
| struct | SDEV_APP |
| SDev application callbacks. More... | |
| struct | JSAPI_CONN |
| JSApi connection slot (see RamJSApiConnections). More... | |
| struct | BTLP_CONN |
| BTLP connection (see RamBtlpConnections). More... | |
| struct | L2CAP_CHANNEL |
| L2CAP channel (see RamL2capChannelState). More... | |
Typedefs | |
| typedef struct SDEV | SDEV |
| typedef struct SDEV_APP | SDEV_APP |
| typedef struct JSAPI_CONN | JSAPI_CONN |
| typedef struct BTLP_CONN | BTLP_CONN |
| typedef struct L2CAP_CHANNEL | L2CAP_CHANNEL |
| typedef struct CA_REMDEV | CA_REMDEV |
| Remote Bluetooth device object (CA layer), also used by the BTA_RemBtDeviceInfo_* functions. | |
Functions | |
| void | SDev_InitEndpoint (SDEV *ep) |
| Initialize an SDev endpoint with the firmware default callbacks. | |
| uint8_t * | BT_GetLocalDevice (void) |
| Get the native local Bluetooth device object. | |
| const SDEV_APP ** | RamSDevApps (void) |
| Get the SDev application callback table. | |
| uint16_t * | RamBtBufferPool (void) |
| Get the native Bluetooth buffer-pool status. | |
| unsigned | BTA_SdpRec_GetChannel (const void *record, int rfcomm) |
| Server channel from an SDP record's ProtocolDescriptorList. | |
| uint32_t | JSApi_CurrentHandleID (int conn) |
| Find the JSApi (Java Bluetooth) slot of a connection handle. | |
| void | JSApi_InitHandles (void) |
| Initialise the JSApi slots once and register JSApi as an SDev application. | |
| int | JSApi_RegisterConHandle (int conn, uint32_t packet, void(*on_connect)(int conn)) |
| Register a connection handle in a free JSApi slot. | |
| int | JSApi_ReadBytes (int conn, void *buffer, uint32_t size) |
| Read received data of a JSApi connection. | |
| int | JSApi_BytesAvailable (int conn) |
| Get the number of received bytes waiting in a JSApi connection. | |
| int | JSApi_WriteBytes (int conn, const void *data, uint32_t size) |
| Send data over a JSApi connection. | |
| int | JSApi_ClearConnectionHandle (int conn) |
| Free the JSApi slot of a connection handle and its receive buffer. | |
| void | BTLP_InitL2CAP_IO (void) |
| Initialise the L2CAP port devices: 9 on NSG/ELKA (SAPI 0x0D..0x15), 4 on SG/X75 (SAPI 0x08..0x0B). | |
| int | BTLP_uiSendDataOverBT (const void *data, uint32_t size, int sapi) |
| Send data over an L2CAP port: one buffer per packet from the shared stack pool. | |
| void | BTLP_vDataToAppCallback (int sapi) |
| Deliver received packets queued on an L2CAP port to its application until it stops taking them. | |
| void | BTLP_vFlushBuffer (int mode, int sapi) |
| Drop the received packets queued on an L2CAP port. | |
| void | L2CA_ReadDataReq (const void *message) |
| L2CAP handler of the L2CA_ReadDataReq signal. | |
| void | SApp_Register (int handler_id, const SDEV_APP *methods) |
| Register an SDev application (serial data endpoint) in the application table. | |
| int | ConnSDevSApp (uint32_t sdevice, uint32_t handler_id, const void *connection_info) |
| Connect a serial device to an SDev application. | |
| int | CHConnSApp (uint32_t handler_id, uint32_t instance, uint32_t new_handler_id, const void *connection_info) |
| Move an open device connection from one SDev application to another. | |
| int | Serial_CanOpenSApp (uint32_t handler_id, uint32_t instance) |
| Check whether an SDev application would accept a connection (opens and closes it again). | |
| void | Ca_SasSApp_Init (void) |
| Initialise the SIM Access Profile server and register it as SDev application 0x13. | |
| JSAPI_CONN * | RamJSApiConnections (void) |
| Get the JSApi (Java Bluetooth) connection slots. | |
| BTLP_CONN * | RamBtlpConnections (void) |
| Get the BTLP (Bluetooth L2CAP port) connection table. | |
| L2CAP_CHANNEL * | RamL2capChannelState (void) |
| Get the L2CAP channel table. | |
| uint16_t | CA_MR_New (int cepid, int msg, const char *file, int line) |
Create a CA message replicator: every event of the objects it is subscribed to comes to cepid as GBS message msg (submess = replicator, data0 = object message). | |
| void | CA_MR_Subscribe (uint16_t mr, int code, int class_id) |
| Subscribe a replicator to the events of an object class. | |
| void | CA_MR_Stop (uint16_t mr) |
| Stop a replicator; it then reports CA_MR_Class() event 6 and can be released. | |
| void | CA_MR_Done (uint16_t mr, void *object_message) |
| Hand an event (data0 of the replicator's GBS message) back to the replicator. | |
| uint8_t | CA_MR_Class (void) |
| Object class of the replicator's own events. | |
| void | CA_Release (uint16_t handle) |
| Release a CA object handle (replicator, connection). | |
| uint8_t | CA_SapiConnClass (void) |
| Object class of SAPI connection events (opened, closed, failed, parameters). | |
| CA_REMDEV * | CA_RemDev_New (const uint8_t bd_addr[6]) |
| Create a remote device object for a 6-byte BT address. | |
| void | CA_RemDev_Free (CA_REMDEV *remdev) |
| Free a remote device object. | |
| uint16_t | CA_L2CAP_New (uint16_t mr, CA_REMDEV *remdev, int sapi, int psm, int master, int encrypt, int authenticate, int rx_mtu, int tx_mtu) |
Open an outgoing L2CAP connection; events go to the replicator mr. | |
| int | CA_Conn_Close (uint16_t conn, uint16_t owner) |
Close a CA connection; owner = the replicator that gets the events. | |
| uint16_t | CA_DevList (uint16_t local_dev) |
| Device list object of the local BT device. | |
| uint8_t | CA_DevListClass (void) |
| Object class of device list answers. | |
| void | CA_DevList_CountReq (uint16_t list, uint16_t mr, int type) |
Ask for the number of entries of a device list (type 0 = paired); the answer comes to mr. | |
| void | CA_DevList_EntryReq (uint16_t list, uint16_t mr, int type, int index) |
Ask for one device list entry; the answer (a RemDev copy) comes to mr. | |
| uint16_t | CA_LocalRoot (void) |
| Root object of the local BT stack. | |
| uint16_t | CA_LocalDev (uint16_t root, int zero) |
| Local BT device object. | |
| const uint8_t * | CA_LocalAddr (uint16_t local_dev) |
| BT address of the local device object. | |
| struct SDEV |
| struct SDEV_APP |
| struct JSAPI_CONN |
| struct BTLP_CONN |
| struct L2CAP_CHANNEL |
| typedef struct SDEV SDEV |
Definition at line 17 of file bluetooth.h.
| typedef struct SDEV_APP SDEV_APP |
Definition at line 18 of file bluetooth.h.
| typedef struct JSAPI_CONN JSAPI_CONN |
Definition at line 19 of file bluetooth.h.
| typedef struct BTLP_CONN BTLP_CONN |
Definition at line 20 of file bluetooth.h.
| typedef struct L2CAP_CHANNEL L2CAP_CHANNEL |
Definition at line 21 of file bluetooth.h.
Remote Bluetooth device object (CA layer), also used by the BTA_RemBtDeviceInfo_* functions.
Definition at line 26 of file bluetooth.h.
| void SDev_InitEndpoint | ( | SDEV * | ep | ) |
Initialize an SDev endpoint with the firmware default callbacks.
| ep | endpoint storage owned by the caller |
| uint8_t * BT_GetLocalDevice | ( | void | ) |
Get the native local Bluetooth device object.
Get the SDev application callback table.
| uint16_t * RamBtBufferPool | ( | void | ) |
Get the native Bluetooth buffer-pool status.
| unsigned BTA_SdpRec_GetChannel | ( | const void * | record, |
| int | rfcomm ) |
Server channel from an SDP record's ProtocolDescriptorList.
| record | SDP service record |
| rfcomm | 1: RFCOMM channel, 0: L2CAP PSM |
| uint32_t JSApi_CurrentHandleID | ( | int | conn | ) |
Find the JSApi (Java Bluetooth) slot of a connection handle.
| conn | connection handle |
| void JSApi_InitHandles | ( | void | ) |
Initialise the JSApi slots once and register JSApi as an SDev application.
ARM code.
| int JSApi_RegisterConHandle | ( | int | conn, |
| uint32_t | packet, | ||
| void(* | on_connect )(int conn) ) |
Register a connection handle in a free JSApi slot.
| conn | connection handle |
| packet | 0: RFCOMM stream, 1: L2CAP packets |
| on_connect | called with conn when a device attaches, NULL = none (ignored on SG/X75) |
| int JSApi_ReadBytes | ( | int | conn, |
| void * | buffer, | ||
| uint32_t | size ) |
Read received data of a JSApi connection.
In packet mode reads one L2CAP packet.
| conn | connection handle |
| buffer | output buffer |
| size | buffer size; the rest of a longer packet is dropped |
| int JSApi_BytesAvailable | ( | int | conn | ) |
Get the number of received bytes waiting in a JSApi connection.
| conn | connection handle |
| int JSApi_WriteBytes | ( | int | conn, |
| const void * | data, | ||
| uint32_t | size ) |
Send data over a JSApi connection.
| conn | connection handle |
| data | data |
| size | size in bytes |
| int JSApi_ClearConnectionHandle | ( | int | conn | ) |
Free the JSApi slot of a connection handle and its receive buffer.
| conn | connection handle |
| void BTLP_InitL2CAP_IO | ( | void | ) |
Initialise the L2CAP port devices: 9 on NSG/ELKA (SAPI 0x0D..0x15), 4 on SG/X75 (SAPI 0x08..0x0B).
| int BTLP_uiSendDataOverBT | ( | const void * | data, |
| uint32_t | size, | ||
| int | sapi ) |
Send data over an L2CAP port: one buffer per packet from the shared stack pool.
| data | data |
| size | size in bytes; on NSG/ELKA more than the channel maximum is a fatal error |
| sapi | L2CAP port SAPI (see BTLP_InitL2CAP_IO) |
| void BTLP_vDataToAppCallback | ( | int | sapi | ) |
Deliver received packets queued on an L2CAP port to its application until it stops taking them.
| sapi | L2CAP port SAPI (see BTLP_InitL2CAP_IO) |
| void BTLP_vFlushBuffer | ( | int | mode, |
| int | sapi ) |
Drop the received packets queued on an L2CAP port.
| mode | 1 or 3 flushes, other values do nothing |
| sapi | L2CAP port SAPI (see BTLP_InitL2CAP_IO) |
| void L2CA_ReadDataReq | ( | const void * | message | ) |
L2CAP handler of the L2CA_ReadDataReq signal.
Not reversed.
| message | signal, meaning not known |
Register an SDev application (serial data endpoint) in the application table.
| handler_id | application number (0..31 on NSG/ELKA, 0..26 on SG/X75) |
| methods | method table of the application ARM code. |
| int ConnSDevSApp | ( | uint32_t | sdevice, |
| uint32_t | handler_id, | ||
| const void * | connection_info ) |
Connect a serial device to an SDev application.
| sdevice | device type (0..18 on NSG/ELKA, 0..16 on SG/X75) |
| handler_id | application number (see SApp_Register) |
| connection_info | connection information passed to both sides |
| int CHConnSApp | ( | uint32_t | handler_id, |
| uint32_t | instance, | ||
| uint32_t | new_handler_id, | ||
| const void * | connection_info ) |
Move an open device connection from one SDev application to another.
| handler_id | current application number (see SApp_Register) |
| instance | connection instance of the current application |
| new_handler_id | new application number; the current one returns 1 without changes |
| connection_info | connection information for the new application |
| int Serial_CanOpenSApp | ( | uint32_t | handler_id, |
| uint32_t | instance ) |
Check whether an SDev application would accept a connection (opens and closes it again).
| handler_id | application number (see SApp_Register) |
| instance | passed to the application's open method |
| void Ca_SasSApp_Init | ( | void | ) |
Initialise the SIM Access Profile server and register it as SDev application 0x13.
| JSAPI_CONN * RamJSApiConnections | ( | void | ) |
Get the JSApi (Java Bluetooth) connection slots.
| BTLP_CONN * RamBtlpConnections | ( | void | ) |
Get the BTLP (Bluetooth L2CAP port) connection table.
| L2CAP_CHANNEL * RamL2capChannelState | ( | void | ) |
Get the L2CAP channel table.
| uint16_t CA_MR_New | ( | int | cepid, |
| int | msg, | ||
| const char * | file, | ||
| int | line ) |
Create a CA message replicator: every event of the objects it is subscribed to comes to cepid as GBS message msg (submess = replicator, data0 = object message).
| file,line | caller's source position (debug only) |
| void CA_MR_Subscribe | ( | uint16_t | mr, |
| int | code, | ||
| int | class_id ) |
Subscribe a replicator to the events of an object class.
| void CA_MR_Stop | ( | uint16_t | mr | ) |
Stop a replicator; it then reports CA_MR_Class() event 6 and can be released.
| void CA_MR_Done | ( | uint16_t | mr, |
| void * | object_message ) |
Hand an event (data0 of the replicator's GBS message) back to the replicator.
| uint8_t CA_MR_Class | ( | void | ) |
Object class of the replicator's own events.
| void CA_Release | ( | uint16_t | handle | ) |
Release a CA object handle (replicator, connection).
| uint8_t CA_SapiConnClass | ( | void | ) |
Object class of SAPI connection events (opened, closed, failed, parameters).
Create a remote device object for a 6-byte BT address.
| void CA_RemDev_Free | ( | CA_REMDEV * | remdev | ) |
Free a remote device object.
| uint16_t CA_L2CAP_New | ( | uint16_t | mr, |
| CA_REMDEV * | remdev, | ||
| int | sapi, | ||
| int | psm, | ||
| int | master, | ||
| int | encrypt, | ||
| int | authenticate, | ||
| int | rx_mtu, | ||
| int | tx_mtu ) |
Open an outgoing L2CAP connection; events go to the replicator mr.
| int CA_Conn_Close | ( | uint16_t | conn, |
| uint16_t | owner ) |
Close a CA connection; owner = the replicator that gets the events.
| uint16_t CA_DevList | ( | uint16_t | local_dev | ) |
Device list object of the local BT device.
| uint8_t CA_DevListClass | ( | void | ) |
Object class of device list answers.
| void CA_DevList_CountReq | ( | uint16_t | list, |
| uint16_t | mr, | ||
| int | type ) |
Ask for the number of entries of a device list (type 0 = paired); the answer comes to mr.
| void CA_DevList_EntryReq | ( | uint16_t | list, |
| uint16_t | mr, | ||
| int | type, | ||
| int | index ) |
Ask for one device list entry; the answer (a RemDev copy) comes to mr.
| uint16_t CA_LocalRoot | ( | void | ) |
Root object of the local BT stack.
| uint16_t CA_LocalDev | ( | uint16_t | root, |
| int | zero ) |
Local BT device object.
| const uint8_t * CA_LocalAddr | ( | uint16_t | local_dev | ) |
BT address of the local device object.