Set characteristic length

Hey,
I need to set characteristic length for a PTS test to MTU-1
Otherwise the test case GATT/SR/GAC/BV-01-C  will failed with the message
- Failed: Cannot find characteristic value with size equal to MTU-1.

For create a characteristic I currently use the macro
BT_GATT_CHARACTERISTIC

How can I change the length for characteristic ?

Parents
  • Hello,

    Sorry for the late reply, but I needed to clarify this with our SoftDevice Controller team. 

    In the nRF Connect SDK the data in the characteristics are not owned by the application, and not the Bluetooth stack.

    So in your read callback, you can decide what data you want to send in the reply.

    Best regards,

    Edvin

  • Actually, it looks like the characteristic length is set by the BT_GATT_CHARACTERISTIC() macro when declaring the characteristic. If you look at the lbs.c file in NCS, you can see that the last parameter in BT_GATT_CHARACTERISTIC() is a pointer to the parameter holding the value of the characteristic:

    	BT_GATT_CHARACTERISTIC(BT_UUID_LBS_BUTTON,
    			       BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
    			       BT_GATT_PERM_READ, read_button, NULL,
    			       &button_state),

    So in this case, the button_state parameter is a boolean. If you would have input a parameter that was e.g. an uint8_t button_state[10], it would be a 10 byte characteristic. 

    BR,
    Edvin

Reply
  • Actually, it looks like the characteristic length is set by the BT_GATT_CHARACTERISTIC() macro when declaring the characteristic. If you look at the lbs.c file in NCS, you can see that the last parameter in BT_GATT_CHARACTERISTIC() is a pointer to the parameter holding the value of the characteristic:

    	BT_GATT_CHARACTERISTIC(BT_UUID_LBS_BUTTON,
    			       BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
    			       BT_GATT_PERM_READ, read_button, NULL,
    			       &button_state),

    So in this case, the button_state parameter is a boolean. If you would have input a parameter that was e.g. an uint8_t button_state[10], it would be a 10 byte characteristic. 

    BR,
    Edvin

Children
No Data
Related