SWILIB API (NSG)    
Loading...
Searching...
No Matches
Bluetooth

Detailed Description

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

int BtAccessor_New (int cepid, int msg, int no_servers, int zero)
 Create a Bluetooth accessor.
 
void BtAccessor_Delete (int oh)
 Delete a Bluetooth accessor after closing its connections and servers.
 
uint32_t BTA_ObjMsg (void *ev)
 Read the Bluetooth event identifier from an accessor event object.
 
int BTA_Server_New (int oh, int proto, int master, int encrypt, int authenticate, int authorize, int rx_mtu, int tx_mtu, int tid)
 Create an RFCOMM or L2CAP server under an accessor.
 
void BTA_Server_StartReq (int oh, int server, int sdp_record, int unk, int tid)
 Start a Bluetooth server and publish its SDP record.
 
void BTA_Server_AcceptReq (int oh, int server, int enable, int tid)
 Enable or disable incoming connections on a Bluetooth server.
 
void BTA_Server_StopReq (int oh, int server, int tid)
 Request asynchronous stop of a Bluetooth server.
 
void BTA_Server_Delete (int oh, int server)
 Delete a stopped Bluetooth server.
 
void BTA_Sdp_Converter_New (int oh, void *(*alloc)(unsigned int), void(*free)(void *))
 Set allocator callbacks for accessor SDP records.
 
int BTA_SdpRec_New (int oh, const uint8_t uuid[16], int proto, int channel)
 Create a Bluetooth SDP service record.
 
void BTA_SdpRec_Delete (int oh, int record)
 Delete an accessor SDP record.
 
void BTA_Conn_CloseReq (int oh, int conn, int tid)
 Request asynchronous closure of a Bluetooth connection.
 
const uint8_t * BT_GetLocAddr (void)
 Get the local Bluetooth address.
 
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.
 
void BT_SetSecurityCheck (int lo, int unk1, int unk2, int unk3)
 Set the local Bluetooth connection security level.
 
const SDEV_APP ** RamSDevApps (void)
 Get the SDev application callback table.
 
uint16_t * RamBtBufferPool (void)
 Get the native Bluetooth buffer-pool status.
 
int BTA_Conn_New_L2CAP (int oh, const uint8_t addr[6], int sapi_type, int psm, int master, int encrypt, int authenticate, int rx_mtu, int tx_mtu, int tid)
 Open an outgoing L2CAP connection.
 
int BTA_Conn_New_RFCOMM (int oh, const uint8_t addr[8], int sapi_type, int channel, int master, int encrypt, int authenticate, int tid)
 Open an outgoing RFCOMM (SPP) connection to a remote device, client role.
 
int BTA_ServiceSearch_StartReq (int oh, const uint8_t addr[8], const void *uuids, const uint16_t *attrs, int nattrs, int tid)
 Search the SDP records of a remote device (what JSR-82 searchServices uses).
 
void BTA_ServiceSearch_StopReq (int oh, int remdev, int tid)
 Cancel a running service search.
 
unsigned BTA_SdpRec_GetChannel (const void *record, int rfcomm)
 Server channel from an SDP record's ProtocolDescriptorList.
 
int BTA_DeviceListView_GetList (int oh, int type)
 Open a view of the stored Bluetooth device list.
 
int BTA_DeviceListView_GetNumberOfEntries (int oh, int list)
 Count entries in a Bluetooth device-list view.
 
void BTA_DeviceListView_GetEntryReq (int oh, int list, int index, int tid)
 Request a stored Bluetooth device entry asynchronously.
 
void BTA_DeviceListView_StopList (int oh, int list)
 Close a Bluetooth device-list view.
 
const uint8_t * BTA_RemBtDeviceInfo_GetAddress (int oh, const CA_REMDEV *device)
 Read the Bluetooth address from a returned remote-device object.
 
const char * BTA_RemBtDeviceInfo_GetName (int oh, const CA_REMDEV *device)
 Read the name from a returned remote-device object.
 
void BTA_Conn_GetL2CAPParamReq (int oh, int conn, int tid)
 Request the L2CAP parameters of an open connection.
 
CA_REMDEV * BTA_Conn_GetRemDevInfo (int oh, int conn)
 Get the remote-device object of an open connection.
 
