[ English | 简体中文 ]
Bluetooth SPP API
The openvela Bluetooth SPP (Serial Port Profile) interface provides virtual serial port communication as a replacement for physical serial ports.
Header file: #include "bt_spp.h"
openvela Implementation Notes
- Features: Virtual serial port communication, suitable for Bluetooth-enabling traditional serial devices
Synchronous Interfaces
bt_spp_unregister_app
bt_status_t bt_spp_unregister_app(bt_instance_t* ins, void* handle);
Unregister an SPP application.
Parameters:
handleApplication handle.insBluetooth client instance.
Returns:
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
bt_spp_server_start
bt_status_t bt_spp_server_start(bt_instance_t* ins, void* handle, uint16_t scn, bt_uuid_t* uuid, uint8_t max_connection);
Start an SPP server to listen for connection requests from remote devices.
Parameters:
insBluetooth client instance.handleApplication handle.scnServer channel number.uuidService UUID.max_connectionMaximum number of connections.
Returns:
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
bt_spp_server_stop
bt_status_t bt_spp_server_stop(bt_instance_t* ins, void* handle, uint16_t scn);
Stop the SPP server and stop accepting new connections.
Parameters:
insBluetooth client instance.handleApplication handle.scnServer channel number.
Returns:
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
bt_spp_connect
bt_status_t bt_spp_connect(bt_instance_t* ins, void* handle, bt_address_t* addr, int16_t scn, bt_uuid_t* uuid, uint16_t* port);
Initiate a connection to the remote device.
Parameters:
insBluetooth client instance.handleApplication handle.addrBluetooth address of the remote device.scnServer channel number.uuidService UUID.portPort number.
Returns:
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
bt_spp_insecure_connect
bt_status_t bt_spp_insecure_connect(bt_instance_t* ins, void* handle, bt_address_t* addr, int16_t scn, bt_uuid_t* uuid, uint16_t* port);
Initiate an insecure connection to the remote device.
Parameters:
insBluetooth client instance.handleApplication handle.addrBluetooth address of the remote device.scnServer channel number.uuidService UUID.portPort number.
Returns:
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
bt_spp_disconnect
bt_status_t bt_spp_disconnect(bt_instance_t* ins, void* handle, bt_address_t* addr, uint16_t port);
Disconnect the SPP connection.
Parameters:
insBluetooth client instance.handleApplication handle.addrBluetooth address of the peer device.portPort number.
Returns:
Returns BT_STATUS_SUCCESS on success, or an error code on failure.