Hello,
I would like to change the default format of a custom characteristic to be a string format. The new characteristic is 8 characters long. This is the code;
memset(&add_char_params, 0, sizeof(add_char_params));
ble_gatts_char_pf_t cpfd =
{
.format = BLE_GATT_CPF_FORMAT_UTF8S,
.unit = 0x2BDE,
.name_space = BLE_GATT_CPF_NAMESPACE_BTSIG,
.desc = BLE_GATT_CPF_NAMESPACE_BTSIG
};
char init_value[MAX_HANDSHAKE_STRING_LEN] = {0};
add_char_params.p_init_value = (uint8_t*)init_value;
add_char_params.init_len =
add_char_params.max_len = sizeof(init_value);
add_char_params.char_props.read = true;
add_char_params.read_access = SEC_OPEN;
add_char_params.char_props.write = true;
add_char_params.write_access = SEC_OPEN;
add_char_params.p_presentation_format = &cpfd;
add_char_params.uuid = BLE_UUID_CHARAC_ECG_HANDSHAKE;
err_code |= characteristic_add(
m_ecg_service.data_svc_handle, &add_char_params, &(m_ecg_service.handshake_handles));
Neither the desktop or mobile nRFConnect programs indicate this is a string value. Both display the initial value as binary. I also tried changing the namespace to UNKNOWN and unit=0 but that did not work either.