How to specify the handle of attribute

6 posts / 0 new
Last post
hardy.chen
Offline
Last seen:1 year 10 months ago
加入:2015-03-13 04:20
How to specify the handle of attribute

Hi,

从“UM-B-00的文档3', function 'attmdb_add_attribute' is used for adding attribute to one service being created via 'attmdb_add_service' in which parameter#1 can be used for the reference of starting handle value.
So, would it be possible for function 'attmdb_add_attribute' to specify the reference handle value for the newly added attribute?

i.e. I want following arrangement of handle value

0x0100 -> custom 128-bit primary service declaration
0x0110 -> first custom 128-bit characteristics declaration
0x0111 -> value handle of first custom characteristics
0x0120 -> second custom 128-bit characteristics declaration
0x0121 -> value handle of second custom characteristics

....
etc.

Device:
MHv_Dialog
Offline
Last seen:2 months 19 hours ago
Staff
加入:2013-12-06 15:10
Hi,

Hi,

You are not directly controlling the 16bit attribute handles. They are automatically assigned as you add attributes. The only guaranteed behavior is that attribute handles are assigned in the order that you add attributes. Can you explain why you would want direct control of the attribute handle assignments? Maybe I can help you achieve your goal in some other way.

hardy.chen
Offline
Last seen:1 year 10 months ago
加入:2015-03-13 04:20
Hi,

Hi,

Cause we would might need to have more direct communication between 2 devices based on GATT, but without (skipping) the discovery procedure.
So, we would prefer to have control on specifying the handle value for each attribute.

It would be great if you can do such favor for me.
Thanks.

MHv_Dialog
Offline
Last seen:2 months 19 hours ago
Staff
加入:2013-12-06 15:10
As Joacim states, keep track

As Joacim states, keep track of your database, this is how it is done. If you worry that your attribute database will chage in future releases, make use of the Device Information Service, to keep track of releases. There is nothing you can do as far as specifying the handles yourself.

Joacimwe
Offline
Last seen:1 year 5 months ago
Guru
加入:2014-01-14 06:45
I suggest you add the

I suggest you add the attributes as normal and write down the handles that were assigned and simply use those. The handles are assigned deterministically and in order so they won't change until you change your db.

hardy.chen
Offline
Last seen:1 year 10 months ago
加入:2015-03-13 04:20
Ok! Thanks and well noted!

Ok!

Thanks and well noted!