Enabling of notification and indication

6 posts / 0 new
Last post
CheMax
Offline
Last seen:3 years 4 months ago
Joined:2015-01-12 07:03
Enabling of notification and indication

Hello

我想,我找到了一个错误in filecustom_common.cin 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:
Joacimwe
Offline
Last seen:1 year 5 months ago
Guru
Joined:2014-01-14 06:45
I don't know how you count,

I don't know how you count, but 0x0002 is two bytes. A 2 followed by a 0 in little endian encoding.

CheMax
Offline
Last seen:3 years 4 months ago
Joined:2015-01-12 07:03
Yes, but if you write the

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

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Chemax,

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

CheMax
Offline
Last seen:3 years 4 months ago
Joined:2015-01-12 07:03
Ok, it's work

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

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi CheMax,

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