![]() |
MT2523 API Reference
LinkIt SDK v4
|
The Serial Port Profile (SPP) can be used to emulate a serial port connection using Radio Frequency Communication(RFCOMM) protocol between two peer devices. More...
The Serial Port Profile (SPP) can be used to emulate a serial port connection using Radio Frequency Communication(RFCOMM) protocol between two peer devices.
It supports server and client roles. The SPP server is implemented for a server side connection (Acceptor). It can wait for another device to take initiative to connect. The SPP client is implemented for a client side connection (Initiator) to initiate a connection with another device.
| Terms | Details |
|---|---|
| UUID | A Universally Unique Identifier. For more information, please refer to Wikipedia. |
| SPP | Serial Port Profile. For more information, please refer to Wikipedia. |
| RFCOMM | The Radio Frequency Communication. For more information, please refer to Wikipedia. |
| SDP | Service Discovery Protocol. For more information, please refer to Wikipedia. |
Functions | |
| bt_status_t | bt_spp_connect (uint32_t *handle, const bt_bd_addr_t *address, const uint8_t *uuid128) |
| This function is for the SPP client to connect to a remote server, the BT_SPP_CONNECT_CNF event is reported to indicate the result of the connection. More... | |
| bt_status_t | bt_spp_connect_response (uint32_t handle, bool accept) |
| This function is for the SPP server to accept or reject connection from a remote client, the BT_SPP_CONNECT_CNF event is reported to indicate the result of the response. More... | |
| bt_status_t | bt_spp_send (uint32_t handle, uint8_t *packet, uint16_t packet_length) |
| This function sends data to a remote device. More... | |
| bt_status_t | bt_spp_disconnect (uint32_t handle) |
| This function disconnects an existing connection, the BT_SPP_DISCONNECT_IND event is reported to indicate the result of the disconnection. More... | |
| void | bt_spp_hold_data (uint8_t *data) |
| This function holds the SPP packet until it is fully consumed. More... | |
| void | bt_spp_release_data (uint8_t *data) |
| This function releases the SPP packet after it is consumed. More... | |
Modules | |
| Define | |
| This section defines the macros for the SPP. | |
| Struct | |
| This section defines the structures for the SPP. | |
| bt_status_t bt_spp_connect | ( | uint32_t * | handle, |
| const bt_bd_addr_t * | address, | ||
| const uint8_t * | uuid128 | ||
| ) |
This function is for the SPP client to connect to a remote server, the BT_SPP_CONNECT_CNF event is reported to indicate the result of the connection.
Note that this API can only be used by an SPP client.
| [out] | handle | is the SPP handle of the current connection. |
| [in] | address | is the Bluetooth address of a remote device. |
| [in] | uuid128 | is a 128-bit UUID of remote server, such as {0x00,0x00,0x11,0x01,0x00,0x00, 0x10,0x00,0x80,0x00,0x00,0x80,0x5F,0x9B,0x34,0xFB}. |
| bt_status_t bt_spp_connect_response | ( | uint32_t | handle, |
| bool | accept | ||
| ) |
This function is for the SPP server to accept or reject connection from a remote client, the BT_SPP_CONNECT_CNF event is reported to indicate the result of the response.
Note that this API can only be used by the SPP server.
| [in] | handle | is the SPP handle of the current connection. |
| [in] | accept | defines whether the connection is accepted. |
| bt_status_t bt_spp_disconnect | ( | uint32_t | handle | ) |
This function disconnects an existing connection, the BT_SPP_DISCONNECT_IND event is reported to indicate the result of the disconnection.
| [in] | handle | is the SPP handle of the current connection. |
| void bt_spp_hold_data | ( | uint8_t * | data | ) |
This function holds the SPP packet until it is fully consumed.
| [in] | data | is the initialization parameter. The value is provided once it is called by the SPP. |
| void bt_spp_release_data | ( | uint8_t * | data | ) |
This function releases the SPP packet after it is consumed.
| [in] | data | is the initialization parameter. The value is provided once it is called by the SPP. |
| bt_status_t bt_spp_send | ( | uint32_t | handle, |
| uint8_t * | packet, | ||
| uint16_t | packet_length | ||
| ) |
This function sends data to a remote device.
| [in] | handle | is the SPP handle of the current connection. |
| [in] | packet | is a pointer to the packet to send to a remote device. |
| [in] | packet_length | is the length of a packet to send. |