SPP Interface Functions

[English]

SPP_IF API Brief

Application

Brief

spp_if_is_connected()

return the connect status of the addr mobile link

spp_if_send_data()

send SPP data on dedicated SPP link

spp_if_client_create_slc()

SPP client create service level connection

spp_if_server_start()

start new SPP server connection

spp_if_init()

SPP init function

spp_if_send_credit()

send credit on dedicated SPP connection

spp_if_get_sync_len()

get SPP sync profile total length required

spp_if_conn_sync()

TWS master used to send sync profile data to slave

spp_if_conn_restore()

TWS slave used to rebuild its host stack

spp_if_conn_restore_specific()

TWS slave update SPP connection handle and recover relevant settings

spp_if_register_event_callback()

register callback function to get system BT SPP event

SPP_IF API Reference

Header File

Functions

bool spp_if_is_connected(btif_bd_addr_t *p_addr)

spp_if_is_connected brief description

return the connect status of the addr mobile link

参数:

p_addr[in] remote BT MAC address

返回值:
  • true – connected

  • fail – disconnected

返回:

result

btif_ret_t spp_if_send_data(uint16_t handle, uint8_t dlci, uint8_t *p_data, uint16_t len)

spp_if_send_data brief description

send SPP data on dedicated SPP link

参数:
  • handle[in] connection handle

  • dlci[in] DLCI value

  • p_data[in] data buffer need to be sent

  • len[in] data buffer length

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t spp_if_client_create_slc(spp_client_t *p_spp_input)

spp_if_client_create_slc brief description

SPP client create service level connection

参数:

p_spp_input[in] SPP client setting sturct

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t spp_if_server_start(spp_server_t *p_spp_server)

spp_if_server_start brief description

start new SPP server connection

参数:

p_spp_server[in] SPP server setting sturct

返回值:
  • 0 – success

  • other – fail

返回:

result

void spp_if_init(void)

spp_if_init brief description

SPP init function

返回:

N/A

void spp_if_send_credit(uint8_t handle, uint8_t dlci, uint8_t credit)

spp_if_send_credit brief description

send credit on dedicated SPP connection

参数:
  • handle[in] connection handle

  • dlci[in] DLCI value

  • credit[in] credit value

返回:

N/A

uint16_t spp_if_get_sync_len(btif_bd_addr_t addr)

spp_if_get_sync_len brief description

get SPP sync profile total length required

参数:

addr[in] remote BT MAC address

返回:

data length

btif_ret_t spp_if_conn_sync(btif_bd_addr_t *p_addr, uint8_t *p_buff, uint16_t buff_len, uint16_t *p_length)

spp_if_conn_sync brief description

TWS master used to send sync profile data to slave

参数:
  • p_addr[in] remote BT MAC addresss

  • p_buff[out] buffer used to sync profile data

  • buff_len[in] p_buff allocated length

  • p_length[out] sync profile data length will be sent

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t spp_if_conn_restore(btif_bd_addr_t *p_addr, uint8_t *p_buff, uint16_t length)

spp_if_conn_restore brief description

TWS slave used to rebuild its host stack

参数:
  • p_addr[in] remote BT MAC address

  • p_buff[in] sync profile data

  • length[in] p_buff data length

返回值:
  • 0 – success

  • other – fail

返回:

result

btif_ret_t spp_if_conn_restore_specific(btif_bd_addr_t *p_addr, uint16_t acl_handle)

spp_if_conn_restore_specific brief description

TWS slave update SPP connection handle and recover relevant settings

参数:
  • p_addr[in] remote BT MAC address

  • acl_handle[in] connection handle

返回值:
  • 0 – success

  • other – fail

返回:

result

void spp_if_register_event_callback(sppif_callback_t *p_event_handle)

spp_if_register_event_callback brief description

register callback function to get system BT SPP event

参数:

p_event_handle[in] callback struct from uplayer

返回:

N/A

Structures

struct sppif_callback_t

callback struct definition

Public Members

dl_list_t dlst_node

node for application handler will be linked to orthers

sppif_callback_handle callback

function pointer for callback function

struct spp_client_t

SPP client struct definition.

Public Members

btif_bd_addr_t addr

remote BT address

btif_uuid_t uuid

remote servcie UUID

uint8_t init_credits

initial credits

sppif_callback_t data_handle

callback struct for SPP data

sppif_callback_t event_handle

callback struct for SPP event

struct spp_server_t

SPP server struct definition.

Public Members

btif_uuid_t uuid

UUID of server

uint8_t init_credits

initial credits

uint8_t port

RFCOMM port

uint8_t dlci

DLCI value

char *p_name

service name

sppif_callback_t data_handle

callback struct for SPP data

sppif_callback_t event_handle

callback struct for SPP event

struct sppif_event_cb_t

SPP if event callback struct definition.

Public Members

uint8_t event

index of SPP event

uint8_t dlci

DLCI value

uint16_t handle

connection handle

btif_bd_addr_t addr

remote BT MAC address

btif_uuid_t uuid

UUID of service

struct sppif_data_cb_para_t

SPP if data callback struct definition.

Public Members

uint8_t dlci

DLCI value

uint16_t handle

connection handle

uint16_t len

length for the p_data

uint8_t *p_data

data buffer

Macros

SPPIF_EVENT_PACKET
SPPIF_DATA_PACKET
SPPIF_SERVICE_LEVEL_CONNECTED
SPPIF_SERVICE_LEVEL_DISCONNECTED
SPPIF_DATA_TX_DONE

Type Definitions

typedef void (*sppif_callback_handle)(uint8_t *p_data, uint16_t size)