uint32_t BTA_RemBtDeviceInfo_GetStatus (int oh, const CA_REMDEV *device, int what)
 Read the link status of a remote device.
 
void BTA_AclDisconnectReq (int tid, const uint8_t addr[6])
 Drop the ACL link to a remote device (asynchronous).
 
void BTA_DeviceDiscovery_StartSearchReq (int oh, uint32_t service, int tid)
 Start a Bluetooth device search (asynchronous).
 
void BTA_DeviceDiscovery_StartSearchCodReq (int oh, uint32_t cod, uint32_t cod_mask, uint32_t iac, int tid)
 Start a Bluetooth device search filtered by class of device (asynchronous).
 
void BTA_DeviceDiscovery_StopSearchReq (int oh, int tid)
 Stop a running Bluetooth device search (asynchronous).
 
int BTA_RemBtDeviceInfo_SetName (int oh, CA_REMDEV *device, const char *name)
 Set the name stored in a remote-device object.
 
void * BTA_RemBtDeviceInfo_GetDeviceClass (int oh, CA_REMDEV *device)
 Get the class-of-device record of a remote-device object.
 
void BTA_LocBtDevice_SetVisibilityReq (int oh, uint32_t visibility, int tid)
 Set the visibility of the phone's Bluetooth (asynchronous).
 
void BTA_LocBtDevice_SetDIACReq (int oh, uint32_t diac, int tid)
 Set the inquiry access code (DIAC) the phone answers to (asynchronous).
 
void BTA_LocBtDevice_SetNameReq (int oh, const char *name, int tid)
 Set the phone's Bluetooth name (asynchronous).
 
uint32_t BTA_Conn_GetSapiApp (int oh, int conn)
 Get the SAPI application of an open connection.
 
int BTA_ServiceSearch_RetrieveServiceReq (int oh, uint32_t device, uint32_t record, void *param4, int param5, int tid)
 Request an SDP service record of a remote device (asynchronous).
 
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.
 
uint8_t JSApi_GetConnectionState (int conn)
 Get the state of a JSApi connection.
 
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.
 
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_DevList (uint16_t local_dev)
 Device list object of the local BT device.
 
uint8_t CA_DevListClass (void)
 Object class of device list answers.
 
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.
 

Data Structure Documentation

◆ SDEV

struct SDEV

◆ SDEV_APP

struct SDEV_APP

◆ JSAPI_CONN

struct JSAPI_CONN

◆ BTLP_CONN

struct BTLP_CONN

◆ L2CAP_CHANNEL

struct L2CAP_CHANNEL

Typedef Documentation

◆ SDEV

typedef struct SDEV SDEV

Definition at line 17 of file bluetooth.h.

◆ SDEV_APP

typedef struct SDEV_APP SDEV_APP

Definition at line 18 of file bluetooth.h.

◆ JSAPI_CONN

typedef struct JSAPI_CONN JSAPI_CONN

Definition at line 19 of file bluetooth.h.

◆ BTLP_CONN

typedef struct BTLP_CONN BTLP_CONN

Definition at line 20 of file bluetooth.h.

◆ L2CAP_CHANNEL

typedef struct L2CAP_CHANNEL L2CAP_CHANNEL

Definition at line 21 of file bluetooth.h.

◆ CA_REMDEV

typedef struct CA_REMDEV CA_REMDEV

Remote Bluetooth device object (CA layer), also used by the BTA_RemBtDeviceInfo_* functions.

Definition at line 26 of file bluetooth.h.

Function Documentation

◆ BtAccessor_New()

int BtAccessor_New ( int cepid,
int msg,
int no_servers,
int zero )

Create a Bluetooth accessor.

Events are sent to the supplied CEPID.

Parameters
cepiddestination process for accessor events
msgGBS message number for events
no_serversuse 0 when creating data servers
zeroreserved; pass 0
Returns
accessor handle; handles in the 0xFFxx range indicate failure

◆ BtAccessor_Delete()

void BtAccessor_Delete ( int oh)

Delete a Bluetooth accessor after closing its connections and servers.

Parameters
ohaccessor handle

◆ BTA_ObjMsg()

uint32_t BTA_ObjMsg ( void * ev)

Read the Bluetooth event identifier from an accessor event object.

Parameters
evevent object from the accessor message
Returns
event identifier; its low byte selects the event

◆ BTA_Server_New()

int BTA_Server_New ( int oh,
int proto,
int master,
int encrypt,
int authenticate,
int authorize,
int rx_mtu,
int tx_mtu,
int tid )

Create an RFCOMM or L2CAP server under an accessor.

Parameters
ohaccessor handle
proto1 for RFCOMM, 2 for L2CAP
mastermaster-role option
encryptencryption option
authenticateauthentication option
authorizeauthorization option
rx_mtureceive MTU
tx_mtutransmit MTU
tidtransaction identifier returned in the completion event
Returns
server handle. Creation completes asynchronously

◆ BTA_Server_StartReq()

void BTA_Server_StartReq ( int oh,
int server,
int sdp_record,
int unk,
int tid )

Start a Bluetooth server and publish its SDP record.

Parameters
ohaccessor handle
serverserver handle
sdp_recordSDP record handle
unkset to 0
tidtransaction identifier

◆ BTA_Server_AcceptReq()

void BTA_Server_AcceptReq ( int oh,
int server,
int enable,
int tid )

Enable or disable incoming connections on a Bluetooth server.

Parameters
ohaccessor handle
serverserver handle
enable1 to accept incoming connections, 0 to stop accepting
tidtransaction identifier

◆ BTA_Server_StopReq()

void BTA_Server_StopReq ( int oh,
int server,
int tid )

Request asynchronous stop of a Bluetooth server.

Parameters
ohaccessor handle
serverserver handle
tidtransaction identifier

◆ BTA_Server_Delete()

void BTA_Server_Delete ( int oh,
int server )

Delete a stopped Bluetooth server.

Parameters
ohaccessor handle
serverserver handle

◆ BTA_Sdp_Converter_New()

void BTA_Sdp_Converter_New ( int oh,
void *(* alloc )(unsigned int),
void(* free )(void *) )

Set allocator callbacks for accessor SDP records.

Parameters
ohaccessor handle
allocallocator used for SDP data
freematching deallocator

◆ BTA_SdpRec_New()

int BTA_SdpRec_New ( int oh,
const uint8_t uuid[16],
int proto,
int channel )

Create a Bluetooth SDP service record.

Parameters
ohaccessor handle
uuid16-byte service UUID, most significant byte first
proto1 for RFCOMM, 0 for L2CAP
channelRFCOMM channel or L2CAP PSM
Returns
SDP record handle

◆ BTA_SdpRec_Delete()

void BTA_SdpRec_Delete ( int oh,
int record )

Delete an accessor SDP record.

Parameters
ohaccessor handle
recordSDP record handle

◆ BTA_Conn_CloseReq()

void BTA_Conn_CloseReq ( int oh,
int conn,
int tid )

Request asynchronous closure of a Bluetooth connection.

Parameters
ohaccessor handle
connconnection handle
tidtransaction identifier

◆ BT_GetLocAddr()

const uint8_t * BT_GetLocAddr ( void )

Get the local Bluetooth address.

Returns
pointer to six bytes, least significant byte first, or NULL if unavailable

◆ SDev_InitEndpoint()

void SDev_InitEndpoint ( SDEV * ep)

Initialize an SDev endpoint with the firmware default callbacks.

Parameters
ependpoint storage owned by the caller

◆ BT_GetLocalDevice()

uint8_t * BT_GetLocalDevice ( void )

Get the native local Bluetooth device object.

Returns
firmware-owned device object. Its layout is firmware-specific
Note
Only on models with Bluetooth.

◆ BT_SetSecurityCheck()

void BT_SetSecurityCheck ( int lo,
int unk1,
int unk2,
int unk3 )

Set the local Bluetooth connection security level.

Parameters
lo0 selects high security; nonzero selects low security
unk1reserved; pass 0
unk2reserved; pass 0
unk3reserved; pass 0

◆ RamSDevApps()

const SDEV_APP ** RamSDevApps ( void )

Get the SDev application callback table.

Returns
firmware-owned table of application pointers (32 on NSG/ELKA, 27 on SG/X75)

◆ RamBtBufferPool()

uint16_t * RamBtBufferPool ( void )

Get the native Bluetooth buffer-pool status.

Returns
status words; words 0 and 1 count free receive and transmit buffers
Note
Only on models with Bluetooth.

◆ BTA_Conn_New_L2CAP()

int BTA_Conn_New_L2CAP ( int oh,
const uint8_t addr[6],
int sapi_type,
int psm,
int master,
int encrypt,
int authenticate,
int rx_mtu,
int tx_mtu,
int tid )

Open an outgoing L2CAP connection.

Completion arrives as an accessor event.

Parameters
ohaccessor handle
addrsix-byte peer address, least significant byte first
sapi_type0x17 selects the Java-compatible L2CAP SDev binding
psmremote L2CAP PSM
mastermaster-role option
encryptencryption option
authenticateauthentication option
rx_mtureceive MTU
tx_mtutransmit MTU
tidtransaction identifier
Returns
connection handle; handles in the 0xFFxx range indicate failure

◆ BTA_Conn_New_RFCOMM()

int BTA_Conn_New_RFCOMM ( int oh,
const uint8_t addr[8],
int sapi_type,
int channel,
int master,
int encrypt,
int authenticate,
int tid )

Open an outgoing RFCOMM (SPP) connection to a remote device, client role.

Parameters
ohaccessor handle
addreight-byte remote address buffer, least significant byte first
sapi_typeSAPI application type (0x16 for btspp)
channelRFCOMM server channel (1..30)
masterrequest the master role
encryptrequire encryption
authenticaterequire authentication
tidtransaction id (see NextTid)
Returns
connection handle, or an invalid handle on failure
Available on platforms:
NSG, ELKA

◆ BTA_ServiceSearch_StartReq()

int BTA_ServiceSearch_StartReq ( int oh,
const uint8_t addr[8],
const void * uuids,
const uint16_t * attrs,
int nattrs,
int tid )

Search the SDP records of a remote device (what JSR-82 searchServices uses).

The accessor then gets message 0x0F per matching record (+18 u16 exception, +20 record) and 0x10 when the search is over.

Parameters
ohaccessor handle
addrremote address, same layout as for BTA_Conn_New_RFCOMM
uuidsUUID list: { u8 count; u8 allocated; u32 element size = 20; void *elements }, element { u8 type (2 = 128-bit); u8 pad[3]; u8 uuid[16] big endian }; copied
attrsattribute ids to fetch (copied)
nattrsnumber of attribute ids
tidtransaction id
Returns
remote device handle, or an invalid handle on failure
Available on platforms:
NSG, ELKA

◆ BTA_ServiceSearch_StopReq()

void BTA_ServiceSearch_StopReq ( int oh,
int remdev,
int tid )

Cancel a running service search.

Parameters
ohaccessor handle
remdevremote device handle from BTA_ServiceSearch_StartReq
tidtransaction id
Available on platforms:
NSG, ELKA

◆ BTA_SdpRec_GetChannel()

unsigned BTA_SdpRec_GetChannel ( const void * record,
int rfcomm )

Server channel from an SDP record's ProtocolDescriptorList.

Parameters
recordSDP service record
rfcomm1: RFCOMM channel, 0: L2CAP PSM
Returns
channel / PSM, 0 if the record has none
Note
Only on models with Bluetooth.

◆ BTA_DeviceListView_GetList()

int BTA_DeviceListView_GetList ( int oh,
int type )

Open a view of the stored Bluetooth device list.

Parameters
ohaccessor handle
typelist type, 0: stored devices
Returns
device-list handle

◆ BTA_DeviceListView_GetNumberOfEntries()

int BTA_DeviceListView_GetNumberOfEntries ( int oh,
int list )

Count entries in a Bluetooth device-list view.

Parameters
ohaccessor handle
listdevice-list handle
Returns
number of entries

◆ BTA_DeviceListView_GetEntryReq()

void BTA_DeviceListView_GetEntryReq ( int oh,
int list,
int index,
int tid )

Request a stored Bluetooth device entry asynchronously.

Parameters
ohaccessor handle
listdevice-list handle
indexzero-based entry index
tidtransaction identifier returned with the entry

◆ BTA_DeviceListView_StopList()

void BTA_DeviceListView_StopList ( int oh,
int list )

Close a Bluetooth device-list view.

Parameters
ohaccessor handle
listdevice-list handle

◆ BTA_RemBtDeviceInfo_GetAddress()

const uint8_t * BTA_RemBtDeviceInfo_GetAddress ( int oh,
const CA_REMDEV * device )

