Hi all,
During development I've run into issues setting up a functioning characteristic notification for IOS or Android. The notification works fine using the NRF Connect app however.
The only way i can make the notify work correctly in either my projects app or free ios/android apps is to set the security to open for the connection and characteristics.
ble_gap_conn_params_t gap_conn_params;
ble_gap_conn_sec_mode_t sec_mode;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
In particular in the app writing to the CCCD to enable notifications caused my HW to Hardlock, Removing all actual notifications being sent did not effect the behavior.
has anyone else run into this problem?
Note: this is only an issue with notify, all other characteristic settings worked fine with encryption.
characteristic setup code below that has the issue:
uint32_t err_code;
ble_uuid_t char_uuid;
ble_uuid128_t base_uuid = BLE_UUID_project_BASE_UUID;
char_uuid.uuid = CharData->CharUUID;
err_code = sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
Error_projectError(err_code, NULL);
ble_gatts_char_md_t char_md;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = CharData->enableRead;
char_md.char_props.write = CharData->enableWrite;
sq
ble_gatts_attr_md_t attr_md;
memset(&attr_md, 0, sizeof(attr_md));
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&attr_md.write_perm);
attr_md.vlen = CharData->variableLen;
attr_md.vloc = BLE_GATTS_VLOC_STACK;
//for notify, must be set to open for read, otherwise the stack flags it as an issue
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
char_md.p_cccd_md = &attr_md;
char_md.char_props.notify = 1;
ble_gatts_attr_t attr_char_value;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &char_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.max_len = CharData->maxLen;
attr_char_value.init_len = CharData->initLen;
attr_char_value.p_value = CharData->pValue;
err_code = sd_ble_gatts_characteristic_add(gprojectService.serviceHandle,
&char_md,
&attr_char_value,
CharData->pCharHandles);