Bluetooth: Mesh: Export key packing helpers internally
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
9cbb979db7
commit
a2a46e66e1
2 changed files with 17 additions and 15 deletions
|
@ -42,21 +42,6 @@ static struct label {
|
||||||
u8_t uuid[16];
|
u8_t uuid[16];
|
||||||
} labels[CONFIG_BT_MESH_LABEL_COUNT];
|
} labels[CONFIG_BT_MESH_LABEL_COUNT];
|
||||||
|
|
||||||
static inline void key_idx_unpack(struct net_buf_simple *buf,
|
|
||||||
u16_t *idx1, u16_t *idx2)
|
|
||||||
{
|
|
||||||
*idx1 = sys_get_le16(&buf->data[0]) & 0xfff;
|
|
||||||
*idx2 = sys_get_le16(&buf->data[1]) >> 4;
|
|
||||||
net_buf_simple_pull(buf, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void key_idx_pack(struct net_buf_simple *buf,
|
|
||||||
u16_t idx1, u16_t idx2)
|
|
||||||
{
|
|
||||||
net_buf_simple_add_le16(buf, idx1 | ((idx2 & 0x00f) << 12));
|
|
||||||
net_buf_simple_add_u8(buf, idx2 >> 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void hb_send(struct bt_mesh_model *model)
|
static void hb_send(struct bt_mesh_model *model)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -133,3 +133,20 @@ u8_t bt_mesh_relay_retransmit_get(void);
|
||||||
u8_t bt_mesh_beacon_get(void);
|
u8_t bt_mesh_beacon_get(void);
|
||||||
u8_t bt_mesh_gatt_proxy_get(void);
|
u8_t bt_mesh_gatt_proxy_get(void);
|
||||||
u8_t bt_mesh_default_ttl_get(void);
|
u8_t bt_mesh_default_ttl_get(void);
|
||||||
|
|
||||||
|
#include <misc/byteorder.h>
|
||||||
|
|
||||||
|
static inline void key_idx_pack(struct net_buf_simple *buf,
|
||||||
|
u16_t idx1, u16_t idx2)
|
||||||
|
{
|
||||||
|
net_buf_simple_add_le16(buf, idx1 | ((idx2 & 0x00f) << 12));
|
||||||
|
net_buf_simple_add_u8(buf, idx2 >> 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void key_idx_unpack(struct net_buf_simple *buf,
|
||||||
|
u16_t *idx1, u16_t *idx2)
|
||||||
|
{
|
||||||
|
*idx1 = sys_get_le16(&buf->data[0]) & 0xfff;
|
||||||
|
*idx2 = sys_get_le16(&buf->data[1]) >> 4;
|
||||||
|
net_buf_simple_pull(buf, 3);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue