bluetooth: ots: Add object name write capability
Add the ability to perform a write on the object name GATT Characteristic with a notification callback to the application that the name has been written. In order for this operation to work the memory backing the object name must be modifiable. To prevent forcing the user to always allocate 120 bytes for the name, the maximum name length is changed from a define to a configuration parameter. Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
This commit is contained in:
parent
cb6ef1328b
commit
d6314fa456
6 changed files with 134 additions and 22 deletions
|
@ -33,9 +33,6 @@ extern "C" {
|
|||
/** @brief Length of OTS object ID string (in bytes). */
|
||||
#define BT_OTS_OBJ_ID_STR_LEN 15
|
||||
|
||||
/** @brief Maximum object name length */
|
||||
#define BT_OTS_OBJ_MAX_NAME_LEN 120
|
||||
|
||||
/** @brief Type of an OTS object. */
|
||||
struct bt_ots_obj_type {
|
||||
union {
|
||||
|
@ -548,6 +545,20 @@ struct bt_ots_cb {
|
|||
uint32_t (*obj_read)(struct bt_ots *ots, struct bt_conn *conn,
|
||||
uint64_t id, uint8_t **data, uint32_t len,
|
||||
uint32_t offset);
|
||||
|
||||
/** @brief Object name written callback
|
||||
*
|
||||
* This callback is called when the object name is written.
|
||||
* This is a notification to the application that the object name
|
||||
* has been updated by the OTS service implementation.
|
||||
*
|
||||
* @param ots OTS instance.
|
||||
* @param conn The connection that wrote object name.
|
||||
* @param id Object ID.
|
||||
* @param name Object name.
|
||||
*/
|
||||
void (*obj_name_written)(struct bt_ots *ots, struct bt_conn *conn,
|
||||
uint64_t id, const char *name);
|
||||
};
|
||||
|
||||
/** @brief Descriptor for OTS initialization. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue