This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GATT service start and end handles

hello,

i am working on nrf52 dk board .NUS sdk 16

 I'd like to know the start/end characteristic handle values for each service. Is the 32-bit service handle encoded as two 16-bit characteristic start/end handles? If not, is there a way to determine the start and end handles for a discovered service? 

please help this topic service start and end handles..

  • Hi,

    I am not sure I understand the question.

    There are only two characteristics for the NUS service, and their UUD is defined like this (from SDK code):

    #define NUS_BASE_UUID                  {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */
    #define BLE_UUID_NUS_SERVICE 0x0001                         /**< The UUID of the Nordic UART Service. */
    #define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0003               /**< The UUID of the TX Characteristic. */
    #define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0002               /**< The UUID of the RX Characteristic. */

    So you will only discover two handles for the NUS service. In theory the only way to determine those is to do service discovery, but if you know that it will never  change then you could in fact hard code the handles on the peer (see for instance this post). I am not sure if that is what you want, though.

  • thanks for reply 

    actually, my doubt is I am working on AT command project  it's like structured command is there

    is like (AT+UBTGDCS=<conn_handle>,<start><end>, - this command for  Discovers all characteristics of a service)

    conn_handle - Handle of the connected device.

    start           - Start handle of the service.

    end   -End handle of the service

    I need to pass this parameter through UART terminal like (putty) this response back from the server 

    Discovers all characteristics of a service...

  • I see. The handle values are not necessarily the same for all devices that use NUS, and will be different if you change configuration (order of adding other services compared to NUS etc). When I printed the handle values for the unmodified NUS example in SDK 17.0.2 I got the following (two normal characteristics plus the CCCD):

    <info> ble_nus_c: NUS RX characteristic handle value: 13
    <info> ble_nus_c: NUS TX characteristic handle value: 15
    <info> ble_nus_c: NUS TX CCCD handle value: 16

    So if you pick numbers <= 13 and >= 16 when you do service discovery, you would find all in this case.

Related