Infineon Logo AIROC BTSDK v4.4 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
RFCOMM

RFCOMM Functions. More...

Macros

#define wiced_bt_rfcomm_init   wiced_bt_rfcomm_set_buffer_pool
 Function wiced_bt_rfcomm_set_buffer_pool. More...
 

Functions

wiced_bt_dev_status_t wiced_bt_rfcomm_set_buffer_pool (uint16_t buffer_size, uint16_t buffer_count)
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_create_connection (uint16_t uuid, uint8_t scn, wiced_bool_t is_server, uint16_t mtu, wiced_bt_device_address_t bd_addr, uint16_t *p_handle, wiced_bt_port_mgmt_cback_t *p_mgmt_cb)
 Establish serial port connection to the peer device, or allow RFCOMM to accept a connection from peer devices. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_remove_connection (uint16_t handle, wiced_bool_t remove_server)
 Close the specified connection. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_set_event_callback (uint16_t port_handle, wiced_bt_port_event_cback_t *p_port_cb)
 Set event callback the specified connection. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_set_data_callback (uint16_t port_handle, wiced_bt_rfcomm_data_cback_t *p_cb)
 Set event data callback the specified connection. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_set_event_mask (uint16_t port_handle, wiced_bt_rfcomm_port_event_t mask)
 Set events for which to be notified. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_control (uint16_t handle, uint8_t signal)
 Send control signal to the peer device. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_flow_control (uint16_t handle, wiced_bool_t enable)
 This function directs a specified connection to pass flow control message to the peer device. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_write_data (uint16_t handle, char *p_data, uint16_t max_len, uint16_t *p_len)
 This function sends the given application data to the peer device. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_check_connection (UINT16 handle, BD_ADDR bd_addr, UINT16 *p_lcid)
 This function checks connection referenced by handle is up and running. More...
 
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_port_get_queue_status (uint16_t handle, wiced_port_status_t *p_status)
 This function reports current status of a connection. More...
 

Detailed Description

RFCOMM Functions.

Macro Definition Documentation

#define wiced_bt_rfcomm_init   wiced_bt_rfcomm_set_buffer_pool

Function wiced_bt_rfcomm_set_buffer_pool.

If buffer_size > 0 and wiced_bt_rfcomm does not have a private pool yet, this function allocates a private buffer pool. If buffer_size = 0 and wiced_bt_rfcomm has a private buffer pool, this function deallocates the private buffer pool.

Parameters
[in]buffer_size: data size for the private pool. The actual buffer size includes additional overhead.
[in]buffer_count: number of buffers in this new pool.
Returns
WICED_BT_SUCCESS if the action was carried out successfully as desired WICED_BT_NO_RESOURCES no resources.

Note : This API will create separate private pool so please increase max_number_of_buffer_pools by one (in wiced_bt_cfg_settings_t structure)

Function Documentation

wiced_bt_rfcomm_result_t wiced_bt_rfcomm_check_connection ( UINT16  handle,
BD_ADDR  bd_addr,
UINT16 p_lcid 
)

This function checks connection referenced by handle is up and running.

Parameters
[in]handle: The connection handle returned by wiced_bt_rfcomm_create_connection
[out]bd_addr: Peer BD Address
[out]p_lcid: L2CAP's LCID
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_LINE_ERR : If connection is not up and running
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_control ( uint16_t  handle,
uint8_t  signal 
)

Send control signal to the peer device.

Parameters
[in]handle: The connection handle returned by wiced_bt_rfcomm_create_connection
[in]signal: Signal to send (see wiced_bt_rfcomm_signal_e)
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_create_connection ( uint16_t  uuid,
uint8_t  scn,
wiced_bool_t  is_server,
uint16_t  mtu,
wiced_bt_device_address_t  bd_addr,
uint16_t *  p_handle,
wiced_bt_port_mgmt_cback_t p_mgmt_cb 
)

Establish serial port connection to the peer device, or allow RFCOMM to accept a connection from peer devices.

Note
Server can call this function with the same scn parameter multiple times if it is ready to accept multiple simulteneous connections.