Read the Bluetooth address from a returned remote-device object.

Parameters
ohaccessor handle
deviceremote-device object from the list-entry event
Returns
six-byte address, least significant byte first. Copy before consuming the event

◆ BTA_RemBtDeviceInfo_GetName()

const char * BTA_RemBtDeviceInfo_GetName ( int oh,
const CA_REMDEV * device )

Read the name from a returned remote-device object.

Parameters
ohaccessor handle
deviceremote-device object from the list-entry event
Returns
UTF-8 device name. Copy before consuming the event

◆ BTA_Conn_GetL2CAPParamReq()

void BTA_Conn_GetL2CAPParamReq ( int oh,
int conn,
int tid )

Request the L2CAP parameters of an open connection.

Answered with the accessor event BT_EVENT_CONNECTION_L2CAP_PARAMETERS_CFM (13).

Parameters
ohaccessor handle
connconnection handle
tidtransaction ID

◆ BTA_Conn_GetRemDevInfo()

CA_REMDEV * BTA_Conn_GetRemDevInfo ( int oh,
int conn )

Get the remote-device object of an open connection.

Parameters
ohaccessor handle
connconnection handle
Returns
remote-device object, for BTA_RemBtDeviceInfo_* calls

◆ BTA_RemBtDeviceInfo_GetStatus()

uint32_t BTA_RemBtDeviceInfo_GetStatus ( int oh,
const CA_REMDEV * device,
int what )

Read the link status of a remote device.

Parameters
ohaccessor handle
deviceremote-device object
what0: ACL status
Returns
status, 2: ACL connected

◆ BTA_AclDisconnectReq()

void BTA_AclDisconnectReq ( int tid,
const uint8_t addr[6] )

Drop the ACL link to a remote device (asynchronous).

Affects every profile on that link.

Parameters
tidtransaction ID
addrsix-byte Bluetooth address, least significant byte first

◆ BTA_DeviceDiscovery_StartSearchReq()

void BTA_DeviceDiscovery_StartSearchReq ( int oh,
uint32_t service,
int tid )

Start a Bluetooth device search (asynchronous).

Parameters
ohaccessor handle
serviceSAPI service to search for
tidtransaction ID

◆ BTA_DeviceDiscovery_StartSearchCodReq()

void BTA_DeviceDiscovery_StartSearchCodReq ( int oh,
uint32_t cod,
uint32_t cod_mask,
uint32_t iac,
int tid )

Start a Bluetooth device search filtered by class of device (asynchronous).

Parameters
ohaccessor handle
codclass of device to match
cod_maskmask applied to the class of device
iacinquiry access code
tidtransaction ID

◆ BTA_DeviceDiscovery_StopSearchReq()

void BTA_DeviceDiscovery_StopSearchReq ( int oh,
int tid )

Stop a running Bluetooth device search (asynchronous).

Parameters
ohaccessor handle
tidtransaction ID

◆ BTA_RemBtDeviceInfo_SetName()

int BTA_RemBtDeviceInfo_SetName ( int oh,
CA_REMDEV * device,
const char * name )

Set the name stored in a remote-device object.

Parameters
ohaccessor handle
deviceremote-device object
nameUTF-8 name
Returns
result of the store, 0 on failure

◆ BTA_RemBtDeviceInfo_GetDeviceClass()

void * BTA_RemBtDeviceInfo_GetDeviceClass ( int oh,
CA_REMDEV * device )

Get the class-of-device record of a remote-device object.

Parameters
ohaccessor handle
deviceremote-device object
Returns
class record (byte +2 is the major class), NULL when unknown

◆ BTA_LocBtDevice_SetVisibilityReq()

void BTA_LocBtDevice_SetVisibilityReq ( int oh,
uint32_t visibility,
int tid )

Set the visibility of the phone's Bluetooth (asynchronous).

Parameters
ohaccessor handle
visibilityvisibility mode
tidtransaction ID

◆ BTA_LocBtDevice_SetDIACReq()

void BTA_LocBtDevice_SetDIACReq ( int oh,
uint32_t diac,
int tid )

Set the inquiry access code (DIAC) the phone answers to (asynchronous).

Parameters
ohaccessor handle
diacinquiry access code
tidtransaction ID

◆ BTA_LocBtDevice_SetNameReq()

void BTA_LocBtDevice_SetNameReq ( int oh,
const char * name,
int tid )

Set the phone's Bluetooth name (asynchronous).

Parameters
ohaccessor handle
nameUTF-8 name
tidtransaction ID

◆ BTA_Conn_GetSapiApp()

uint32_t BTA_Conn_GetSapiApp ( int oh,
int conn )

Get the SAPI application of an open connection.

Parameters
ohaccessor handle
connconnection handle
Returns
SAPI application, 0xFF when the connection is not found

◆ BTA_ServiceSearch_RetrieveServiceReq()

int BTA_ServiceSearch_RetrieveServiceReq ( int oh,
uint32_t device,
uint32_t record,
void * param4,
int param5,
int tid )

Request an SDP service record of a remote device (asynchronous).

Only partly reversed.

Parameters
ohaccessor handle
deviceremote device
recordservice record handle
param4meaning not known
param5meaning not known
tidtransaction ID
Returns
meaning not known

◆ JSApi_CurrentHandleID()

uint32_t JSApi_CurrentHandleID ( int conn)

Find the JSApi (Java Bluetooth) slot of a connection handle.

Parameters
connconnection handle
Returns
slot index; when not registered, the number of slots (firmware dependent)

◆ JSApi_InitHandles()

void JSApi_InitHandles ( void )

Initialise the JSApi slots once and register JSApi as an SDev application.

ARM code.

◆ JSApi_RegisterConHandle()

int JSApi_RegisterConHandle ( int conn,
uint32_t packet,
void(* on_connect )(int conn) )

Register a connection handle in a free JSApi slot.

Parameters
connconnection handle
packet0: RFCOMM stream, 1: L2CAP packets
on_connectcalled with conn when a device attaches, NULL = none (ignored on SG/X75)
Returns
1 OK, 0 when the handle is already registered or 0xFFFE (NSG/ELKA), or the slots are full ARM code.

◆ JSApi_GetConnectionState()

uint8_t JSApi_GetConnectionState ( int conn)

Get the state of a JSApi connection.

Parameters
connconnection handle
Returns
3 device attached, 2 no device, 0 not registered ARM code.
Available on platforms:
NSG, ELKA

◆ JSApi_ReadBytes()

int JSApi_ReadBytes ( int conn,
void * buffer,
uint32_t size )

Read received data of a JSApi connection.

In packet mode reads one L2CAP packet.

Parameters
connconnection handle
bufferoutput buffer
sizebuffer size; the rest of a longer packet is dropped
Returns
bytes read ARM code.

◆ JSApi_BytesAvailable()

int JSApi_BytesAvailable ( int conn)

Get the number of received bytes waiting in a JSApi connection.

Parameters
connconnection handle
Returns
bytes available ARM code.

◆ JSApi_WriteBytes()

int JSApi_WriteBytes ( int conn,
const void * data,
uint32_t size )

Send data over a JSApi connection.

Parameters
connconnection handle
datadata
sizesize in bytes
Returns
bytes written, less than size when the stack is busy ARM code.

◆ JSApi_ClearConnectionHandle()

int JSApi_ClearConnectionHandle ( int conn)

Free the JSApi slot of a connection handle and its receive buffer.

Parameters
connconnection handle
Returns
1 freed, 0 not registered ARM code.

◆ BTLP_InitL2CAP_IO()

void BTLP_InitL2CAP_IO ( void )

Initialise the L2CAP port devices: 9 on NSG/ELKA (SAPI 0x0D..0x15), 4 on SG/X75 (SAPI 0x08..0x0B).

Note
Only on models with Bluetooth.

◆ BTLP_uiSendDataOverBT()

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.

Parameters
datadata
sizesize in bytes; on NSG/ELKA more than the channel maximum is a fatal error
sapiL2CAP port SAPI (see BTLP_InitL2CAP_IO)
Returns
bytes queued, less than size when the pool is empty
Note
Only on models with Bluetooth.

◆ BTLP_vDataToAppCallback()

void BTLP_vDataToAppCallback ( int sapi)

Deliver received packets queued on an L2CAP port to its application until it stops taking them.

Parameters
sapiL2CAP port SAPI (see BTLP_InitL2CAP_IO)
Note
Only on models with Bluetooth.

◆ BTLP_vFlushBuffer()

