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

Connecting the Devices

The first step to connecting the devices is to add the SPP LE Service and characteristics to LightBlue. To do this manually, create a blank virtual peripheral in LightBlue and then add the necessary service and characteristics. Another option is to clone SPPLEDemo while SPPLEDemo acts as the server. To clone SPPLEDemo first connect the 2 devices as described above. After the 2 devices are connected, choose the Clone option in the top right corner of the display. The app returns to the devices list and observe the SPPLEDemo listed as a Virtual Peripheral as seen below:


GUID-20230227-SS0I-HNPV-VDVT-JNNQXPB0H5WB-low.png

Note: Make sure that the check box to the left of SPPLEDemo is checked, as seen in the image. If not checked, the iDevice is not advertising and SPPLEDemo cannot be able to connect.

After cloning, the SPP LE service can now connect with the devices. Next, restart SPPLEDemo and when prompted start the app as a client. Next scan for the iOS device using the StartScanning command. When the iOS device has been found stop the scan using the StopScanning command. Now connect to the iOS device using the ConnectLE 5c75524c733a 1 command. After this, run the DiscoverSPPLE 5c75524c733a command within the 10 second timeframe. After the SPP LE service discovery completes, run the ConfigureSPPLE 5c75524c733a within the 25 second timeframe. The iOS device disconnects from SPPLEDemo if the commands are not run within these timeframes. After the SPP LE characteristics are configured the 2 apps stay connected, however, note that if the iOS device goes to sleep this closes the connection. After running the commands just described, observe output similar to the following in SPPLEDemo's terminal:

OpenStack().
Bluetooth Stack ID: 1.
Device Chipset: 4.1.
BD_ADDR: 0xd03972cdab68

 Command Options: Server, Client, Help 

SPP+LE>Client

 Command Options General: Help, GetLocalAddress, SetBaudRate 
 Quit, 
 Command Options BR/EDR: Inquiry, DisplayInquiryList, Pair, 
 EndPairing, PINCodeResponse, 
 PassKeyResponse, 
 UserConfirmationResponse, 
 SetDiscoverabilityMode, 
 SetConnectabilityMode, 
 SetPairabilityMode, 
 ChangeSimplePairingParameters, 
 GetLocalName, SetLocalName, 
 GetClassOfDevice, SetClassOfDevice, 
 GetRemoteName, SniffMode, 
 ExitSniffMode, Open, Close, Read, 
 Write, GetConfigParams, 
 SetConfigParams, GetQueueParams, 
 DisplayRawModeData, AutomaticReadMode,
 SetQueueParams, Loopback, 
 CBSend. 
 Command Options GAPLE: SetDiscoverabilityMode, 
 SetConnectabilityMode, 
 SetPairabilityMode, 
 ChangePairingParameters, 
 AdvertiseLE, StartScanning, 
 StopScanning, ConnectLE, 
 DisconnectLE, PairLE, 
 LEPasskeyResponse, 
 QueryEncryptionMode, SetPasskey, 
 DiscoverGAPS, GetLocalName, 
 SetLocalName, GetLERemoteName, 
 SetLocalAppearance, 
 GetLocalAppearance, 
 GetRemoteAppearance, 
 Command Options SPPLE: DiscoverSPPLE, RegisterSPPLE, LESend, 
 ConfigureSPPLE, LERead, Loopback, 
 DisplayRawModeData, AutomaticReadMode 

SPP+LE>StartScanning
Scan started successfully.
SPP+LE>
etLE_Advertising_Report with size 36.
1 Responses.
Advertising Type: rtConnectableUndirected.
Address Type: atRandom.
Address: 0x5c75524c733a.
RSSI: -71.
Data Length: 21.
AD Type: 0x01.
AD Length: 0x01.
AD Data: 0x1a
AD Type: 0x07.
AD Length: 0x10.
AD Data: 0x39 0x23 0xcf 0x40 0x73 0x16 0x42 0x9a 0x5c 0x41 0x7e 0x7d 0xc4 0x9a 0x83 0x14
SPP+LE>
etLE_Advertising_Report with size 36.
1 Responses.
Advertising Type: rtScanResponse.
Address Type: atRandom.
Address: 0x5c75524c733a.
RSSI: -71.
Data Length: 11.
AD Type: 0x09.
AD Length: 0x09.
AD Data: 0x53 0x50 0x50 0x4c 0x45 0x44 0x65 0x6d 0x6f
SPP+LE>StopScanning
Scan stopped successfully.
SPP+LE>ConnectLE 5c75524c733a 1
Connection Request successful.
SPP+LE>
etLE_Connection_Complete with size 16.
Status: 0x00.
Role: Master.
Address Type: Random.
BD_ADDR: 0x5c75524c733a.
SPP+LE>
etGATT_Connection_Device_Connection with size 16:
Connection ID: 1.
Connection Type: LE.
Remote Device: 0x5c75524c733a.
Connection MTU: 23.
SPP+LE>
Exchange MTU Response.
Connection ID: 1.
Transaction ID: 1.
Connection Type: LE.
BD_ADDR: 0x5c75524c733a.
MTU: 131.
SPP+LE>
SPP+LE>DiscoverSPPLE 5c75524c733a
GATT_Start_Service_Discovery success.
SPP+LE>
Service 0x000f - 0x001b, UUID: 14839ac47d7e415c9a42167340cf2339.
SPP+LE>
Service Discovery Operation Complete, Status 0x00.
SPP+LE>ConfigureSPPLE 5c75524c733a
SPPLE Service found on remote device, attempting to read Transmit Credits, and configured CCCDs.
SPP+LE>
Write Response.
Connection ID: 1.
Transaction ID: 15.
Connection Type: LE.
BD_ADDR: 0x5c75524c733a.
Bytes Written: 2.
SPP+LE>
Write Response.
Connection ID: 1.
Transaction ID: 16.
Connection Type: LE.
BD_ADDR: 0x5c75524c733a.
Bytes Written: 2.
Note: When SPPLEDemo acts as the server the user must manually enable notifications with the LightBlue app, however, SPPLEDemo handles enabling notifications automatically when the ConfigureSPPLE command is run.

Now that the 2 devices are connected and configured the devices can send and receive data between them. Now select the SPPLEDemo Virtual Peripheral in LightBlue to see the virtual peripheral's characteristics. Observe the following or similar on the iDevice's display:


GUID-20230227-SS0I-V14Z-S7X4-CTXDWPNLCK01-low.png