DLCI for the connection is (scn * 2 + 1) if client originates connection on existing none initiator multiplexer channel. Otherwise it is (scn * 2). For the server DLCI can be changed later if client will be calling it using (scn * 2 + 1) dlci.

Parameters
[in]uuid: The Universal Unique Identifier (UUID) of the Class ID of the service being opened
[in]scn: The Service Channel Number(SCN) as registered with the SDP (server) or obtained using SDP from the peer device (client)
[in]is_server: TRUE if requesting application is a server
[in]mtu: The maximum number of bytes transferred per frame If 0, a default size of L2CAP_MTU_SIZE minus 5 bytes is used
[in]bd_addr: BD_ADDR of the peer (if client), NULL if server
[in]p_mgmt_cb: Pointer to callback function to receive connection up/down events
[out]p_handle: A pointer to the handle set by RFCOMM to be used in consecutive calls for this connection
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_ALREADY_OPENED : If the client tries to establish a connection to the same BD_ADDR WICED_BT_RFCOMM_NO_RESOURCES : If there is not enough memory to allocate a control block structure
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_flow_control ( uint16_t  handle,
wiced_bool_t  enable 
)

This function directs a specified connection to pass flow control message to the peer device.

Enable flag passed shows if port can accept more data.

Parameters
[in]handle: The connection handle returned by wiced_bt_rfcomm_create_connection
[in]enable: Flow control setting TRUE Enable data flow FALSE Disable data flow
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_port_get_queue_status ( uint16_t  handle,
wiced_port_status_t p_status 
)

This function reports current status of a connection.

Parameters
[in]handle: The connection handle returned by wiced_bt_rfcomm_create_connection
[out]p_status: pointer to the wiced_port_status_t structur to receive connection status
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_remove_connection ( uint16_t  handle,
wiced_bool_t  remove_server 
)

Close the specified connection.

Parameters
[in]handle: The connection handle returned by wiced_bt_rfcomm_create_connection .
[in]remove_server: (for server only) If TRUE, then also remove server; otherwise server remains enabled after connection is closed.
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_set_data_callback ( uint16_t  port_handle,
wiced_bt_rfcomm_data_cback_t p_cb 
)

Set event data callback the specified connection.

Parameters
[in]port_handle: A 16-bit unsigned integer returned by wiced_bt_rfcomm_create_connection
[in]p_cb: Address of the callback function which should be called from the RFCOMM when a data packet is received
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_set_event_callback ( uint16_t  port_handle,
wiced_bt_port_event_cback_t p_port_cb 
)

Set event callback the specified connection.

Parameters
[in]port_handle: A 16-bit unsigned integer returned by wiced_bt_rfcomm_create_connection
[in]p_port_cb: Address of the callback function which should be called from the RFCOMM when an event specified in the mask occurs
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_set_event_mask ( uint16_t  port_handle,
wiced_bt_rfcomm_port_event_t  mask 
)

Set events for which to be notified.

Parameters
[in]port_handle: A 16-bit unsigned integer returned by wiced_bt_rfcomm_create_connection
[in]mask: Event mask
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened
wiced_bt_rfcomm_result_t wiced_bt_rfcomm_write_data ( uint16_t  handle,
char *  p_data,
uint16_t  max_len,
uint16_t *  p_len 
)

This function sends the given application data to the peer device.

If wiced_bt_rfcomm_set_buffer_pool() was called to create a private buffer pool, the buffer from the private buffer pool is used to hold the data in the RFCOMM TX queue. Otherwise, RFCOMM uses the RFCOMM_DATA_POOL_ID pool to hold the data.

Parameters
[in]handle: The connection handle returned by wiced_bt_rfcomm_create_connection
[in]p_data: Data to write
[in]max_len: Byte count to write
[out]p_len: Bytes written
Returns
WICED_BT_RFCOMM_SUCCESS : If successful WICED_BT_RFCOMM_BAD_HANDLE : If the handle is out of range WICED_BT_RFCOMM_NOT_OPENED : If the connection is not opened