Please tell me how to set 128bit UUID to "ble_uuid_t" in [Function for adding the Custom Value characteristic].

OS in development environment :Windows10
HARD :(Taiyo Yuden)EBSHSN Series Evaluation Board : Central / Peripherals
CPU :(Nordic) nRF52832 / ARMR Cortex-M4F 32 bit processor 28-pin Land Grid Array / 15GPIOs / SWD
builder :SEGGER Embedded Studio for ARM Release 3.34a Build 2018022300.35192 Windows x64
Copyright 2014-2018 SEGGER Microcontroller GmbH & Co. KG
Copyright 1997-2018 Rowley Associates Ltd.
GCC/BINUTILS: Built using the GNU ARM Embedded Toolchain version 6-2017-q2-update source distribution
Clang/LLVM: Built using the version 5.0.0 source distribution
Soft Ver:nRF5_SDK_15.3.0_59ac345

I thought about it with reference to [Common type and macro definition> Definition], but I think that it will affect related programs if the [p_cus-> uuid_type] part of the 16-bit setting is not performed even with the 128-bit setting.

(For 16bit)
    ble_uuid_t ble_uuid;
    ble_uuid.type = p_cus->uuid_type;
(For 128bit)
    ble_uuid_t ble_uuid;
    ble_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;

Please tell me the setting method for 128bit.
Thanking you in advance.

Parents
  • Hi Toshikazu, 

    Could you give me more context of how you use the ble_uuid.type code ? 

    If you have a look at the ble_nus.c example you can find that we call : ble_uuid.type = p_nus->uuid_type; where p_nus->uuid_type is the output from the function sd_ble_uuid_vs_add(). When you declare a new 128bit UUID by using sd_ble_uuid_vs_add() it will assign a UUID base index into p_nus->uuid_type. 

    So it's not always that you have ble_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN; . The index for 128 bit UUID starts at  BLE_UUID_TYPE_VENDOR_BEGIN (2) but it doesn't mean that it's always 2, if you declare 2 UUID bases, the second UUID base will get the index (uuid_type) = 3 

Reply
  • Hi Toshikazu, 

    Could you give me more context of how you use the ble_uuid.type code ? 

    If you have a look at the ble_nus.c example you can find that we call : ble_uuid.type = p_nus->uuid_type; where p_nus->uuid_type is the output from the function sd_ble_uuid_vs_add(). When you declare a new 128bit UUID by using sd_ble_uuid_vs_add() it will assign a UUID base index into p_nus->uuid_type. 

    So it's not always that you have ble_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN; . The index for 128 bit UUID starts at  BLE_UUID_TYPE_VENDOR_BEGIN (2) but it doesn't mean that it's always 2, if you declare 2 UUID bases, the second UUID base will get the index (uuid_type) = 3 

Children
  • The application on the tablet side is designed to communicate using the UUID (128bit) unique to each item of CUS communication.
    Please tell me how to set a unique UUID (128bit) for each CUS communication item and communicate.

  • Hi Toshikazu, 

    I would suggest to have a look at the ble_nus.c library. Have you tried with the ble_app_uart example ? In the example we use 128 bit UUID to declare UART TX and UART RX characteristic. 

  • Mr. Hung Bui
    I checked [ble_nus.c].
    128bit UUID is set in [NUS_BASE_UUID], but 16bit UUID is set in the communication item UUID. Is there a way to set 128bit UUID for each communication item?
    128bit UUID is set for each item in the communication application on the tablet side.
    ------------------------------------------
    #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. */
    #define NUS_BASE_UUID {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */
    -----------------------------------------
    Thanking you in advance.

  • Hi Toshikazu, 

    The way it works in our softdevice is that you add a 128 bits (16 bytes) base UUID into the softdevice and you declare a 16 bits  UUID of the service/characteristic on top of that.

    This 16 bits UUID will be place in byte 12th and 13th in the UUID base and this will create a full 128 bit UUID for the service/characteristic. 

    For example if the base is: 
    0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E

    And the TX characteristic has 16 bit UUID 0x0003 . 

    The full UUID of the characteristic will be: 
    0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x03, 0x00, 0x40, 0x6E


    Do you have a requirement that each of your characteristic should have different base UUIDs ? 

    If it's the case you may need to define multiple of them using sd_ble_uuid_vs_add() and then use the correspondent uuid_type for each of the characteristic declaration. 

  • Mr. Hung Bui
    It seems that I was not able to ask the question correctly, so I will ask again

    Please tell me how to set the following conditions and how to communicate.
    [conditions]
    1) Communicate using your own UUID, not the UUID issued by the Bluetooth SIG.
    2) A unique 128-bit UUID is set for each item.
    3) I want to communicate using 19 unique UUIDs (128 bits)
    (Because the existing application is used, it is necessary to create it according to the application)
    Thank you.

Related