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

User description in pc-ble-driver-py

When trying to add a user description to the BLEGattsCharMD() I get this error:

TypeError: in method 'ble_gatts_char_md_t_p_char_user_desc_set', argument 2 of type 'uint8_t const *'

This is a code snippet causing this error:

props = BLEGattCharProps(notify=True, read=True, write=True)
desc_md = BLEGattCharProps(read=True)
user_desc = bytearray([1,2,3])
char_md = BLEGattsCharMD(char_props=props, desc_md=desc_md, user_desc=user_desc)

The error is on this line in ble_driver.py:

char_md.p_char_user_desc = util.list_to_char_array(self.user_desc)

(See https://github.com/NordicSemiconductor/pc-ble-driver-py/blob/v0.15.0/pc_ble_driver_py/ble_driver.py#L1267)

Any ideas?

Parents
  • Ok, some progress. Instead of

    char_md.p_char_user_desc = util.list_to_char_array(self.user_desc)

    this code at least doesn't produce errors:

    user_desc_array=util.list_to_uint8_array(self.user_desc)
    user_desc_array_cast = user_desc_array.cast()
    char_md.p_char_user_desc = user_desc_array_cast

    But now I get NRF_ERROR_DATA_SIZE when adding the characteristic.

Reply
  • Ok, some progress. Instead of

    char_md.p_char_user_desc = util.list_to_char_array(self.user_desc)

    this code at least doesn't produce errors:

    user_desc_array=util.list_to_uint8_array(self.user_desc)
    user_desc_array_cast = user_desc_array.cast()
    char_md.p_char_user_desc = user_desc_array_cast

    But now I get NRF_ERROR_DATA_SIZE when adding the characteristic.

Children
No Data
Related