I am using the custom_bluetooth_service tutorial from https://github.com/bjornspockeli/custom_ble_service_example. I am trying to set the value length of the custom characteristic to be variable (up to 20 bytes). So I set attr_md.vlen = 1; and reflash the code to my NRF 52 DK. I made sure to erase my NRF 52 DK before reflashing the new code.
I try writing byte array or text to the custom characteristic, but the nrf_connect app will only display value of one character/byte write. For example if I try writing byte array of 0x0102 or text values "ab" or "test string" and then do a read of the characteristic value, the nrf_connect app will only display one character during the value read. The one character that is read is also only from previous write of one character/byte. Is this nrf_connect app behavior supposed to be expected?
/* This code belongs in custom_value_char_add() in ble_cus.c*/ memset(&attr_md, 0, sizeof(attr_md)); attr_md.read_perm = p_cus_init->custom_value_char_attr_md.read_perm; attr_md.write_perm = p_cus_init->custom_value_char_attr_md.write_perm; attr_md.vloc = BLE_GATTS_VLOC_STACK; attr_md.rd_auth = 0; attr_md.wr_auth = 0; attr_md.vlen = 1; }