Different Value Types of Characteristics Example


This code example has a related User's Guide, here: Different Value Types of Characteristics.


This is the example code for the Different Value Types of Characteristics, which demonstrates below features:

  1. Write and read a characteristic with value type "Hex".
  2. Write and read a characteristic with value type "User".
  3. If notification to the characteristic are enabled, it sends a notification for every 3 seconds and increments the first byte.
  4. By searching the key word "TAG", you will easily find the place for handling the operations above.

Setting up

  1. Create a “SoC-Empty” example as the starting point

  2. Copy attached app.c and app.h to the project overwriting the existing ones.

  3. Open the .isc file in the project, import the GATT database, as shown in the following steps. In this example, one service and two characteristics are added into the GATT database.

    • Click the "Custom BLE GATT".
    • Click the "import GATT from .bgproj file" on the right side.
    • Choose the gatt.xml file in the attachment and generate. Note: DO NOT FORGET THIS STEP.

    Figure 1. Import GATT Database

  4. Build and program to your board.


The example code shows where to handle the read and write requests to the characteristic with both user or hex type, as well as sending a notification every 3 seconds and incrementing the first byte. Follow the below steps to test the example: