2.0.0.4R9
Software Development Kit
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
SPP Protocol Library API

Data Structures

struct  wiced_bt_spp_reg_t
 

Typedefs

typedef void(* wiced_bt_spp_connection_down_callback_t )(uint16_t handle)
 
typedef void(* wiced_bt_spp_connection_failed_callback_t )(void)
 
typedef void(* wiced_bt_spp_connection_up_callback_t )(uint16_t handle, uint8_t *bd_addr)
 
typedef wiced_bool_t(* wiced_bt_spp_rx_data_callback_t )(uint16_t handle, uint8_t *data, uint32_t data_len)
 
typedef void(* wiced_bt_spp_service_not_found_callback_t )(void)
 
typedef void(* wiced_bt_spp_tx_complete_callback_t )(uint16_t handle, wiced_result_t result)
 

Functions

wiced_bool_t wiced_bt_spp_can_send_more_data (void)
 
void wiced_bt_spp_connect (BD_ADDR bd_addr)
 
void wiced_bt_spp_disconnect (uint16_t handle)
 
void wiced_bt_spp_rx_flow_enabled (uint16_t handle, wiced_bool_t enable)
 
wiced_bool_t wiced_bt_spp_send_session_data (uint16_t handle, uint8_t *p_data, uint32_t len)
 
void wiced_bt_spp_startup (wiced_bt_spp_reg_t *p_reg)
 

Detailed Description

SPP library of the WICED SDK provide a simple method for an application to integrate SPP functionality. Application just needs to call API to connect/disconnect and send data. Library in turn indicates status of the connection and passes to the application received data.

Typedef Documentation

typedef void(* wiced_bt_spp_connection_down_callback_t)(uint16_t handle)

Connection Down callback indicates that an active session has been terminated.

Parameters
[in]handle: Handle that identifies the external accessory session
Returns
none
typedef void(* wiced_bt_spp_connection_failed_callback_t)(void)

Connection failed callback indicates to the application that the library failed to establish RFCOMM connection with the peer device after connection was requested by the wiced_bt_spp_connect call.

Returns
none
typedef void(* wiced_bt_spp_connection_up_callback_t)(uint16_t handle, uint8_t *bd_addr)

The application must implement connection up callback to be called by the library. The callback indicates to the application that SPP over RFCOMM session with a specified device has been successfully established. This can be a result of the wiced_bt_spp_connect requested by the application, or due to a peer device establishing connection from its side.

Parameters
[in]handle: Handle that identifies newly established session.
[in]bd_addr: Bluetooth Device address of the connected device.
Returns
none
typedef wiced_bool_t(* wiced_bt_spp_rx_data_callback_t)(uint16_t handle, uint8_t *data, uint32_t data_len)

Rx Data callback passed to the application data received over the SPP session.

Parameters
[in]handle: Handle that identifies the external accessory session
[in]p_data: Pointer to buffer with data.
[in]data_len: Length of the data
Returns
none
typedef void(* wiced_bt_spp_service_not_found_callback_t)(void)

Service not found callback indicates wiced_bt_spp_connect call requested to establish connection to a device which is currently not present, or which is not running SPP service.

Returns
none
typedef void(* wiced_bt_spp_tx_complete_callback_t)(uint16_t handle, wiced_result_t result)

Transmission Complete callback indicates that application can send more data.

Parameters
[in]handle: Handle that identifies the external accessory session
[in]result: Result of tx operaion. 0 if success.
Returns
none

Function Documentation

wiced_bool_t wiced_bt_spp_can_send_more_data ( void  )

Function wiced_bt_spp_can_send_more_data

Returns TRUE if library can queue forward data, or FALSE if forward data queue is full.

void wiced_bt_spp_connect ( BD_ADDR  bd_addr)

Function wiced_bt_spp_connect

Establish External Accessory connection to an iOS device. Library will perform Service Discovery. If SPP service is running on the specified device RFCOMM connection is established. When session is established, library executes spp_connection_up_callback.

Parameters
[out]bd_addr: Bluetooth Device address to connect to.
Returns
none
void wiced_bt_spp_disconnect ( uint16_t  handle)

Function wiced_bt_spp_disconnect

Disconnect External Accessory Session with the iOS device. Bluetooth connection is brought down as well.

Parameters
[out]handle: The handle returned by the application in the wiced_bt_spp_connection_up_callback.
Returns
none
void wiced_bt_spp_rx_flow_enabled ( uint16_t  handle,
wiced_bool_t  enable 
)

SPP application may use this call to disable or reenable the RX data flow

Parameters
[out]handle: Connection handle indicated in the connection up callback
[out]enable: If true, data flow is enabled
Returns
none
wiced_bool_t wiced_bt_spp_send_session_data ( uint16_t  handle,
uint8_t *  p_data,
uint32_t  len 
)

Send data over the established External Accessory connection. The session must be SPP_EA_SESSION_ID. The first 2 octets of the p_data must be the handle passed to the application in the wiced_bt_spp_connection_up_callback in the big endian format.

Parameters
[out]handle: Connection handle indicated in the connection up callback
[out]p_data: Pointer to buffer with data to send.
[out]len: Length of the data + handle
Returns
WICED_TRUE: if data is scheduled for transmission, otherwise WICED_FALSE
void wiced_bt_spp_startup ( wiced_bt_spp_reg_t p_reg)

Function wiced_bt_spp_startup

Initialize SPP library and starts the RFCOMM service.

Parameters
[out]p_reg: Registration control block that includes RFCOMM SCN and callbacks
Returns
none