PebbleOS
Loading...
Searching...
No Matches
Data Structures | Functions
Generic attributes

Packed lists of id/length/value attributes, as exchanged with the phone. More...

Data Structures

struct  pbl_generic_attr
 Attribute, followed directly by the next one in a list. More...
 
struct  pbl_generic_attr_list
 Attribute list. More...
 

Functions

struct pbl_generic_attr * pbl_generic_attr_find (struct pbl_generic_attr_list *attr_list, uint8_t id, size_t size)
 Find an attribute in a list.
 
struct pbl_generic_attr * pbl_generic_attr_add (struct pbl_generic_attr *attr, uint8_t id, const void *data, size_t size)
 Write an attribute.
 

Detailed Description

Packed lists of id/length/value attributes, as exchanged with the phone.


Data Structure Documentation

◆ pbl_generic_attr

struct pbl_generic_attr

Attribute, followed directly by the next one in a list.

Data Fields
uint8_t data[] Attribute value.
uint8_t id Attribute identifier.
uint16_t length Length of data in bytes.

◆ pbl_generic_attr_list

struct pbl_generic_attr_list

Attribute list.

Data Fields
struct pbl_generic_attr attributes[] Attributes, back to back.
uint8_t num_attributes Number of attributes in attributes.

Function Documentation

◆ pbl_generic_attr_add()

struct pbl_generic_attr * pbl_generic_attr_add ( struct pbl_generic_attr *  attr,
uint8_t  id,
const void *  data,
size_t  size 
)

Write an attribute.

The caller must ensure there is room for the header and size bytes, and update pbl_generic_attr_list::num_attributes.

Parameters
[out]attrWhere to write the attribute.
idAttribute identifier.
dataAttribute value.
sizeLength of data in bytes.
Returns
Position right after the written attribute, where the next one goes.

◆ pbl_generic_attr_find()

struct pbl_generic_attr * pbl_generic_attr_find ( struct pbl_generic_attr_list *  attr_list,
uint8_t  id,
size_t  size 
)

Find an attribute in a list.

Attributes that would extend past size end the search.

Parameters
attr_listAttribute list.
idAttribute identifier.
sizeSize of the buffer holding attr_list, in bytes.
Returns
First attribute with id, or NULL if none is found.