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

Create BLE characteristic with notifications active on queued write service

I'm developing an application to communicate with a smartphone. I have the need of writing characteristics with the size bigger than the negotiated MTU, so I'm exploring Queued write example. So far, I'm able to write to the characteristic, however, I need to have two characteristics, one used to write and another to read with the possibility of push notifications.

To do that I tried to change the source code to add a characteristic with "read" and "notify" permissions, as you can see below:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
ble_add_char_params_t add_char_params;
memset(&add_char_params, 0, sizeof(add_char_params));
add_char_params.uuid = BLE_UUID_QWRS_LONG_CHARACTERISTIC;
add_char_params.max_len = BLE_QWRS_MAX_LONG_CHAR_LEN;
add_char_params.init_len = 0;
add_char_params.char_props.write = true;
add_char_params.write_access = SEC_OPEN;
add_char_params.is_defered_write = true;
err_code = characteristic_add(p_qwrs->service_handle,
&add_char_params,
&p_qwrs->long_charact_handles);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

to

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
ble_add_char_params_t add_char_params;
memset(&add_char_params, 0, sizeof(add_char_params));
add_char_params.uuid = BLE_UUID_QWRS_LONG_CHARACTERISTIC;
add_char_params.max_len = BLE_QWRS_MAX_LONG_CHAR_LEN;
add_char_params.init_len = 0;
add_char_params.char_props.read = true;
add_char_params.char_props.notify = true;
add_char_params.read_access = SEC_OPEN;
err_code = characteristic_add(p_qwrs->service_handle,
&add_char_params,
&p_qwrs->long_charact_handles);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

After that change I received an error code "NRF_INVALID_PARAM" and the characteristic is not added. I also tried to add the read permission only and that works fine.

Can somebody help me to understand how can I add notify permissions?

Note: I am using nordic SDK v13.0.0.