void BTLP_vFlushBuffer ( int mode,
int sapi )

Drop the received packets queued on an L2CAP port.

Parameters
mode1 or 3 flushes, other values do nothing
sapiL2CAP port SAPI (see BTLP_InitL2CAP_IO)
Note
Only on models with Bluetooth.

◆ L2CA_ReadDataReq()

void L2CA_ReadDataReq ( const void * message)

L2CAP handler of the L2CA_ReadDataReq signal.

Not reversed.

Parameters
messagesignal, meaning not known
Note
Only on models with Bluetooth.

◆ SApp_Register()

void SApp_Register ( int handler_id,
const SDEV_APP * methods )

Register an SDev application (serial data endpoint) in the application table.

Parameters
handler_idapplication number (0..31 on NSG/ELKA, 0..26 on SG/X75)
methodsmethod table of the application ARM code.

◆ ConnSDevSApp()

int ConnSDevSApp ( uint32_t sdevice,
uint32_t handler_id,
const void * connection_info )

Connect a serial device to an SDev application.

Parameters
sdevicedevice type (0..18 on NSG/ELKA, 0..16 on SG/X75)
handler_idapplication number (see SApp_Register)
connection_infoconnection information passed to both sides
Returns
1 OK, 0 when either side refuses ARM code.

◆ CHConnSApp()

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.

Parameters
handler_idcurrent application number (see SApp_Register)
instanceconnection instance of the current application
new_handler_idnew application number; the current one returns 1 without changes
connection_infoconnection information for the new application
Returns
1 OK, 0 error ARM code.

◆ Serial_CanOpenSApp()

int Serial_CanOpenSApp ( uint32_t handler_id,
uint32_t instance )

Check whether an SDev application would accept a connection (opens and closes it again).

Parameters
handler_idapplication number (see SApp_Register)
instancepassed to the application's open method
Returns
1 yes, 0 no ARM code.

◆ Ca_SasSApp_Init()

void Ca_SasSApp_Init ( void )

Initialise the SIM Access Profile server and register it as SDev application 0x13.

Note
Only on models with Bluetooth.

◆ RamJSApiConnections()

JSAPI_CONN * RamJSApiConnections ( void )

Get the JSApi (Java Bluetooth) connection slots.

Returns
slot array, JSApi_CurrentHandleID returns the number of slots for an unregistered handle

◆ RamBtlpConnections()

BTLP_CONN * RamBtlpConnections ( void )

Get the BTLP (Bluetooth L2CAP port) connection table.

Returns
one entry per L2CAP port (see BTLP_InitL2CAP_IO)
Note
Only on models with Bluetooth.

◆ RamL2capChannelState()

L2CAP_CHANNEL * RamL2capChannelState ( void )

Get the L2CAP channel table.

Returns
8 entries
Note
Only on models with Bluetooth.

◆ CA_MR_Class()

uint8_t CA_MR_Class ( void )

Object class of the replicator's own events.

◆ CA_Release()

void CA_Release ( uint16_t handle)

Release a CA object handle (replicator, connection).

◆ CA_SapiConnClass()

uint8_t CA_SapiConnClass ( void )

Object class of SAPI connection events (opened, closed, failed, parameters).

Note
Only on models with Bluetooth.

◆ CA_RemDev_New()

CA_REMDEV * CA_RemDev_New ( const uint8_t bd_addr[6])

Create a remote device object for a 6-byte BT address.

Note
Only on models with Bluetooth.

◆ CA_RemDev_Free()

void CA_RemDev_Free ( CA_REMDEV * remdev)

Free a remote device object.

◆ CA_DevList()

uint16_t CA_DevList ( uint16_t local_dev)

Device list object of the local BT device.

Note
Only on models with Bluetooth.

◆ CA_DevListClass()

uint8_t CA_DevListClass ( void )

Object class of device list answers.

Note
Only on models with Bluetooth.

◆ CA_LocalRoot()

uint16_t CA_LocalRoot ( void )

Root object of the local BT stack.

◆ CA_LocalDev()

uint16_t CA_LocalDev ( uint16_t root,
int zero )

Local BT device object.

◆ CA_LocalAddr()

const uint8_t * CA_LocalAddr ( uint16_t local_dev)

BT address of the local device object.

Note
Only on models with Bluetooth.