From a2a46e66e1c9504c93d7cc34a9918a86d10f0d4e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 12 Nov 2017 23:04:09 +0200 Subject: [PATCH] Bluetooth: Mesh: Export key packing helpers internally Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/cfg.c | 15 --------------- subsys/bluetooth/host/mesh/foundation.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/subsys/bluetooth/host/mesh/cfg.c b/subsys/bluetooth/host/mesh/cfg.c index f7505effe2c..4d523e1e036 100644 --- a/subsys/bluetooth/host/mesh/cfg.c +++ b/subsys/bluetooth/host/mesh/cfg.c @@ -42,21 +42,6 @@ static struct label { u8_t uuid[16]; } 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) { diff --git a/subsys/bluetooth/host/mesh/foundation.h b/subsys/bluetooth/host/mesh/foundation.h index 85b237ed018..4b32b045cd0 100644 --- a/subsys/bluetooth/host/mesh/foundation.h +++ b/subsys/bluetooth/host/mesh/foundation.h @@ -133,3 +133,20 @@ u8_t bt_mesh_relay_retransmit_get(void); u8_t bt_mesh_beacon_get(void); u8_t bt_mesh_gatt_proxy_get(void); u8_t bt_mesh_default_ttl_get(void); + +#include + +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); +}