Create a 128-bit UUID profile with attmdb_add_service()

5 posts / 0 new
Last post
Matthieu ANTOINE
Offline
Last seen:4 years 3 months ago
Expert
Joined:2014-01-14 14:51
Create a 128-bit UUID profile with attmdb_add_service()

Hi,

Based on the sample128 example you provide, I am building my own proprietary profile. When it comes to using the function attmdb_add_service(), some doubts arise...

Let's stick to the current example. There are 2 128-bit UUID characteristics (one RW, one RW+ntf).

In sample128_task.c, there is a function called _create_db_req_handler() where the database is filled. Here is my understanding concerning the way attmdb_add_service() is used:
- nb_att_16 = 4 (am I right in the following description?)
_ 1*Primary service declaration (UUID16 = 0x2800)
_ 2*Characteristic declarations (UUID16 = 0x2803)
_ 1*Client Characteristic configuration (UUID16 = 0x2902)
- nb_att_32 = 0
- nb_att_128 = 2
_ 2 UUID128 characteristics

Why nb_att_128 = 2 while there are 3 UUID128 items (2 characteristics and the service itself)?

Concerning the way a service is implemented, why did you chose attmdb_add_service() function for sample128? Almost all available profiles are based on attm_svc_create_db(). Is there a way easier than the other one?

Thanks,
Matt

VesaN
Offline
Last seen:5 years 4 months ago
Guru Master
Joined:2014-06-26 08:49
Hello Matt,

Hello Matt,

Concerning the way a service is implemented, why did you chose attmdb_add_service() function for sample128? Almost all available profiles are based on attm_svc_create_db(). Is there a way easier than the other one?

Yes, the other method is easier, which most already implemented services utilize. However, I don't think you cannot have 128-bit services with the easier method, at least with easy modifications (based on my findings).

Still, I think it is better to use the easier method for creating services.

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
Joined:2014-12-30 05:01
Hi, VesaN, could please

Hi, VesaN, could please explain more details of attm_svc_create_db() method here?

VesaN
Offline
Last seen:5 years 4 months ago
Guru Master
Joined:2014-06-26 08:49
Hi summer20100514,

Hi summer20100514,

this is the description found in attm_db.h:

/**
****************************************************************************************
* @brief Function use to ease service database creation.
*
* Use @see attmdb_add_service function of attmdb module to create service database,
* then use @see attmdb_add_attribute function of attmdb module to create attributes
* according to database description array given in parameter.
*
* @note: database description array shall be const to reduce memory consuption (only ROM)
* @note: It supports only 16 bits UUIDs
*
* @param[in|out] shdl Service start handle.
* @param[in|out] cfg_flag Configuration Flag, each bit matches with an attribute of
* att_db (Max: 32 attributes); if the bit is set to 1, the
* attribute will be added in the service.
* @param[in] max_nb_att Number of attributes in the service
* @param[in|out] att_tbl Array which will be fulfilled with the difference between
* each characteristic handle and the service start handle.
* This array is useful if several characteristics are optional
* within the service, can be set to NULL if not needed.
* @param[in] dest_id Task ID linked to the service. This task will be notified
* each time the service content is modified by a peer device.
* @param[in|out] att_db Table containing all attributes information
*
* @return Command status code:
* - @ref ATT_ERR_NO_ERROR: If database creation succeeds.
* - @ref ATT_ERR_INVALID_HANDLE: If start_hdl given in parameter + nb of attribute override
* some existing services handles.
* - @ref ATT_ERR_INSUFF_RESOURCE: There is not enough memory to allocate service buffer.
* or of new attribute cannot be added because all expected
* attributes already added or buffer overflow detected during
* allocation
****************************************************************************************
*/

Thanks!

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
Joined:2014-12-30 05:01
I have read this before, but

I have read this before, but thank you all the same.