SWRA772 august   2023 CC2564C

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. Introduction
  5. Running the Bluetooth Code
  6. Demo Application
    1. 3.1 Device 1 (Server) Setup on the Demo Application
    2. 3.2 Device 2 (Client) Setup on the Demo Application
    3. 3.3 Initiating Connection from Device 2
    4. 3.4 Identify Supported Services
    5. 3.5 Data Transfer Between Client and Server
    6. 3.6 Multiple SPPLE Connections Guide
  7. Demonstrating SPP LE on an iOS Device with the LightBlue App
    1. 4.1 LightBlue Overview
    2. 4.2 SPP LE Service Overview
      1. 4.2.1 Characteristics
  8. LightBlue as the Client/SPPLEDemo as the Server
    1. 5.1 Connecting the Devices
    2. 5.2 Enabling Notifications
    3. 5.3 Sending Data from LightBlue/Receiving Data in SPPLEDemo
    4. 5.4 Sending Data from SPPLEDemo/Receiving Data in LightBlue
  9. LightBlue as the Server/SPPLEDemo as the Client
    1. 6.1 Connecting the Devices
    2. 6.2 Sending Data from LightBlue/Receiving Data in SPPLEDemo
    3. 6.3 Sending Data from SPPLEDemo/Receiving Data in LightBlue
  10. Application Commands
  11. General Commands
    1. 8.1 Help (DisplayHelp)
    2. 8.2 Get Local Address
    3. 8.3 Set Baud Rate
    4. 8.4 Quit
  12. BR/EDR Commands
  13. 10GAPLE Commands
    1. 10.1  Set Discoverability Mode
    2. 10.2  Set Connectability Mode
    3. 10.3  Set Pairability Mode
    4. 10.4  Change Pairing Parameters
    5. 10.5  Advertise LE
    6. 10.6  Start Scanning
    7. 10.7  Stop Scanning
    8. 10.8  Connect LE
    9. 10.9  Disconnect LE
    10. 10.10 Pair LE
    11. 10.11 LE Pass Key Response
    12. 10.12 LE Query Encryption
    13. 10.13 Set Passkey
    14. 10.14 Discover GAPS
    15. 10.15 Get Local Name
    16. 10.16 Set Local Name
    17. 10.17 Get Remote Name
    18. 10.18 LE User Confirmation Response
    19. 10.19 Enable SC Only
    20. 10.20 Regenerate P256 Local Keys
    21. 10.21 SC Generate OOB Local Params
    22. 10.22 Set Local Appearance
    23. 10.23 Get Local Appearance
  14. 11SPPLE Commands
    1. 11.1 Discover SPPLE
    2. 11.2 Register SPPLE
    3. 11.3 LE Send
    4. 11.4 Configure SPPLE
    5. 11.5 LE Read
    6. 11.6 Loopback
    7. 11.7 Display Raw Mode Data
    8. 11.8 Automatic Read Mode
  15. 12References
  16. 13Revision History

Configure SPPLE

Description

The following function is responsible to configure a SPPLE Service on a remote device. This function returns zero on successful execution and a negative value on errors. The following function enables notifications of the proper characteristics based on a specified handle; depending what the device role for SPPLE is, server or client, the API function that is called is either a GATT_Handle_Value_Notification or a GATT_Write_Without_Response_Request; which notifies the receiving credit characteristic or sends a write with out response packet to the transmission credit characteristic respectively.

Parameters

The only parameter required is the Bluetooth Address of the remote device that is connected.

Command Call Examples

  • “ConfigureSPPLE 001bdc05b617” Attempts to configure services of the Bluetooth Device with the BD_ADDR of 001bdc05b617.
  • “ConfigureSPPLE 000275e126FF” Attempts to configure services of the Bluetooth Device with the BD_ADDR of 000275e126FF.

Possible Return Values

  • (0) Successfully configured a SPPLE Service.
  • (-4) Function Error (on failure).

API Call

GATT_Write_Request(BluetoothStackID, ConnectionID, ClientConfigurationHandle, sizeof(Buffer), &Buffer, ClientEventCallback, 0)

And

GATT_Handle_Value_Notification(BluetoothStackID, SPPLEServiceID, ConnectionID, SPPLE_RX_CREDITS_CHARACTERISTIC_ATTRIBUTE_OFFSET, WORD_SIZE, (Byte_t*)&Credits)

Or

GATT_Write_Without_Response_Request(BluetoothStackID, ConnectionID, DeviceInfo->ClientInfo.Tx_Credit_Characteristic, WORD_SIZE, &Credits)

API Prototype

int BTPSAPI GATT_Write_Request(unsigned int BluetoothStackID, unsigned int ConnectionID, Word_t AttributeHandle, Word_t AttributeLength, void *AttributeValue,GATT_Client_Event_Callback_t ClientEventCallback, unsigned long CallbackParameter)

And

int BTPSAPI GATT_Handle_Value_Notification(unsigned int BluetoothStackID, unsigned int ServiceID, unsigned int ConnectionID, Word_t AttributeOffset, Word_tAttributeValueLength, Byte_t *AttributeValue)

Or

int BTPSAPI GATT_Write_Without_Response_Request(unsigned int BluetoothStackID, unsigned int ConnectionID, Word_t AttributeHandle, Word_t AttributeLength, void*AttributeValue)

Description of API

The first of these API functions is provided to allow a means of performing a write request to a remote device for a specified attribute. The first parameter to this function is the Bluetoothstack ID of the local Bluetooth stack, followed by the connection ID of the connected remote device, followed by the handle of the attribute to write the value of, followed by the length of the value (in bytes), followed by the the actual value data to write. The final two parameters specify the GATT client event callback function and callback parameter (respectively) that can be called when a response is received from the remote device. This function returns the positive, non-zero, Transaction ID of the request or a negative error code.

The second of these API functions allows a means of sending a Handle/Value notification to a remote GATT client. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack. The second parameter is the service ID of the service that is sending the Handle/Value notification. The third parameter specifies the connection ID of the connection to send the Handle/Value notification to. The fourth parameter specifies the offset in the service table (registered via the call to the GATT_Register_Service() function) of the attribute that is being notified. The fifth parameter is the length (in bytes) of the attribute value that is being notified. The sixth parameter is a pointer to the actual attribute value to notify. This function returns a non-negative value that represents the actual length of the attribute value that was notified, or a negative return error code if there is an error.

The third of these API functions is provided to allow a means of performing a write without response request to remote device for a specified attribute. The first parameter to this function is the Bluetooth stack ID of the local Bluetooth stack, followed by the connection ID of the connected remote device, followed by the handle of the attribute to write, followed by the length of the value data to write (in bytes), followed by the actual value to write. This function returns the number of bytes written successfully or a negative error code.