Hello
我想,我找到了一个错误in filecustom_common.c
in a functionint check_client_char_cfg(bool is_notification, struct gattc_write_cmd_ind const *param)
. The conditionf (param->length != sizeof(uint16_t))
is incorrect.
According specification Bluetooth Core 4.1, vol.3, part G, section 3.3.3.3 Client Characteristic Configuration in attribute of characteristic (UUID 0x2902) may be written a one of these values: 0x0000(no notification and indication), 0x0001(notification ON) or 0x0002 (indication ON), i.e param->length = 1 (byte). But functionsizeof(uint16_t)
returns 2 (bytes).
Therefore, when I try record 1 byte to enable notification, I have a mistake: Invalid_attribute_length.
This problem I saw and in SDK 3.0.6
Keywords:
Device:
I don't know how you count, but 0x0002 is two bytes. A 2 followed by a 0 in little endian encoding.
Yes, but if you write the value by connection manager, you write 1 (in dec) or 01 (hex). And this operation will be failed with standart condition.
Try run the example ble_app_profile with connection manager
Hi Chemax,
The value is 16bit, so the condition is correct, and you get an invalid value because you send only one byte. If you want to use the connection manager try to send two bytes explicitly like this "01 00".
Thanks MT_dialog
Ok, it's work
But the value of 0x0001 (16 bit) and 0x01 (8 bit) . I not see difference when i try write a 0x01 or 0x0001.
Indeed, in both cases, only the least significant bit is written
Hi CheMax,
Its a restriction that Connection Manager applies, every number without a space,Connection Managerinterprets it as a single byte i suppose and this is what it sends, so if you send 0x01 you send only onle byte and the same applies when sending 0x0001.
Thanks MT_dialog