nRF5 SDK  v14.1.0
Choose documentation:
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Experimental: Object Transfer Service client Example
This example requires one of the following SoftDevices: S132, S140

Important: Before you run this example, make sure to program the SoftDevice.

The Object Transfer Service (OTS) client application is a central role example that implements an Object Transfer Service (OTS) client.

When the application device connects to a peer, they establish L2CAP channel reserved for OTS.

Upon connection, the OTS Feature characteristic (0x2ABD) is also read. A typical output from the read looks like this on the UART:

Supported features on the connected Server:
    Read OP Code Supported.
    Append Additional Data to Objects Supported.
    Truncation of Objects Supported.
    Patching of Objects Supported.
    Abort OP Code Supported.

The OTS client will request to write an object. The request is done by writing to the Object Action Control Point (0x2AC5) over GATT. If the write is accepted by the server, the data will be transfered over the L2CAP channel established earlier. An event is triggered on the server side application when the write is complete.

The "object" in this example is simply the numbers from 0 to 255, repeated for the length of the object.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_central\experimental\ble_app_ots_c

Button assignments: BSP BLE Button Assignments

The application uses the following UART settings:

  • Baud rate: 115.200
  • 8 data bits
  • 1 stop bit
  • No parity
  • HW flow control: None

Testing

Two boards are needed to perform this test:

  • Client board: nRF5 development board containing the SoftDevice.
  • Server board: nRF5 development board containing the SoftDevice and the Experimental: Object Transfer Service Server Application.

    1. Start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
      • Baud rate: 115.200
      • 8 data bits
      • 1 stop bit
      • No parity
      • HW flow control: None
    2. Compile and program the application on the Client board. Observe that the BSP_INDICATE_SCANNING state is indicated.
    3. Verify that the second device is set up as the Server board. Observe that the BSP_INDICATE_CONNECTED state is indicated once both boards are on. The connection will also be confirmed on UART.
    4. Verify that the features of the peer are printed on UART. (Similar to the example UART output above).
    5. Press Button 1 on the client to transfer an object. On the server side UART, verify that the object is printed. (01 02 03 04 ... 61 62 63)
    6. Press Button 2 to read the object that was transferred in the previous step. On the client application side UART, verify that the object is printed. (01 02 03 04 ... 61 62 63)