Skip to main content

Create a 128-bit UUID profile with attmdb_add_service()

6 years ago

Create a 128-bit UUID profile with attmdb_add_service()

Posted byMatthieu ANTOINE0 points 4 replies
0 upvotes

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

6 years ago

VesaN 0 points

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.

5 years ago

summer20100514 0 points

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

5 years ago

VesaN 0 points

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:它只支持16位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!

5 years ago

summer20100514 0 points

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