Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Apple Notification Center Service - hard coded max attribute length of 32?

nrf_ble_ancs_c.h has hardcoded max attribute length of 32 (BLE_ANCS_ATTR_DATA_MAX).

1) BLE_ANCS_ATTR_DATA_MAX mainly seems to be used to allocate the size of the app_id in ble_ancs_c_evt_t.  So maybe is misnamed?

2) BLE_ANCS_ATTR_DATA_MAX is also used for checking the the length passed to nrf_ble_ancs_c_attr_add.  But that doesn't seem to make sense because the buffers are passed in and can be of any size.  Is this a bug?  I want to be able to pass in a large buffer (say 100 bytes) for the message attribute so I can get more than 32 characters of the notification message attribute.

Parents
  • Hello,

    #define BLE_ANCS_ATTR_DATA_MAX              32  //!< Maximum data length of an iOS notification attribute.

    1. The comment for the definition could be more clear. The define is also used for application attributes in addition to notification attributes. The App ID is an attribute, so I think the naming of the definition itself is ok. But that is subjective of course.

    2. This define is safe to increase so that you can receive more of the attribute. It should have been placed in sdk_config.h.

    nrf_ble_ancs_c_app_attr_add() will return NRF_ERROR_INVALID_LENGTH if you supply a "len" param larger than BLE_ANCS_ATTR_DATA_MAX. This could have been mentioned directly in the API documentation.

Reply
  • Hello,

    #define BLE_ANCS_ATTR_DATA_MAX              32  //!< Maximum data length of an iOS notification attribute.

    1. The comment for the definition could be more clear. The define is also used for application attributes in addition to notification attributes. The App ID is an attribute, so I think the naming of the definition itself is ok. But that is subjective of course.

    2. This define is safe to increase so that you can receive more of the attribute. It should have been placed in sdk_config.h.

    nrf_ble_ancs_c_app_attr_add() will return NRF_ERROR_INVALID_LENGTH if you supply a "len" param larger than BLE_ANCS_ATTR_DATA_MAX. This could have been mentioned directly in the API documentation.

Children
Related