mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-09 21:45:54 +00:00
mesh: remove mesh_transport_pdu_t from lower and upper transport
This commit is contained in:
parent
b1a7ae8f2c
commit
ba660d4251
@ -458,9 +458,49 @@ static uint16_t mesh_access_src(mesh_access_pdu_t * access_pdu){
|
|||||||
return big_endian_read_16(access_pdu->network_header, 5);
|
return big_endian_read_16(access_pdu->network_header, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static uint16_t mesh_access_dst(mesh_access_pdu_t * access_pdu){
|
static uint16_t mesh_access_dst(mesh_access_pdu_t * access_pdu){
|
||||||
return big_endian_read_16(access_pdu->network_header, 7);
|
return big_endian_read_16(access_pdu->network_header, 7);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Transport PDU Getter
|
||||||
|
uint16_t mesh_transport_nid(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return transport_pdu->network_header[0] & 0x7f;
|
||||||
|
}
|
||||||
|
uint16_t mesh_transport_ctl(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return transport_pdu->network_header[1] >> 7;
|
||||||
|
}
|
||||||
|
uint16_t mesh_transport_ttl(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return transport_pdu->network_header[1] & 0x7f;
|
||||||
|
}
|
||||||
|
uint32_t mesh_transport_seq(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return big_endian_read_24(transport_pdu->network_header, 2);
|
||||||
|
}
|
||||||
|
uint16_t mesh_transport_src(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return big_endian_read_16(transport_pdu->network_header, 5);
|
||||||
|
}
|
||||||
|
uint16_t mesh_transport_dst(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return big_endian_read_16(transport_pdu->network_header, 7);
|
||||||
|
}
|
||||||
|
uint8_t mesh_transport_control_opcode(mesh_transport_pdu_t * transport_pdu){
|
||||||
|
return transport_pdu->akf_aid_control & 0x7f;
|
||||||
|
}
|
||||||
|
void mesh_transport_set_nid_ivi(mesh_transport_pdu_t * transport_pdu, uint8_t nid_ivi){
|
||||||
|
transport_pdu->network_header[0] = nid_ivi;
|
||||||
|
}
|
||||||
|
void mesh_transport_set_ctl_ttl(mesh_transport_pdu_t * transport_pdu, uint8_t ctl_ttl){
|
||||||
|
transport_pdu->network_header[1] = ctl_ttl;
|
||||||
|
}
|
||||||
|
void mesh_transport_set_seq(mesh_transport_pdu_t * transport_pdu, uint32_t seq){
|
||||||
|
big_endian_store_24(transport_pdu->network_header, 2, seq);
|
||||||
|
}
|
||||||
|
void mesh_transport_set_src(mesh_transport_pdu_t * transport_pdu, uint16_t src){
|
||||||
|
big_endian_store_16(transport_pdu->network_header, 5, src);
|
||||||
|
}
|
||||||
|
void mesh_transport_set_dest(mesh_transport_pdu_t * transport_pdu, uint16_t dest){
|
||||||
|
big_endian_store_16(transport_pdu->network_header, 7, dest);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t mesh_pdu_ctl(mesh_pdu_t * pdu){
|
uint16_t mesh_pdu_ctl(mesh_pdu_t * pdu){
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
|
@ -88,45 +88,6 @@ static void mesh_lower_transport_report_segments_as_processed(mesh_segmented_pdu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Transport PDU Getter
|
|
||||||
uint16_t mesh_transport_nid(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return transport_pdu->network_header[0] & 0x7f;
|
|
||||||
}
|
|
||||||
uint16_t mesh_transport_ctl(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return transport_pdu->network_header[1] >> 7;
|
|
||||||
}
|
|
||||||
uint16_t mesh_transport_ttl(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return transport_pdu->network_header[1] & 0x7f;
|
|
||||||
}
|
|
||||||
uint32_t mesh_transport_seq(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return big_endian_read_24(transport_pdu->network_header, 2);
|
|
||||||
}
|
|
||||||
uint16_t mesh_transport_src(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return big_endian_read_16(transport_pdu->network_header, 5);
|
|
||||||
}
|
|
||||||
uint16_t mesh_transport_dst(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return big_endian_read_16(transport_pdu->network_header, 7);
|
|
||||||
}
|
|
||||||
uint8_t mesh_transport_control_opcode(mesh_transport_pdu_t * transport_pdu){
|
|
||||||
return transport_pdu->akf_aid_control & 0x7f;
|
|
||||||
}
|
|
||||||
void mesh_transport_set_nid_ivi(mesh_transport_pdu_t * transport_pdu, uint8_t nid_ivi){
|
|
||||||
transport_pdu->network_header[0] = nid_ivi;
|
|
||||||
}
|
|
||||||
void mesh_transport_set_ctl_ttl(mesh_transport_pdu_t * transport_pdu, uint8_t ctl_ttl){
|
|
||||||
transport_pdu->network_header[1] = ctl_ttl;
|
|
||||||
}
|
|
||||||
void mesh_transport_set_seq(mesh_transport_pdu_t * transport_pdu, uint32_t seq){
|
|
||||||
big_endian_store_24(transport_pdu->network_header, 2, seq);
|
|
||||||
}
|
|
||||||
void mesh_transport_set_src(mesh_transport_pdu_t * transport_pdu, uint16_t src){
|
|
||||||
big_endian_store_16(transport_pdu->network_header, 5, src);
|
|
||||||
}
|
|
||||||
void mesh_transport_set_dest(mesh_transport_pdu_t * transport_pdu, uint16_t dest){
|
|
||||||
big_endian_store_16(transport_pdu->network_header, 7, dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t mesh_message_nid(mesh_segmented_pdu_t * message_pdu){
|
uint16_t mesh_message_nid(mesh_segmented_pdu_t * message_pdu){
|
||||||
return message_pdu->network_header[0] & 0x7f;
|
return message_pdu->network_header[0] & 0x7f;
|
||||||
}
|
}
|
||||||
|
@ -82,22 +82,6 @@ void mesh_transport_pdu_free(mesh_transport_pdu_t * transport_pdu);
|
|||||||
mesh_segmented_pdu_t * mesh_message_pdu_get(void);
|
mesh_segmented_pdu_t * mesh_message_pdu_get(void);
|
||||||
void mesh_message_pdu_free(mesh_segmented_pdu_t * message_pdu);
|
void mesh_message_pdu_free(mesh_segmented_pdu_t * message_pdu);
|
||||||
|
|
||||||
// transport getter/setter
|
|
||||||
uint16_t mesh_transport_nid(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint16_t mesh_transport_ctl(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint16_t mesh_transport_ttl(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint32_t mesh_transport_seq(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint32_t mesh_transport_seq_zero(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint16_t mesh_transport_src(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint16_t mesh_transport_dst(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
uint8_t mesh_transport_control_opcode(mesh_transport_pdu_t * transport_pdu);
|
|
||||||
|
|
||||||
void mesh_transport_set_nid_ivi(mesh_transport_pdu_t * transport_pdu, uint8_t nid_ivi);
|
|
||||||
void mesh_transport_set_ctl_ttl(mesh_transport_pdu_t * transport_pdu, uint8_t ctl_ttl);
|
|
||||||
void mesh_transport_set_seq(mesh_transport_pdu_t * transport_pdu, uint32_t seq);
|
|
||||||
void mesh_transport_set_src(mesh_transport_pdu_t * transport_pdu, uint16_t src);
|
|
||||||
void mesh_transport_set_dest(mesh_transport_pdu_t * transport_pdu, uint16_t dest);
|
|
||||||
|
|
||||||
uint16_t mesh_message_ctl(mesh_segmented_pdu_t * message_pdu);
|
uint16_t mesh_message_ctl(mesh_segmented_pdu_t * message_pdu);
|
||||||
|
|
||||||
void mesh_lower_transport_init(void);
|
void mesh_lower_transport_init(void);
|
||||||
|
@ -103,30 +103,6 @@ typedef struct mesh_network_pdu {
|
|||||||
#define MESH_TRANSPORT_FLAG_SEQ_RESERVED 1
|
#define MESH_TRANSPORT_FLAG_SEQ_RESERVED 1
|
||||||
#define MESH_TRANSPORT_FLAG_CONTROL 2
|
#define MESH_TRANSPORT_FLAG_CONTROL 2
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
mesh_pdu_t pdu_header;
|
|
||||||
|
|
||||||
// access acknowledged message
|
|
||||||
uint16_t retransmit_count;
|
|
||||||
uint32_t retransmit_timeout_ms;
|
|
||||||
uint32_t ack_opcode;
|
|
||||||
|
|
||||||
// meta data network layer
|
|
||||||
uint16_t netkey_index;
|
|
||||||
// meta data transport layer
|
|
||||||
uint16_t appkey_index;
|
|
||||||
// transmic size
|
|
||||||
uint8_t transmic_len;
|
|
||||||
// akf - aid for access, opcode for control
|
|
||||||
uint8_t akf_aid_control;
|
|
||||||
// network pdu header
|
|
||||||
uint8_t network_header[9];
|
|
||||||
// MESH_TRANSPORT_FLAG
|
|
||||||
uint16_t flags;
|
|
||||||
// pdu
|
|
||||||
uint16_t len;
|
|
||||||
uint8_t data[MESH_ACCESS_PAYLOAD_MAX];
|
|
||||||
} mesh_transport_pdu_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// generic pdu header
|
// generic pdu header
|
||||||
@ -178,6 +154,31 @@ typedef struct {
|
|||||||
btstack_linked_list_t segments;
|
btstack_linked_list_t segments;
|
||||||
} mesh_segmented_pdu_t;
|
} mesh_segmented_pdu_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
mesh_pdu_t pdu_header;
|
||||||
|
|
||||||
|
// access acknowledged message
|
||||||
|
uint16_t retransmit_count;
|
||||||
|
uint32_t retransmit_timeout_ms;
|
||||||
|
uint32_t ack_opcode;
|
||||||
|
|
||||||
|
// meta data network layer
|
||||||
|
uint16_t netkey_index;
|
||||||
|
// meta data transport layer
|
||||||
|
uint16_t appkey_index;
|
||||||
|
// transmic size
|
||||||
|
uint8_t transmic_len;
|
||||||
|
// akf - aid for access, opcode for control
|
||||||
|
uint8_t akf_aid_control;
|
||||||
|
// network pdu header
|
||||||
|
uint8_t network_header[9];
|
||||||
|
// MESH_TRANSPORT_FLAG
|
||||||
|
uint16_t flags;
|
||||||
|
// pdu
|
||||||
|
uint16_t len;
|
||||||
|
uint8_t data[MESH_ACCESS_PAYLOAD_MAX];
|
||||||
|
} mesh_transport_pdu_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// generic pdu header
|
// generic pdu header
|
||||||
mesh_pdu_t pdu_header;
|
mesh_pdu_t pdu_header;
|
||||||
|
@ -271,15 +271,8 @@ static void transport_unsegmented_setup_nonce(uint8_t * nonce, const mesh_networ
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void transport_segmented_setup_nonce(uint8_t * nonce, const mesh_pdu_t * pdu){
|
static void transport_segmented_setup_nonce(uint8_t * nonce, const mesh_pdu_t * pdu){
|
||||||
mesh_transport_pdu_t * transport_pdu;
|
|
||||||
mesh_access_pdu_t * access_pdu;
|
mesh_access_pdu_t * access_pdu;
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
transport_pdu = (mesh_transport_pdu_t *) pdu;
|
|
||||||
nonce[1] = transport_pdu->transmic_len == 8 ? 0x80 : 0x00;
|
|
||||||
(void)memcpy(&nonce[2], &transport_pdu->network_header[2], 7);
|
|
||||||
big_endian_store_32(nonce, 9, iv_index_for_ivi_nid(transport_pdu->network_header[0]));
|
|
||||||
break;
|
|
||||||
case MESH_PDU_TYPE_ACCESS:
|
case MESH_PDU_TYPE_ACCESS:
|
||||||
access_pdu = (mesh_access_pdu_t *) pdu;
|
access_pdu = (mesh_access_pdu_t *) pdu;
|
||||||
nonce[1] = access_pdu->transmic_len == 8 ? 0x80 : 0x00;
|
nonce[1] = access_pdu->transmic_len == 8 ? 0x80 : 0x00;
|
||||||
@ -464,7 +457,7 @@ static void mesh_upper_transport_validate_segmented_message(void){
|
|||||||
static void mesh_upper_transport_process_segmented_message(void){
|
static void mesh_upper_transport_process_segmented_message(void){
|
||||||
// copy original pdu
|
// copy original pdu
|
||||||
(void)memcpy(incoming_access_pdu_decrypted, incoming_access_pdu_encrypted,
|
(void)memcpy(incoming_access_pdu_decrypted, incoming_access_pdu_encrypted,
|
||||||
sizeof(mesh_transport_pdu_t));
|
sizeof(mesh_access_pdu_t));
|
||||||
|
|
||||||
//
|
//
|
||||||
uint8_t * upper_transport_pdu = incoming_access_pdu_decrypted->data;
|
uint8_t * upper_transport_pdu = incoming_access_pdu_decrypted->data;
|
||||||
@ -571,6 +564,7 @@ static uint8_t mesh_upper_transport_setup_unsegmented_control_pdu(mesh_network_p
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static uint8_t mesh_upper_transport_setup_segmented_control_pdu(mesh_transport_pdu_t * transport_pdu, uint16_t netkey_index, uint8_t ttl, uint16_t src, uint16_t dest, uint8_t opcode,
|
static uint8_t mesh_upper_transport_setup_segmented_control_pdu(mesh_transport_pdu_t * transport_pdu, uint16_t netkey_index, uint8_t ttl, uint16_t src, uint16_t dest, uint8_t opcode,
|
||||||
const uint8_t * control_pdu_data, uint16_t control_pdu_len){
|
const uint8_t * control_pdu_data, uint16_t control_pdu_len){
|
||||||
|
|
||||||
@ -591,18 +585,15 @@ static uint8_t mesh_upper_transport_setup_segmented_control_pdu(mesh_transport_p
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t mesh_upper_transport_setup_control_pdu(mesh_pdu_t * pdu, uint16_t netkey_index,
|
uint8_t mesh_upper_transport_setup_control_pdu(mesh_pdu_t * pdu, uint16_t netkey_index,
|
||||||
uint8_t ttl, uint16_t src, uint16_t dest, uint8_t opcode, const uint8_t * control_pdu_data, uint16_t control_pdu_len){
|
uint8_t ttl, uint16_t src, uint16_t dest, uint8_t opcode, const uint8_t * control_pdu_data, uint16_t control_pdu_len){
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
case MESH_PDU_TYPE_NETWORK:
|
case MESH_PDU_TYPE_NETWORK:
|
||||||
return mesh_upper_transport_setup_unsegmented_control_pdu((mesh_network_pdu_t *) pdu, netkey_index, ttl, src, dest, opcode, control_pdu_data, control_pdu_len);
|
return mesh_upper_transport_setup_unsegmented_control_pdu((mesh_network_pdu_t *) pdu, netkey_index, ttl, src, dest, opcode, control_pdu_data, control_pdu_len);
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
return mesh_upper_transport_setup_segmented_control_pdu((mesh_transport_pdu_t *) pdu, netkey_index, ttl, src, dest, opcode, control_pdu_data, control_pdu_len);
|
|
||||||
case MESH_PDU_TYPE_SEGMENTED:
|
|
||||||
btstack_assert(0);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
|
btstack_assert(0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -907,6 +898,7 @@ static void mesh_upper_transport_send_unsegmented_control_pdu(mesh_network_pdu_t
|
|||||||
mesh_lower_transport_send_pdu((mesh_pdu_t *) &outgoing_unsegmented_pdu);
|
mesh_lower_transport_send_pdu((mesh_pdu_t *) &outgoing_unsegmented_pdu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void mesh_upper_transport_send_segmented_control_pdu(mesh_transport_pdu_t * transport_pdu){
|
static void mesh_upper_transport_send_segmented_control_pdu(mesh_transport_pdu_t * transport_pdu){
|
||||||
// reserve slot
|
// reserve slot
|
||||||
mesh_lower_transport_reserve_slot();
|
mesh_lower_transport_reserve_slot();
|
||||||
@ -922,6 +914,7 @@ static void mesh_upper_transport_send_segmented_control_pdu(mesh_transport_pdu_t
|
|||||||
btstack_assert(false);
|
btstack_assert(false);
|
||||||
// mesh_upper_transport_send_segmented_pdu(transport_pdu);
|
// mesh_upper_transport_send_segmented_pdu(transport_pdu);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void mesh_upper_transport_run(void){
|
static void mesh_upper_transport_run(void){
|
||||||
|
|
||||||
@ -932,7 +925,6 @@ static void mesh_upper_transport_run(void){
|
|||||||
// peek at next message
|
// peek at next message
|
||||||
mesh_pdu_t * pdu = (mesh_pdu_t *) btstack_linked_list_get_first_item(&upper_transport_incoming);
|
mesh_pdu_t * pdu = (mesh_pdu_t *) btstack_linked_list_get_first_item(&upper_transport_incoming);
|
||||||
mesh_network_pdu_t * network_pdu;
|
mesh_network_pdu_t * network_pdu;
|
||||||
mesh_transport_pdu_t * transport_pdu;
|
|
||||||
mesh_segmented_pdu_t * message_pdu;
|
mesh_segmented_pdu_t * message_pdu;
|
||||||
mesh_unsegmented_pdu_t * unsegmented_pdu;
|
mesh_unsegmented_pdu_t * unsegmented_pdu;
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
@ -1034,7 +1026,6 @@ static void mesh_upper_transport_run(void){
|
|||||||
(void) btstack_linked_list_pop(&upper_transport_outgoing);
|
(void) btstack_linked_list_pop(&upper_transport_outgoing);
|
||||||
|
|
||||||
mesh_unsegmented_pdu_t * unsegmented_pdu;
|
mesh_unsegmented_pdu_t * unsegmented_pdu;
|
||||||
mesh_transport_pdu_t * transport_pdu;
|
|
||||||
|
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
case MESH_PDU_TYPE_NETWORK:
|
case MESH_PDU_TYPE_NETWORK:
|
||||||
@ -1046,13 +1037,6 @@ static void mesh_upper_transport_run(void){
|
|||||||
btstack_assert((unsegmented_pdu->flags & MESH_TRANSPORT_FLAG_CONTROL) == 0);
|
btstack_assert((unsegmented_pdu->flags & MESH_TRANSPORT_FLAG_CONTROL) == 0);
|
||||||
mesh_upper_transport_send_unsegmented_access_pdu(unsegmented_pdu);
|
mesh_upper_transport_send_unsegmented_access_pdu(unsegmented_pdu);
|
||||||
break;
|
break;
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
if (mesh_pdu_ctl(pdu) != 0){
|
|
||||||
mesh_upper_transport_send_segmented_control_pdu((mesh_transport_pdu_t *) pdu);
|
|
||||||
} else {
|
|
||||||
btstack_assert(false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MESH_PDU_TYPE_ACCESS:
|
case MESH_PDU_TYPE_ACCESS:
|
||||||
if (mesh_pdu_ctl(pdu) != 0){
|
if (mesh_pdu_ctl(pdu) != 0){
|
||||||
btstack_assert(false);
|
btstack_assert(false);
|
||||||
@ -1119,21 +1103,17 @@ static void mesh_upper_transport_pdu_handler(mesh_transport_callback_type_t call
|
|||||||
|
|
||||||
void mesh_upper_transport_pdu_free(mesh_pdu_t * pdu){
|
void mesh_upper_transport_pdu_free(mesh_pdu_t * pdu){
|
||||||
mesh_network_pdu_t * network_pdu;
|
mesh_network_pdu_t * network_pdu;
|
||||||
mesh_transport_pdu_t * transport_pdu;
|
|
||||||
mesh_segmented_pdu_t * message_pdu;
|
mesh_segmented_pdu_t * message_pdu;
|
||||||
switch (pdu->pdu_type) {
|
switch (pdu->pdu_type) {
|
||||||
case MESH_PDU_TYPE_NETWORK:
|
case MESH_PDU_TYPE_NETWORK:
|
||||||
network_pdu = (mesh_network_pdu_t *) pdu;
|
network_pdu = (mesh_network_pdu_t *) pdu;
|
||||||
mesh_network_pdu_free(network_pdu);
|
mesh_network_pdu_free(network_pdu);
|
||||||
break;
|
break;
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
transport_pdu = (mesh_transport_pdu_t *) pdu;
|
|
||||||
mesh_transport_pdu_free(transport_pdu);
|
|
||||||
break;
|
|
||||||
case MESH_PDU_TYPE_SEGMENTED:
|
case MESH_PDU_TYPE_SEGMENTED:
|
||||||
message_pdu = (mesh_segmented_pdu_t *) pdu;
|
message_pdu = (mesh_segmented_pdu_t *) pdu;
|
||||||
mesh_message_pdu_free(message_pdu);
|
mesh_message_pdu_free(message_pdu);
|
||||||
default:
|
default:
|
||||||
|
btstack_assert(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ void mesh_upper_transport_pdu_free(mesh_pdu_t * pdu);
|
|||||||
void mesh_upper_transport_dump(void);
|
void mesh_upper_transport_dump(void);
|
||||||
void mesh_upper_transport_reset(void);
|
void mesh_upper_transport_reset(void);
|
||||||
|
|
||||||
// temp
|
// tmp
|
||||||
uint16_t mesh_access_dst(mesh_access_pdu_t * access_pdu);
|
uint16_t mesh_access_dst(mesh_access_pdu_t * access_pdu);
|
||||||
uint16_t mesh_access_ctl(mesh_access_pdu_t * access_pdu);
|
uint16_t mesh_access_ctl(mesh_access_pdu_t * access_pdu);
|
||||||
|
|
||||||
|
@ -105,8 +105,6 @@ static void gatt_bearer_emit_connected(void){
|
|||||||
// copy from mesh_message.c for now
|
// copy from mesh_message.c for now
|
||||||
uint16_t mesh_pdu_dst(mesh_pdu_t * pdu){
|
uint16_t mesh_pdu_dst(mesh_pdu_t * pdu){
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
return mesh_transport_dst((mesh_transport_pdu_t*) pdu);
|
|
||||||
case MESH_PDU_TYPE_NETWORK:
|
case MESH_PDU_TYPE_NETWORK:
|
||||||
return mesh_network_dst((mesh_network_pdu_t *) pdu);
|
return mesh_network_dst((mesh_network_pdu_t *) pdu);
|
||||||
case MESH_PDU_TYPE_UNSEGMENTED:
|
case MESH_PDU_TYPE_UNSEGMENTED:
|
||||||
@ -120,8 +118,6 @@ uint16_t mesh_pdu_dst(mesh_pdu_t * pdu){
|
|||||||
}
|
}
|
||||||
uint16_t mesh_pdu_ctl(mesh_pdu_t * pdu){
|
uint16_t mesh_pdu_ctl(mesh_pdu_t * pdu){
|
||||||
switch (pdu->pdu_type){
|
switch (pdu->pdu_type){
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
return mesh_transport_ctl((mesh_transport_pdu_t*) pdu);
|
|
||||||
case MESH_PDU_TYPE_NETWORK:
|
case MESH_PDU_TYPE_NETWORK:
|
||||||
return mesh_network_control((mesh_network_pdu_t *) pdu);
|
return mesh_network_control((mesh_network_pdu_t *) pdu);
|
||||||
case MESH_PDU_TYPE_ACCESS:
|
case MESH_PDU_TYPE_ACCESS:
|
||||||
@ -303,16 +299,18 @@ static void test_upper_transport_control_message_handler(mesh_transport_callback
|
|||||||
if (callback_type == MESH_TRANSPORT_PDU_SENT) return;
|
if (callback_type == MESH_TRANSPORT_PDU_SENT) return;
|
||||||
|
|
||||||
// process pdu received
|
// process pdu received
|
||||||
mesh_transport_pdu_t * transport_pdu;
|
|
||||||
mesh_network_pdu_t * network_pdu;
|
mesh_network_pdu_t * network_pdu;
|
||||||
mesh_unsegmented_pdu_t * unsegmented_incoming_pdu;
|
mesh_unsegmented_pdu_t * unsegmented_incoming_pdu;
|
||||||
switch(pdu->pdu_type){
|
switch(pdu->pdu_type){
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
case MESH_PDU_TYPE_TRANSPORT:
|
||||||
|
btstack_assert(false);
|
||||||
|
#if 0
|
||||||
transport_pdu = (mesh_transport_pdu_t *) pdu;
|
transport_pdu = (mesh_transport_pdu_t *) pdu;
|
||||||
printf("test MESH_CONTROL_TRANSPORT_PDU_RECEIVED\n");
|
printf("test MESH_CONTROL_TRANSPORT_PDU_RECEIVED\n");
|
||||||
recv_upper_transport_pdu_len = transport_pdu->len;
|
recv_upper_transport_pdu_len = transport_pdu->len;
|
||||||
memcpy(recv_upper_transport_pdu_data, transport_pdu->data, recv_upper_transport_pdu_len);
|
memcpy(recv_upper_transport_pdu_data, transport_pdu->data, recv_upper_transport_pdu_len);
|
||||||
mesh_upper_transport_message_processed_by_higher_layer(pdu);
|
mesh_upper_transport_message_processed_by_higher_layer(pdu);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case MESH_PDU_TYPE_UNSEGMENTED:
|
case MESH_PDU_TYPE_UNSEGMENTED:
|
||||||
unsegmented_incoming_pdu = (mesh_unsegmented_pdu_t *) pdu;
|
unsegmented_incoming_pdu = (mesh_unsegmented_pdu_t *) pdu;
|
||||||
|
@ -460,10 +460,11 @@ static void send_pts_segmented_access_messsage_virtual(void){
|
|||||||
uint16_t appkey_index = 0;
|
uint16_t appkey_index = 0;
|
||||||
|
|
||||||
// send as segmented access pdu
|
// send as segmented access pdu
|
||||||
mesh_transport_pdu_t * transport_pdu = mesh_transport_pdu_get();
|
static mesh_access_pdu_t segemented_access_pdu;
|
||||||
int status = mesh_upper_transport_setup_access_pdu((mesh_pdu_t*) transport_pdu, netkey_index, appkey_index, ttl, src, dest, 0, access_pdu_data, access_pdu_len);
|
mesh_pdu_t * pdu = (mesh_pdu_t *) &segemented_access_pdu;
|
||||||
|
int status = mesh_upper_transport_setup_access_pdu(pdu, netkey_index, appkey_index, ttl, src, dest, 0, access_pdu_data, access_pdu_len);
|
||||||
if (status) return;
|
if (status) return;
|
||||||
mesh_access_send_unacknowledged_pdu((mesh_pdu_t*) transport_pdu);
|
mesh_access_send_unacknowledged_pdu(pdu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_usage(void){
|
static void show_usage(void){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user