Bluetooth SPP Profile

group BT_SPP

Provide BT SPP profile interfaces.

Typedefs

typedef enum t_bt_spp_uuid_type T_BT_SPP_UUID_TYPE

BT SPP UUID type.

typedef union t_bt_spp_uuid_data T_BT_SPP_UUID_DATA

BT SPP UUID data.

Enums

enum t_bt_spp_uuid_type

BT SPP UUID type.

Values:

enumerator BT_SPP_UUID16

UUID type 16 bits.

enumerator BT_SPP_UUID32

UUID type 32 bits.

enumerator BT_SPP_UUID128

UUID type 128 bits.

Functions

bool bt_spp_init(void)

Initialize SPP profile.

Return values:
  • true -- SPP profile was initialized successfully.

  • false -- SPP profile was failed to initialize.

Returns:

The status of initializing SPP profile.

void bt_spp_deinit(void)

De-initialize SPP profile.

Experimental Added Since 2.14.0.0:
bool bt_spp_service_register(uint8_t service_uuid[16], uint8_t server_chann)

Register SPP service.

Note

This function shall be used after bt_spp_int() called.

Parameters:
  • service_uuid -- [in] SPP service UUID.

  • server_chann -- [in] Local server channel.

Return values:
  • true -- SPP service was registered successfully.

  • false -- SPP service was failed to register.

Returns:

The status of registering SPP service.

bool bt_spp_service_unregister(uint8_t server_chann)

Unregister SPP service.

Experimental Added Since 2.14.0.0:
Parameters:

server_chann -- [in] Local server channel.

Return values:
  • true -- SPP service was unregistered successfully.

  • false -- SPP service was failed to unregister.

Returns:

The status of unregistering SPP service.

bool bt_spp_registered_uuid_check(T_BT_SPP_UUID_TYPE type, T_BT_SPP_UUID_DATA *data, uint8_t *local_server_chann)

Check the UUID is registered and bond local server channel with the checked UUID.

Parameters:
Return values:
  • true -- The UUID was registered and the local server channel was bonded.

  • false -- The UUID was not registered and the local server channel was not bonded.

Returns:

The status of checking UUID.

bool bt_spp_ertm_mode_set(bool enable)

Set SPP ERTM mode.

Parameters:

enable -- [in] Enable or disable ERTM mode.

  • true Enable ERTM mode.

  • false Disable ERTM mode.

Return values:
  • true -- ERTM mode was set successfully.

  • false -- ERTM mode was failed to set.

Returns:

The status of setting ERTM mode.

bool bt_spp_connect_req(uint8_t bd_addr[6], uint8_t remote_server_chann, uint16_t frame_size, uint8_t credits, uint8_t local_server_chann)

Send an SPP connection request.

Parameters:
  • bd_addr -- [in] Remote BT address.

  • remote_server_chann -- [in] Remote server channel.

  • frame_size -- [in] The maximum frame_size supported by local device.

  • credits -- [in] The number of packet that remote can be send. This parameter is used for flow control. A sending entity may send as many frames on a spp connection as it has credits; if the credit count reaches zero, the sender will stop and wait for further credits from peer.

  • local_server_chann -- [in] Local server channel.

Return values:
  • true -- SPP connection request was sent successfully.

  • false -- SPP connection request was failed to send.

Returns:

The status of sending the SPP connection request.

bool bt_spp_connect_cfm(uint8_t bd_addr[6], uint8_t local_server_chann, bool accept, uint16_t frame_size, uint8_t credits)

Send an SPP connection confirmation.

Parameters:
  • bd_addr -- [in] Remote BT address.

  • local_server_chann -- [in] Local server channel.

  • accept -- [in] Confirmation message.

    • true Accept the received SPP connection request.

    • false Reject the received SPP connection request.

  • frame_size -- [in] The maximum frame_size supported by local device.

  • credits -- [in] The number of packet that remote can be send. This parameter is used for flow control. A sending entity may send as many frames on a SPP connection as it has credits; if the credit count reaches zero, the sender will stop and wait for further credits from peer.

Return values:
  • true -- SPP connection confirmation was sent successfully.

  • false -- SPP connection confirmation was failed to send.

Returns:

The status of sending the SPP connection confirmation.

bool bt_spp_disconnect_req(uint8_t bd_addr[6], uint8_t local_server_chann)

Send an SPP disconnection request.

Parameters:
  • bd_addr -- [in] Remote BT address.

  • local_server_chann -- [in] Local server channel.

Return values:
  • true -- SPP disconnection request was sent successfully.

  • false -- SPP disconnection request was failed to send.

Returns:

The status of sending the SPP disconnection request.

bool bt_spp_disconnect_all_req(uint8_t bd_addr[6])

Send a request to disconnect all SPP connection.

Parameters:

bd_addr -- [in] Remote BT address.

Return values:
  • true -- All SPP disconnection request was sent successfully.

  • false -- All SPP disconnection request was failed to send.

Returns:

The status of sending all SPP disconnection request.

bool bt_spp_data_send(uint8_t bd_addr[6], uint8_t local_server_chann, uint8_t *data, uint16_t len, bool ack)

Send SPP data to remote device.

Parameters:
  • bd_addr -- [in] Remote BT address.

  • local_server_chann -- [in] Local server channel.

  • data -- [in] The start address of the data buffer.

  • len -- [in] The length of the data.

  • ack -- [in] Enable/disable ACK after data sent.

    • true Enable ACK after data sent.

    • false Disable ACK after data sent.

Return values:
  • true -- Data was sent successfully.

  • false -- Data was failed to send.

Returns:

The status of sending data.

bool bt_spp_credits_give(uint8_t bd_addr[6], uint8_t local_server_chann, uint8_t credits)

Give SPP credits to remote device.

Parameters:
  • bd_addr -- [in] Remote BT address.

  • local_server_chann -- [in] Local server channel.

  • credits -- [in] Credits value.

Return values:
  • true -- Credits was sent successfully.

  • false -- Credits was failed to send.

Returns:

The status of sending credits.

union t_bt_spp_uuid_data

BT SPP UUID data.

Public Members

uint16_t uuid_16

UUID data in 16 bits.

uint32_t uuid_32

UUID data in 32 bits.

uint8_t uuid_128[16]

UUID data in 128 bits.