mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble_mesh: Expose SeqZero mask
Makes a define for the seqzero 13-bit mask in transport, and exposes it in the header for use in the friend module.
This commit is contained in:
parent
463a9d8b7f
commit
a870460f72
@ -371,7 +371,7 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
||||
tx->ttl = net_tx->ctx->send_ttl;
|
||||
}
|
||||
|
||||
seq_zero = tx->seq_auth & 0x1fff;
|
||||
seq_zero = tx->seq_auth & TRANS_SEQ_ZERO_MASK;
|
||||
|
||||
BT_DBG("SeqZero 0x%04x", seq_zero);
|
||||
|
||||
@ -780,7 +780,7 @@ static struct seg_tx *seg_tx_lookup(u16_t seq_zero, u8_t obo, u16_t addr)
|
||||
for (i = 0; i < ARRAY_SIZE(seg_tx); i++) {
|
||||
tx = &seg_tx[i];
|
||||
|
||||
if ((tx->seq_auth & 0x1fff) != seq_zero) {
|
||||
if ((tx->seq_auth & TRANS_SEQ_ZERO_MASK) != seq_zero) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -818,7 +818,7 @@ static int trans_ack(struct bt_mesh_net_rx *rx, u8_t hdr,
|
||||
|
||||
seq_zero = net_buf_simple_pull_be16(buf);
|
||||
obo = seq_zero >> 15;
|
||||
seq_zero = (seq_zero >> 2) & 0x1fff;
|
||||
seq_zero = (seq_zero >> 2) & TRANS_SEQ_ZERO_MASK;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) && rx->friend_match) {
|
||||
BT_DBG("Ack for LPN 0x%04x of this Friend", rx->ctx.recv_dst);
|
||||
@ -1079,7 +1079,7 @@ static int send_ack(struct bt_mesh_subnet *sub, u16_t src, u16_t dst,
|
||||
.src = obo ? bt_mesh_primary_addr() : src,
|
||||
.xmit = bt_mesh_net_transmit_get(),
|
||||
};
|
||||
u16_t seq_zero = *seq_auth & 0x1fff;
|
||||
u16_t seq_zero = *seq_auth & TRANS_SEQ_ZERO_MASK;
|
||||
u8_t buf[6];
|
||||
|
||||
BT_DBG("SeqZero 0x%04x Block 0x%08x OBO %u", seq_zero, block, obo);
|
||||
@ -1287,7 +1287,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
|
||||
|
||||
seq_zero = net_buf_simple_pull_be16(buf);
|
||||
seg_o = (seq_zero & 0x03) << 3;
|
||||
seq_zero = (seq_zero >> 2) & 0x1fff;
|
||||
seq_zero = (seq_zero >> 2) & TRANS_SEQ_ZERO_MASK;
|
||||
seg_n = net_buf_simple_pull_u8(buf);
|
||||
seg_o |= seg_n >> 5;
|
||||
seg_n &= 0x1f;
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#define BLE_MESH_TX_SDU_MAX (CONFIG_BLE_MESH_TX_SEG_MAX * 12)
|
||||
|
||||
#define TRANS_SEQ_ZERO_MASK ((u16_t)BIT_MASK(13))
|
||||
#define TRANS_CTL_OP_MASK ((u8_t)BIT_MASK(7))
|
||||
#define TRANS_CTL_OP(data) ((data)[0] & TRANS_CTL_OP_MASK)
|
||||
#define TRANS_CTL_HDR(op, seg) ((op & TRANS_CTL_OP_MASK) | (seg << 7))
|
||||
|
Loading…
Reference in New Issue
Block a user