mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-26 20:37:19 +00:00
mesh: use mesh_upper_transport_pdu_t for all access messages, remove mesh_transport_pdu_t
This commit is contained in:
parent
53c7dafa1c
commit
039cbf1d6c
@ -946,52 +946,6 @@ void btstack_memory_mesh_network_pdu_free(mesh_network_pdu_t *mesh_network_pdu){
|
||||
#endif
|
||||
|
||||
|
||||
// MARK: mesh_transport_pdu_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_MESH_TRANSPORT_PDUS)
|
||||
#if defined(MAX_NO_MESH_TRANSPORT_PDUS)
|
||||
#error "Deprecated MAX_NO_MESH_TRANSPORT_PDUS defined instead of MAX_NR_MESH_TRANSPORT_PDUS. Please update your btstack_config.h to use MAX_NR_MESH_TRANSPORT_PDUS."
|
||||
#else
|
||||
#define MAX_NR_MESH_TRANSPORT_PDUS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MAX_NR_MESH_TRANSPORT_PDUS
|
||||
#if MAX_NR_MESH_TRANSPORT_PDUS > 0
|
||||
static mesh_transport_pdu_t mesh_transport_pdu_storage[MAX_NR_MESH_TRANSPORT_PDUS];
|
||||
static btstack_memory_pool_t mesh_transport_pdu_pool;
|
||||
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void){
|
||||
void * buffer = btstack_memory_pool_get(&mesh_transport_pdu_pool);
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(mesh_transport_pdu_t));
|
||||
}
|
||||
return (mesh_transport_pdu_t *) buffer;
|
||||
}
|
||||
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu){
|
||||
btstack_memory_pool_free(&mesh_transport_pdu_pool, mesh_transport_pdu);
|
||||
}
|
||||
#else
|
||||
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void){
|
||||
return NULL;
|
||||
}
|
||||
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu){
|
||||
// silence compiler warning about unused parameter in a portable way
|
||||
(void) mesh_transport_pdu;
|
||||
};
|
||||
#endif
|
||||
#elif defined(HAVE_MALLOC)
|
||||
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void){
|
||||
void * buffer = malloc(sizeof(mesh_transport_pdu_t));
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(mesh_transport_pdu_t));
|
||||
}
|
||||
return (mesh_transport_pdu_t *) buffer;
|
||||
}
|
||||
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu){
|
||||
free(mesh_transport_pdu);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// MARK: mesh_segmented_pdu_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_MESH_SEGMENTED_PDUS)
|
||||
#if defined(MAX_NO_MESH_SEGMENTED_PDUS)
|
||||
@ -1333,9 +1287,6 @@ void btstack_memory_init(void){
|
||||
#if MAX_NR_MESH_NETWORK_PDUS > 0
|
||||
btstack_memory_pool_create(&mesh_network_pdu_pool, mesh_network_pdu_storage, MAX_NR_MESH_NETWORK_PDUS, sizeof(mesh_network_pdu_t));
|
||||
#endif
|
||||
#if MAX_NR_MESH_TRANSPORT_PDUS > 0
|
||||
btstack_memory_pool_create(&mesh_transport_pdu_pool, mesh_transport_pdu_storage, MAX_NR_MESH_TRANSPORT_PDUS, sizeof(mesh_transport_pdu_t));
|
||||
#endif
|
||||
#if MAX_NR_MESH_SEGMENTED_PDUS > 0
|
||||
btstack_memory_pool_create(&mesh_segmented_pdu_pool, mesh_segmented_pdu_storage, MAX_NR_MESH_SEGMENTED_PDUS, sizeof(mesh_segmented_pdu_t));
|
||||
#endif
|
||||
|
@ -153,11 +153,9 @@ sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void);
|
||||
void btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry);
|
||||
#endif
|
||||
#ifdef ENABLE_MESH
|
||||
// mesh_network_pdu, mesh_transport_pdu, mesh_segmented_pdu, mesh_upper_transport_pdu, mesh_network_key, mesh_transport_key, mesh_virtual_address, mesh_subnet
|
||||
// mesh_network_pdu, mesh_segmented_pdu, mesh_upper_transport_pdu, mesh_network_key, mesh_transport_key, mesh_virtual_address, mesh_subnet
|
||||
mesh_network_pdu_t * btstack_memory_mesh_network_pdu_get(void);
|
||||
void btstack_memory_mesh_network_pdu_free(mesh_network_pdu_t *mesh_network_pdu);
|
||||
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void);
|
||||
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu);
|
||||
mesh_segmented_pdu_t * btstack_memory_mesh_segmented_pdu_get(void);
|
||||
void btstack_memory_mesh_segmented_pdu_free(mesh_segmented_pdu_t *mesh_segmented_pdu);
|
||||
mesh_upper_transport_pdu_t * btstack_memory_mesh_upper_transport_pdu_get(void);
|
||||
|
@ -384,48 +384,8 @@ static uint16_t mesh_access_src(mesh_access_pdu_t * access_pdu){
|
||||
return access_pdu->src;
|
||||
}
|
||||
|
||||
// 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){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return mesh_transport_ctl((mesh_transport_pdu_t*) pdu);
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return mesh_network_control((mesh_network_pdu_t *) pdu);
|
||||
default:
|
||||
@ -436,8 +396,6 @@ uint16_t mesh_pdu_ctl(mesh_pdu_t * pdu){
|
||||
|
||||
uint16_t mesh_pdu_ttl(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return mesh_transport_ttl((mesh_transport_pdu_t*) pdu);
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return mesh_network_ttl((mesh_network_pdu_t *) pdu);
|
||||
default:
|
||||
@ -450,8 +408,6 @@ uint16_t mesh_pdu_src(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_ACCESS:
|
||||
return mesh_access_src((mesh_access_pdu_t *) pdu);
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return mesh_transport_src((mesh_transport_pdu_t*) pdu);
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return mesh_network_src((mesh_network_pdu_t *) pdu);
|
||||
default:
|
||||
@ -465,8 +421,6 @@ uint16_t mesh_pdu_dst(mesh_pdu_t * pdu){
|
||||
case MESH_PDU_TYPE_ACCESS: {
|
||||
return ((mesh_access_pdu_t *) pdu)->dst;
|
||||
}
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return mesh_transport_dst((mesh_transport_pdu_t*) pdu);
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return mesh_network_dst((mesh_network_pdu_t *) pdu);
|
||||
default:
|
||||
@ -479,8 +433,6 @@ uint16_t mesh_pdu_netkey_index(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_ACCESS:
|
||||
return ((mesh_access_pdu_t*) pdu)->netkey_index;
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return ((mesh_transport_pdu_t*) pdu)->netkey_index;
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return ((mesh_network_pdu_t *) pdu)->netkey_index;
|
||||
default:
|
||||
@ -493,8 +445,6 @@ uint16_t mesh_pdu_appkey_index(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_ACCESS:
|
||||
return ((mesh_access_pdu_t*) pdu)->appkey_index;
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return ((mesh_transport_pdu_t*) pdu)->appkey_index;
|
||||
default:
|
||||
btstack_assert(false);
|
||||
return 0;
|
||||
@ -505,8 +455,6 @@ uint16_t mesh_pdu_len(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_ACCESS:
|
||||
return ((mesh_access_pdu_t*) pdu)->len;
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return ((mesh_transport_pdu_t*) pdu)->len;
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return ((mesh_network_pdu_t *) pdu)->len - 10;
|
||||
default:
|
||||
@ -519,8 +467,6 @@ uint8_t * mesh_pdu_data(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_ACCESS:
|
||||
return ((mesh_access_pdu_t*) pdu)->data;
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return ((mesh_transport_pdu_t*) pdu)->data;
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return &((mesh_network_pdu_t *) pdu)->data[10];
|
||||
default:
|
||||
@ -531,8 +477,6 @@ uint8_t * mesh_pdu_data(mesh_pdu_t * pdu){
|
||||
|
||||
uint8_t mesh_pdu_control_opcode(mesh_pdu_t * pdu){
|
||||
switch (pdu->pdu_type){
|
||||
case MESH_PDU_TYPE_TRANSPORT:
|
||||
return mesh_transport_control_opcode((mesh_transport_pdu_t*) pdu);
|
||||
case MESH_PDU_TYPE_NETWORK:
|
||||
return mesh_network_control_opcode((mesh_network_pdu_t *) pdu);
|
||||
default:
|
||||
@ -671,41 +615,48 @@ static int mesh_access_setup_opcode(uint8_t * buffer, uint32_t opcode){
|
||||
return 3;
|
||||
}
|
||||
|
||||
mesh_transport_pdu_t * mesh_access_transport_init(uint32_t opcode){
|
||||
mesh_transport_pdu_t * pdu = mesh_transport_pdu_get();
|
||||
mesh_upper_transport_pdu_t * mesh_access_transport_init(uint32_t opcode){
|
||||
mesh_upper_transport_pdu_t * pdu = btstack_memory_mesh_upper_transport_pdu_get();
|
||||
if (!pdu) return NULL;
|
||||
|
||||
btstack_assert(false);
|
||||
|
||||
// TODO: new types
|
||||
pdu->len = mesh_access_setup_opcode(pdu->data, opcode);
|
||||
// pdu->len = mesh_access_setup_opcode(pdu->data, opcode);
|
||||
// pdu->ack_opcode = MESH_ACCESS_OPCODE_NOT_SET;
|
||||
return pdu;
|
||||
}
|
||||
|
||||
void mesh_access_transport_add_uint8(mesh_transport_pdu_t * pdu, uint8_t value){
|
||||
pdu->data[pdu->len++] = value;
|
||||
void mesh_access_transport_add_uint8(mesh_upper_transport_pdu_t * pdu, uint8_t value){
|
||||
btstack_assert(false);
|
||||
// pdu->data[pdu->len++] = value;
|
||||
}
|
||||
|
||||
void mesh_access_transport_add_uint16(mesh_transport_pdu_t * pdu, uint16_t value){
|
||||
little_endian_store_16(pdu->data, pdu->len, value);
|
||||
pdu->len += 2;
|
||||
void mesh_access_transport_add_uint16(mesh_upper_transport_pdu_t * pdu, uint16_t value){
|
||||
btstack_assert(false);
|
||||
// little_endian_store_16(pdu->data, pdu->len, value);
|
||||
// pdu->len += 2;
|
||||
}
|
||||
|
||||
void mesh_access_transport_add_uint24(mesh_transport_pdu_t * pdu, uint32_t value){
|
||||
little_endian_store_24(pdu->data, pdu->len, value);
|
||||
pdu->len += 3;
|
||||
void mesh_access_transport_add_uint24(mesh_upper_transport_pdu_t * pdu, uint32_t value){
|
||||
btstack_assert(false);
|
||||
// little_endian_store_24(pdu->data, pdu->len, value);
|
||||
// pdu->len += 3;
|
||||
}
|
||||
|
||||
void mesh_access_transport_add_uint32(mesh_transport_pdu_t * pdu, uint32_t value){
|
||||
little_endian_store_32(pdu->data, pdu->len, value);
|
||||
pdu->len += 4;
|
||||
void mesh_access_transport_add_uint32(mesh_upper_transport_pdu_t * pdu, uint32_t value){
|
||||
btstack_assert(false);
|
||||
// little_endian_store_32(pdu->data, pdu->len, value);
|
||||
// pdu->len += 4;
|
||||
}
|
||||
|
||||
void mesh_access_transport_add_label_uuid(mesh_transport_pdu_t * pdu, uint8_t * value){
|
||||
(void)memcpy(value, pdu->data, 16);
|
||||
pdu->len += 16;
|
||||
void mesh_access_transport_add_label_uuid(mesh_upper_transport_pdu_t * pdu, uint8_t * value){
|
||||
btstack_assert(false);
|
||||
// (void)memcpy(value, pdu->data, 16);
|
||||
// pdu->len += 16;
|
||||
}
|
||||
|
||||
void mesh_access_transport_add_model_identifier(mesh_transport_pdu_t * pdu, uint32_t model_identifier){
|
||||
void mesh_access_transport_add_model_identifier(mesh_upper_transport_pdu_t * pdu, uint32_t model_identifier){
|
||||
if (!mesh_model_is_bluetooth_sig(model_identifier)){
|
||||
mesh_access_transport_add_uint16( pdu, mesh_model_get_vendor_id(model_identifier) );
|
||||
}
|
||||
@ -713,20 +664,23 @@ void mesh_access_transport_add_model_identifier(mesh_transport_pdu_t * pdu, uint
|
||||
}
|
||||
|
||||
// mesh_message_t builder
|
||||
mesh_segmented_pdu_t * mesh_access_message_init(uint32_t opcode, bool segmented, uint8_t num_segments){
|
||||
mesh_upper_transport_pdu_t * mesh_access_message_init(uint32_t opcode, bool segmented, uint8_t num_segments){
|
||||
btstack_assert(num_segments > 0);
|
||||
btstack_assert(segmented || (num_segments == 1));
|
||||
|
||||
mesh_segmented_pdu_t * pdu = mesh_message_pdu_get();
|
||||
mesh_upper_transport_pdu_t * pdu = btstack_memory_mesh_upper_transport_pdu_get();
|
||||
if (!pdu) return NULL;
|
||||
|
||||
btstack_assert(false);
|
||||
|
||||
pdu->pdu_header.pdu_type = MESH_PDU_TYPE_UNSEGMENTED;
|
||||
// TODO: handle segmented messages
|
||||
btstack_assert(segmented == false);
|
||||
|
||||
// use mesh_network_t as before
|
||||
mesh_network_pdu_t * segment = mesh_network_pdu_get();
|
||||
if (segment == NULL){
|
||||
mesh_message_pdu_free(pdu);
|
||||
btstack_memory_mesh_upper_transport_pdu_free(pdu);
|
||||
return NULL;
|
||||
}
|
||||
btstack_linked_list_add(&pdu->segments, (btstack_linked_item_t *) segment);
|
||||
@ -737,34 +691,34 @@ mesh_segmented_pdu_t * mesh_access_message_init(uint32_t opcode, bool segmented,
|
||||
return pdu;
|
||||
}
|
||||
|
||||
void mesh_access_message_add_uint8(mesh_segmented_pdu_t * pdu, uint8_t value){
|
||||
void mesh_access_message_add_uint8(mesh_upper_transport_pdu_t * pdu, uint8_t value){
|
||||
// TODO: handle segmented messages
|
||||
mesh_network_pdu_t * segment = (mesh_network_pdu_t *) btstack_linked_list_get_first_item(&pdu->segments);
|
||||
segment->data[pdu->len++] = value;
|
||||
}
|
||||
|
||||
void mesh_access_message_add_uint16(mesh_segmented_pdu_t * pdu, uint16_t value){
|
||||
void mesh_access_message_add_uint16(mesh_upper_transport_pdu_t * pdu, uint16_t value){
|
||||
// TODO: handle segmented messages
|
||||
mesh_network_pdu_t * segment = (mesh_network_pdu_t *) btstack_linked_list_get_first_item(&pdu->segments);
|
||||
little_endian_store_16(segment->data, pdu->len, value);
|
||||
pdu->len += 2;
|
||||
}
|
||||
|
||||
void mesh_access_message_add_uint24(mesh_segmented_pdu_t * pdu, uint16_t value){
|
||||
void mesh_access_message_add_uint24(mesh_upper_transport_pdu_t * pdu, uint16_t value){
|
||||
// TODO: handle segmented messages
|
||||
mesh_network_pdu_t * segment = (mesh_network_pdu_t *) btstack_linked_list_get_first_item(&pdu->segments);
|
||||
little_endian_store_24(segment->data, pdu->len, value);
|
||||
pdu->len += 3;
|
||||
}
|
||||
|
||||
void mesh_access_message_add_uint32(mesh_segmented_pdu_t * pdu, uint16_t value){
|
||||
void mesh_access_message_add_uint32(mesh_upper_transport_pdu_t * pdu, uint16_t value){
|
||||
// TODO: handle segmented messages
|
||||
mesh_network_pdu_t * segment = (mesh_network_pdu_t *) btstack_linked_list_get_first_item(&pdu->segments);
|
||||
little_endian_store_32(segment->data, pdu->len, value);
|
||||
pdu->len += 4;
|
||||
}
|
||||
|
||||
void mesh_access_message_add_model_identifier(mesh_segmented_pdu_t * pdu, uint32_t model_identifier){
|
||||
void mesh_access_message_add_model_identifier(mesh_upper_transport_pdu_t * pdu, uint32_t model_identifier){
|
||||
if (mesh_model_is_bluetooth_sig(model_identifier)){
|
||||
mesh_access_message_add_uint16( pdu, mesh_model_get_model_id(model_identifier) );
|
||||
} else {
|
||||
@ -773,11 +727,11 @@ void mesh_access_message_add_model_identifier(mesh_segmented_pdu_t * pdu, uint32
|
||||
}
|
||||
|
||||
// access message template
|
||||
mesh_segmented_pdu_t * mesh_access_setup_message(bool segmented, const mesh_access_message_t *message_template, ...){
|
||||
mesh_upper_transport_pdu_t * mesh_access_setup_message(bool segmented, const mesh_access_message_t *message_template, ...){
|
||||
btstack_assert(segmented == false);
|
||||
|
||||
// TODO: handle segmented messages
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_message_init(message_template->opcode, segmented, 1);
|
||||
mesh_upper_transport_pdu_t * message_pdu = mesh_access_message_init(message_template->opcode, segmented, 1);
|
||||
if (!message_pdu) return NULL;
|
||||
|
||||
va_list argptr;
|
||||
@ -822,8 +776,8 @@ mesh_segmented_pdu_t * mesh_access_setup_message(bool segmented, const mesh_acce
|
||||
return message_pdu;
|
||||
}
|
||||
|
||||
mesh_transport_pdu_t * mesh_access_setup_segmented_message(const mesh_access_message_t *message_template, ...){
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_transport_init(message_template->opcode);
|
||||
mesh_upper_transport_pdu_t * mesh_access_setup_segmented_message(const mesh_access_message_t *message_template, ...){
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_transport_init(message_template->opcode);
|
||||
if (!transport_pdu) return NULL;
|
||||
|
||||
va_list argptr;
|
||||
|
@ -248,24 +248,24 @@ uint32_t mesh_access_parser_get_sig_model_identifier(mesh_access_parser_state_t
|
||||
uint32_t mesh_access_parser_get_vendor_model_identifier(mesh_access_parser_state_t * parser);
|
||||
|
||||
// message builder transport
|
||||
mesh_transport_pdu_t * mesh_access_transport_init(uint32_t opcode);
|
||||
void mesh_access_transport_add_uint8(mesh_transport_pdu_t * pdu, uint8_t value);
|
||||
void mesh_access_transport_add_uint16(mesh_transport_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_transport_add_uint24(mesh_transport_pdu_t * pdu, uint32_t value);
|
||||
void mesh_access_transport_add_uint32(mesh_transport_pdu_t * pdu, uint32_t value);
|
||||
void mesh_access_transport_add_model_identifier(mesh_transport_pdu_t * pdu, uint32_t model_identifier);
|
||||
void mesh_access_transport_add_label_uuid(mesh_transport_pdu_t * pdu, uint8_t * value);
|
||||
mesh_upper_transport_pdu_t * mesh_access_transport_init(uint32_t opcode);
|
||||
void mesh_access_transport_add_uint8(mesh_upper_transport_pdu_t * pdu, uint8_t value);
|
||||
void mesh_access_transport_add_uint16(mesh_upper_transport_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_transport_add_uint24(mesh_upper_transport_pdu_t * pdu, uint32_t value);
|
||||
void mesh_access_transport_add_uint32(mesh_upper_transport_pdu_t * pdu, uint32_t value);
|
||||
void mesh_access_transport_add_model_identifier(mesh_upper_transport_pdu_t * pdu, uint32_t model_identifier);
|
||||
void mesh_access_transport_add_label_uuid(mesh_upper_transport_pdu_t * pdu, uint8_t * value);
|
||||
|
||||
mesh_segmented_pdu_t * mesh_access_message_init(uint32_t opcode, bool segmented, uint8_t num_segments);
|
||||
void mesh_access_message_add_uint8(mesh_segmented_pdu_t * pdu, uint8_t value);
|
||||
void mesh_access_message_add_uint16(mesh_segmented_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_message_add_uint24(mesh_segmented_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_message_add_uint32(mesh_segmented_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_message_add_model_identifier(mesh_segmented_pdu_t * pdu, uint32_t model_identifier);
|
||||
mesh_upper_transport_pdu_t * mesh_access_message_init(uint32_t opcode, bool segmented, uint8_t num_segments);
|
||||
void mesh_access_message_add_uint8(mesh_upper_transport_pdu_t * pdu, uint8_t value);
|
||||
void mesh_access_message_add_uint16(mesh_upper_transport_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_message_add_uint24(mesh_upper_transport_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_message_add_uint32(mesh_upper_transport_pdu_t * pdu, uint16_t value);
|
||||
void mesh_access_message_add_model_identifier(mesh_upper_transport_pdu_t * pdu, uint32_t model_identifier);
|
||||
|
||||
// message builder using template
|
||||
mesh_transport_pdu_t * mesh_access_setup_segmented_message(const mesh_access_message_t *message_template, ...);
|
||||
mesh_segmented_pdu_t * mesh_access_setup_message(bool segmented, const mesh_access_message_t *message_template, ...);
|
||||
mesh_upper_transport_pdu_t * mesh_access_setup_segmented_message(const mesh_access_message_t *message_template, ...);
|
||||
mesh_upper_transport_pdu_t * mesh_access_setup_message(bool segmented, const mesh_access_message_t *message_template, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
|
@ -342,10 +342,10 @@ uint8_t mesh_configuration_client_send_beacon_get(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_beacon_get);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_beacon_get);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_BEACON_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_BEACON_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -355,10 +355,10 @@ uint8_t mesh_configuration_client_send_beacon_set(mesh_model_t * mesh_model, uin
|
||||
|
||||
if (beacon > 1) return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_beacon_set, beacon);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_beacon_set, beacon);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_BEACON_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_BEACON_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -366,10 +366,10 @@ uint8_t mesh_configuration_client_send_composition_data_get(mesh_model_t * mesh_
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_composition_data_get, page);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_composition_data_get, page);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_COMPOSITION_DATA_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_COMPOSITION_DATA_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -377,10 +377,10 @@ uint8_t mesh_configuration_client_send_default_ttl_get(mesh_model_t * mesh_model
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_default_ttl_get);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_default_ttl_get);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_DEFAULT_TTL_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_DEFAULT_TTL_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -390,10 +390,10 @@ uint8_t mesh_configuration_client_send_default_ttl_set(mesh_model_t * mesh_model
|
||||
|
||||
if (ttl == 0x01 || ttl >= 0x80) return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_default_ttl_set, ttl);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_default_ttl_set, ttl);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_DEFAULT_TTL_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_DEFAULT_TTL_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -401,10 +401,10 @@ uint8_t mesh_configuration_client_send_gatt_proxy_get(mesh_model_t * mesh_model,
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_gatt_proxy_get);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_gatt_proxy_get);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_GATT_PROXY_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_GATT_PROXY_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -414,10 +414,10 @@ uint8_t mesh_configuration_client_send_gatt_proxy_set(mesh_model_t * mesh_model,
|
||||
|
||||
if (gatt_proxy_state > 2) return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_gatt_proxy_set, gatt_proxy_state);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_gatt_proxy_set, gatt_proxy_state);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_GATT_PROXY_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_GATT_PROXY_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -425,10 +425,10 @@ uint8_t mesh_configuration_client_send_relay_get(mesh_model_t * mesh_model, uint
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_relay_get);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_relay_get);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_RELAY_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_RELAY_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -439,10 +439,10 @@ uint8_t mesh_configuration_client_send_relay_set(mesh_model_t * mesh_model, uint
|
||||
if (relay_retransmit_count > 0x07) return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
if (relay_retransmit_interval_steps > 0x1F) return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_relay_set, relay, (relay_retransmit_count << 5) | relay_retransmit_interval_steps);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_relay_set, relay, (relay_retransmit_count << 5) | relay_retransmit_interval_steps);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_RELAY_SET);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_RELAY_SET);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -450,10 +450,10 @@ uint8_t mesh_configuration_client_send_model_publication_get(mesh_model_t * mesh
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_publication_get, dest, model_id);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_publication_get, dest, model_id);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_PUBLICATION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_PUBLICATION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ uint8_t mesh_configuration_client_send_model_publication_set(mesh_model_t * mesh
|
||||
return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
}
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_publication_set,
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_publication_set,
|
||||
dest,
|
||||
publication_config->publish_address_unicast,
|
||||
(publication_config->credential_flag << 12) | publication_config->appkey_index,
|
||||
@ -483,9 +483,9 @@ uint8_t mesh_configuration_client_send_model_publication_set(mesh_model_t * mesh
|
||||
publication_config->publish_period,
|
||||
(publication_config->publish_retransmit_interval_steps << 3) | publication_config->publish_retransmit_count,
|
||||
model_id);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_PUBLICATION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_PUBLICATION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
|
||||
}
|
||||
@ -499,7 +499,7 @@ uint8_t mesh_configuration_client_send_model_publication_virtual_address_set(mes
|
||||
return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
|
||||
}
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_publication_virtual_address_set,
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_publication_virtual_address_set,
|
||||
dest,
|
||||
publication_config->publish_address_virtual,
|
||||
(publication_config->credential_flag << 12) | publication_config->appkey_index,
|
||||
@ -518,10 +518,10 @@ uint8_t mesh_configuration_client_send_model_subscription_add(mesh_model_t * mes
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_add, dest, address, model_id);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_add, dest, address, model_id);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -529,7 +529,7 @@ uint8_t mesh_configuration_client_send_model_subscription_virtual_address_add(me
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_subscription_virtual_address_add, dest, address, model_id);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_subscription_virtual_address_add, dest, address, model_id);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
@ -540,10 +540,10 @@ uint8_t mesh_configuration_client_send_model_subscription_delete(mesh_model_t *
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_delete, dest, address, model_id);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_delete, dest, address, model_id);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -551,7 +551,7 @@ uint8_t mesh_configuration_client_send_model_subscription_virtual_address_delete
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_subscription_virtual_address_delete, dest, address, model_id);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_subscription_virtual_address_delete, dest, address, model_id);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
@ -562,10 +562,10 @@ uint8_t mesh_configuration_client_send_model_subscription_overwrite(mesh_model_t
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_overwrite, dest, address, model_id);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_overwrite, dest, address, model_id);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ uint8_t mesh_configuration_client_send_model_subscription_virtual_address_overwr
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_subscription_virtual_address_overwrite, dest, address, model_id);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_subscription_virtual_address_overwrite, dest, address, model_id);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
@ -584,10 +584,10 @@ uint8_t mesh_configuration_client_send_model_subscription_delete_all(mesh_model_
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_delete_all, dest, address, model_id);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_subscription_delete_all, dest, address, model_id);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_SUBSCRIPTION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -595,19 +595,19 @@ uint8_t mesh_configuration_client_send_model_subscription_get(mesh_model_t * mes
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = NULL;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = NULL;
|
||||
uint32_t ack_opcode = MESH_FOUNDATION_OPERATION_SIG_MODEL_SUBSCRIPTION_LIST;
|
||||
|
||||
if (mesh_model_is_bluetooth_sig(model_id)){
|
||||
message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_sig_model_subscription_get, dest, model_id);
|
||||
upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_sig_model_subscription_get, dest, model_id);
|
||||
} else {
|
||||
message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_vendor_model_subscription_get, dest, model_id);
|
||||
upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_vendor_model_subscription_get, dest, model_id);
|
||||
ack_opcode = MESH_FOUNDATION_OPERATION_VENDOR_MODEL_SUBSCRIPTION_LIST;
|
||||
}
|
||||
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, ack_opcode);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, ack_opcode);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ uint8_t mesh_configuration_client_send_netkey_add(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_add, index, netkey);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_add, index, netkey);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_NETKEY_STATUS);
|
||||
@ -626,7 +626,7 @@ uint8_t mesh_configuration_client_send_netkey_update(mesh_model_t * mesh_model,
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_update, index, netkey);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_update, index, netkey);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_NETKEY_STATUS);
|
||||
@ -637,7 +637,7 @@ uint8_t mesh_configuration_client_send_netkey_delete(mesh_model_t * mesh_model,
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_delete, index);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_delete, index);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_NETKEY_STATUS);
|
||||
@ -648,7 +648,7 @@ uint8_t mesh_configuration_client_send_netkey_get(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_get);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_netkey_get);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_NETKEY_LIST);
|
||||
@ -659,7 +659,7 @@ uint8_t mesh_configuration_client_send_appkey_add(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_add, netk_index << 12 | appk_index, appkey);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_add, netk_index << 12 | appk_index, appkey);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_APPKEY_STATUS);
|
||||
@ -670,7 +670,7 @@ uint8_t mesh_configuration_client_send_appkey_update(mesh_model_t * mesh_model,
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_update, netk_index << 12 | appk_index, appkey);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_update, netk_index << 12 | appk_index, appkey);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_APPKEY_STATUS);
|
||||
@ -681,7 +681,7 @@ uint8_t mesh_configuration_client_send_appkey_delete(mesh_model_t * mesh_model,
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_delete, netk_index << 12 | appk_index);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_delete, netk_index << 12 | appk_index);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_APPKEY_STATUS);
|
||||
@ -692,7 +692,7 @@ uint8_t mesh_configuration_client_send_appkey_get(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_get, netk_index);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_appkey_get, netk_index);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_APPKEY_LIST);
|
||||
@ -703,7 +703,7 @@ uint8_t mesh_configuration_client_send_node_identity_get(mesh_model_t * mesh_mod
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_node_identity_get, netk_index);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_node_identity_get, netk_index);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_NODE_IDENTITY_STATUS);
|
||||
@ -714,7 +714,7 @@ uint8_t mesh_configuration_client_send_node_identity_set(mesh_model_t * mesh_mod
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_node_identity_set, netk_index, node_identity_state);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_node_identity_set, netk_index, node_identity_state);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_NODE_IDENTITY_STATUS);
|
||||
@ -725,7 +725,7 @@ uint8_t mesh_configuration_client_send_model_app_bind_get(mesh_model_t * mesh_mo
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_app_bind, dest, appk_index, model_identifier);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_configuration_client_model_app_bind, dest, appk_index, model_identifier);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_FOUNDATION_OPERATION_MODEL_APP_STATUS);
|
||||
@ -736,10 +736,10 @@ uint8_t mesh_configuration_client_send_model_app_unbind_set(mesh_model_t * mesh_
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_app_unbind, dest, appk_index, model_identifier);
|
||||
if (!message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_model_app_unbind, dest, appk_index, model_identifier);
|
||||
if (!upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_MODEL_APP_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_MODEL_APP_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -747,17 +747,17 @@ uint8_t mesh_configuration_client_send_model_app_get(mesh_model_t * mesh_model,
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu;
|
||||
mesh_upper_transport_pdu_t * upper_pdu;
|
||||
uint32_t ack_opcode = MESH_FOUNDATION_OPERATION_SIG_MODEL_APP_LIST;
|
||||
|
||||
if (mesh_model_is_bluetooth_sig(model_identifier)){
|
||||
message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_sig_model_app_get, dest, model_identifier);
|
||||
upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_sig_model_app_get, dest, model_identifier);
|
||||
} else {
|
||||
message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_vendor_model_app_get, dest, model_identifier);
|
||||
upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_vendor_model_app_get, dest, model_identifier);
|
||||
ack_opcode = MESH_FOUNDATION_OPERATION_VENDOR_MODEL_APP_LIST;
|
||||
}
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, ack_opcode);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, ack_opcode);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -765,10 +765,10 @@ uint8_t mesh_configuration_client_send_node_reset(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_node_reset);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_node_reset);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_NODE_RESET_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_NODE_RESET_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -776,10 +776,10 @@ uint8_t mesh_configuration_client_send_friend_get(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_friend_get);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_friend_get);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_FRIEND_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_FRIEND_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -787,10 +787,10 @@ uint8_t mesh_configuration_client_send_friend_set(mesh_model_t * mesh_model, uin
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_friend_set, friend_state);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_friend_set, friend_state);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_FRIEND_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_FRIEND_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -798,10 +798,10 @@ uint8_t mesh_configuration_client_send_key_refresh_phase_get(mesh_model_t * mesh
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_key_refresh_phase_get, netk_index);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_key_refresh_phase_get, netk_index);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_KEY_REFRESH_PHASE_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_KEY_REFRESH_PHASE_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -809,10 +809,10 @@ uint8_t mesh_configuration_client_send_key_refresh_phase_set(mesh_model_t * mesh
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_key_refresh_phase_set, netk_index, transition);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_key_refresh_phase_set, netk_index, transition);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_KEY_REFRESH_PHASE_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_KEY_REFRESH_PHASE_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -820,10 +820,10 @@ uint8_t mesh_configuration_client_send_heartbeat_publication_get(mesh_model_t *
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_publication_get);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_publication_get);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_PUBLICATION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_PUBLICATION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ uint8_t mesh_configuration_client_send_heartbeat_publication_set(mesh_model_t *
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_publication_set,
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_publication_set,
|
||||
publication_state.destination,
|
||||
mesh_heartbeat_period_log(publication_state.count),
|
||||
mesh_heartbeat_period_log(publication_state.period_s),
|
||||
@ -839,9 +839,9 @@ uint8_t mesh_configuration_client_send_heartbeat_publication_set(mesh_model_t *
|
||||
publication_state.features,
|
||||
publication_state.netkey_index);
|
||||
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_PUBLICATION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_PUBLICATION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -849,10 +849,10 @@ uint8_t mesh_configuration_client_send_heartbeat_subscription_get(mesh_model_t *
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_subscription_get);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_subscription_get);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_SUBSCRIPTION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_SUBSCRIPTION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -860,10 +860,10 @@ uint8_t mesh_configuration_client_send_heartbeat_subscription_set(mesh_model_t *
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_subscription_set, heartbeat_source, heartbeat_destination, mesh_heartbeat_period_log(period_s));
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_heartbeat_subscription_set, heartbeat_source, heartbeat_destination, mesh_heartbeat_period_log(period_s));
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_SUBSCRIPTION_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_HEARTBEAT_SUBSCRIPTION_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -871,10 +871,10 @@ uint8_t mesh_configuration_client_send_low_power_node_poll_timeout_get(mesh_mode
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_client_low_power_node_poll_timeout_get);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_client_low_power_node_poll_timeout_get);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_LOW_POWER_NODE_POLL_TIMEOUT_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_LOW_POWER_NODE_POLL_TIMEOUT_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -882,10 +882,10 @@ uint8_t mesh_configuration_client_send_network_transmit_get(mesh_model_t * mesh_
|
||||
uint8_t status = mesh_access_validate_envelop_params(mesh_model, dest, netkey_index, appkey_index);
|
||||
if (status != ERROR_CODE_SUCCESS) return status;
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_network_transmit_get);
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_network_transmit_get);
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_NETWORK_TRANSMIT_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_NETWORK_TRANSMIT_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -898,10 +898,10 @@ uint8_t mesh_configuration_client_send_network_transmit_set(mesh_model_t * mesh_
|
||||
transmit_interval_steps_10ms -= 1;
|
||||
}
|
||||
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_configuration_network_transmit_set, (transmit_count << 5) | (transmit_interval_steps_10ms & 0x1F));
|
||||
if (message_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
mesh_upper_transport_pdu_t * upper_pdu = mesh_access_setup_message(false, &mesh_configuration_network_transmit_set, (transmit_count << 5) | (transmit_interval_steps_10ms & 0x1F));
|
||||
if (upper_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) message_pdu, MESH_FOUNDATION_OPERATION_NETWORK_TRANSMIT_STATUS);
|
||||
mesh_configuration_client_send_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) upper_pdu, MESH_FOUNDATION_OPERATION_NETWORK_TRANSMIT_STATUS);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ static void config_composition_data_status(uint16_t netkey_index, uint16_t dest)
|
||||
|
||||
printf("Received Config Composition Data Get -> send Config Composition Data Status\n");
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_transport_init(MESH_FOUNDATION_OPERATION_COMPOSITION_DATA_STATUS);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_transport_init(MESH_FOUNDATION_OPERATION_COMPOSITION_DATA_STATUS);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
// page 0
|
||||
@ -313,7 +313,7 @@ static void config_composition_data_get_handler(mesh_model_t *mesh_model, mesh_p
|
||||
static void config_model_beacon_status(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest){
|
||||
UNUSED(mesh_model);
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_beacon_status,
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_beacon_status,
|
||||
mesh_foundation_beacon_get());
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -349,7 +349,7 @@ static void config_beacon_set_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu
|
||||
static void config_model_default_ttl_status(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest){
|
||||
UNUSED(mesh_model);
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_default_ttl_status, mesh_foundation_default_ttl_get());
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -387,7 +387,7 @@ static void config_friend_status(mesh_model_t * mesh_model, uint16_t netkey_inde
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_friend_status, mesh_foundation_friend_get());
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -426,7 +426,7 @@ static void config_friend_set_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu
|
||||
static void config_model_gatt_proxy_status(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest){
|
||||
UNUSED(mesh_model);
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_gatt_proxy_status, mesh_foundation_gatt_proxy_get());
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_gatt_proxy_status, mesh_foundation_gatt_proxy_get());
|
||||
if (!transport_pdu) return;
|
||||
|
||||
// send as segmented access pdu
|
||||
@ -465,7 +465,7 @@ static void config_model_relay_status(mesh_model_t * mesh_model, uint16_t netkey
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_relay_status,
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_relay_status,
|
||||
mesh_foundation_relay_get(),
|
||||
mesh_foundation_relay_retransmit_get());
|
||||
if (!transport_pdu) return;
|
||||
@ -512,7 +512,7 @@ static void config_model_network_transmit_status(mesh_model_t * mesh_model, uint
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_network_transmit_status, mesh_foundation_network_transmit_get());
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -552,7 +552,7 @@ static void config_netkey_status(mesh_model_t * mesh_model, uint16_t netkey_inde
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_netkey_status, status, new_netkey_index);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -563,7 +563,7 @@ static void config_netkey_status(mesh_model_t * mesh_model, uint16_t netkey_inde
|
||||
static void config_netkey_list(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest) {
|
||||
UNUSED(mesh_model);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_transport_init(MESH_FOUNDATION_OPERATION_NETKEY_LIST);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_transport_init(MESH_FOUNDATION_OPERATION_NETKEY_LIST);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
// add list of netkey indexes
|
||||
@ -789,7 +789,7 @@ static void config_appkey_status(mesh_model_t * mesh_model, uint16_t netkey_inde
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_appkey_status,
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_appkey_status,
|
||||
status, netkey_and_appkey_index);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -800,7 +800,7 @@ static void config_appkey_status(mesh_model_t * mesh_model, uint16_t netkey_inde
|
||||
static void config_appkey_list(mesh_model_t * mesh_model, uint16_t netkey_index, uint16_t dest, uint32_t netkey_index_of_list){
|
||||
UNUSED(mesh_model);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_transport_init(MESH_FOUNDATION_OPERATION_APPKEY_LIST);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_transport_init(MESH_FOUNDATION_OPERATION_APPKEY_LIST);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
// check netkey_index is valid
|
||||
@ -1034,7 +1034,7 @@ static void config_model_subscription_list(mesh_model_t * mesh_model, uint16_t n
|
||||
opcode = MESH_FOUNDATION_OPERATION_VENDOR_MODEL_SUBSCRIPTION_LIST;
|
||||
}
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_transport_init(opcode);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_transport_init(opcode);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
// setup segmented message
|
||||
@ -1076,7 +1076,7 @@ static void config_model_subscription_status(mesh_model_t * mesh_model, uint16_t
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_model_subscription_status,
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_model_subscription_status,
|
||||
status, element_address, address, model_identifier);
|
||||
if (!transport_pdu) return;
|
||||
// send as segmented access pdu
|
||||
@ -1327,7 +1327,7 @@ static void config_model_app_status(mesh_model_t * mesh_model, uint16_t netkey_i
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_model_app_status,
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_config_model_app_status,
|
||||
status, element_address, appkey_index, model_identifier);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
@ -1344,7 +1344,7 @@ static void config_model_app_list(mesh_model_t * config_server_model, uint16_t n
|
||||
} else {
|
||||
opcode = MESH_FOUNDATION_OPERATION_VENDOR_MODEL_APP_LIST;
|
||||
}
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_transport_init(opcode);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_transport_init(opcode);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
mesh_access_transport_add_uint8(transport_pdu, status);
|
||||
@ -1511,7 +1511,7 @@ config_model_publication_status(mesh_model_t *mesh_model, uint16_t netkey_index,
|
||||
}
|
||||
}
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_model_publication_status, status, element_address, publish_address,
|
||||
app_key_index_and_credential_flag, ttl, period, retransmit, model_identifier);
|
||||
if (!transport_pdu) return;
|
||||
@ -1787,7 +1787,7 @@ static void config_heartbeat_publication_status(mesh_model_t *mesh_model, uint16
|
||||
|
||||
// setup message
|
||||
uint8_t count_log = mesh_heartbeat_count_log(mesh_heartbeat_publication->count);
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_heartbeat_publication_status,
|
||||
status,
|
||||
mesh_heartbeat_publication->destination,
|
||||
@ -1886,7 +1886,7 @@ static void config_heartbeat_subscription_status(mesh_model_t *mesh_model, uint1
|
||||
|
||||
// setup message
|
||||
uint8_t count_log = mesh_heartbeat_count_log(mesh_heartbeat_subscription->count);
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_config_heartbeat_subscription_status,
|
||||
status,
|
||||
mesh_heartbeat_subscription->source,
|
||||
@ -2030,7 +2030,7 @@ static void config_key_refresh_phase_status(mesh_model_t *mesh_model, uint16_t n
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_key_refresh_phase_status,
|
||||
status,
|
||||
netkey_index,
|
||||
@ -2109,7 +2109,7 @@ static void config_node_reset_status(mesh_model_t *mesh_model, uint16_t netkey_i
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_node_reset_status);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_foundation_node_reset_status);
|
||||
if (!transport_pdu) return;
|
||||
|
||||
// send as segmented access pdu
|
||||
@ -2125,7 +2125,7 @@ static void config_node_reset_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu
|
||||
static void low_power_node_poll_timeout_status(mesh_model_t *mesh_model, uint16_t netkey_index_dest, uint16_t dest, uint8_t status){
|
||||
UNUSED(mesh_model);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_low_power_node_poll_timeout_status,
|
||||
status,
|
||||
0, // The unicast address of the Low Power node
|
||||
@ -2150,7 +2150,7 @@ static void config_node_identity_status(mesh_model_t *mesh_model, uint16_t netke
|
||||
UNUSED(mesh_model);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(
|
||||
&mesh_foundation_node_identity_status,
|
||||
status,
|
||||
netkey_index,
|
||||
|
@ -85,7 +85,7 @@ static void generic_client_send_message_acknowledged(uint16_t src, uint16_t dest
|
||||
|
||||
uint8_t mesh_generic_default_transition_time_client_get(mesh_model_t *mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index){
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_default_transition_time_get);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_default_transition_time_get);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
// send as segmented access pdu
|
||||
generic_client_send_message_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_GENERIC_DEFAULT_TRANSITION_TIME_STATUS);
|
||||
@ -95,7 +95,7 @@ uint8_t mesh_generic_default_transition_time_client_get(mesh_model_t *mesh_model
|
||||
uint8_t mesh_generic_default_transition_time_client_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index,
|
||||
uint8_t transition_time_gdtt){
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu;
|
||||
mesh_upper_transport_pdu_t * transport_pdu;
|
||||
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_default_transition_time_set, transition_time_gdtt);
|
||||
|
||||
@ -107,7 +107,7 @@ uint8_t mesh_generic_default_transition_time_client_set(mesh_model_t * mesh_mode
|
||||
|
||||
uint8_t mesh_generic_default_transition_time_client_set_unacknowledged(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index,
|
||||
uint8_t transition_time_gdtt){
|
||||
mesh_transport_pdu_t * transport_pdu;
|
||||
mesh_upper_transport_pdu_t * transport_pdu;
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_default_transition_time_set_unacknowledged, transition_time_gdtt);
|
||||
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
|
@ -71,7 +71,7 @@ static mesh_pdu_t * mesh_generic_default_transition_time_status_message(mesh_mod
|
||||
|
||||
mesh_generic_default_transition_time_state_t * state = (mesh_generic_default_transition_time_state_t *) generic_default_transition_time_server_model->model_data;
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = NULL;
|
||||
mesh_upper_transport_pdu_t * transport_pdu = NULL;
|
||||
|
||||
log_info("Default transition time status: value %u", state->value);
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_default_transition_time_status, state->value);
|
||||
@ -80,7 +80,7 @@ static mesh_pdu_t * mesh_generic_default_transition_time_status_message(mesh_mod
|
||||
}
|
||||
|
||||
static void generic_default_transition_time_get_handler(mesh_model_t *generic_default_transition_time_server_model, mesh_pdu_t * pdu){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_default_transition_time_status_message(generic_default_transition_time_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_default_transition_time_status_message(generic_default_transition_time_server_model);
|
||||
if (!transport_pdu) return;
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_default_transition_time_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -107,7 +107,7 @@ static bool generic_default_transition_time_handle_set_message(mesh_model_t *mes
|
||||
static void generic_default_transition_time_set_handler(mesh_model_t *generic_default_transition_time_server_model, mesh_pdu_t * pdu){
|
||||
bool send_status = generic_default_transition_time_handle_set_message(generic_default_transition_time_server_model, pdu);
|
||||
if (send_status){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_default_transition_time_status_message(generic_default_transition_time_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_default_transition_time_status_message(generic_default_transition_time_server_model);
|
||||
if (transport_pdu) {
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_default_transition_time_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ static inline uint8_t mesh_generic_level_client_set_value(mesh_model_t * mesh_mo
|
||||
uint16_t dest, uint16_t netkey_index, uint16_t appkey_index,
|
||||
int16_t value, uint8_t transition_time_gdtt, uint8_t delay_time_gdtt, uint8_t transaction_id, uint8_t acknowledged){
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu;
|
||||
mesh_upper_transport_pdu_t * transport_pdu;
|
||||
if (transition_time_gdtt != 0) {
|
||||
transport_pdu = mesh_access_setup_segmented_message(message_template_with_transition, value, transaction_id, transition_time_gdtt, delay_time_gdtt);
|
||||
} else {
|
||||
@ -151,7 +151,7 @@ static inline uint8_t mesh_generic_level_client_set_value(mesh_model_t * mesh_mo
|
||||
|
||||
uint8_t mesh_generic_level_client_level_get(mesh_model_t *mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index){
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_level_get);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_level_get);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
// send as segmented access pdu
|
||||
generic_client_send_message_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_GENERIC_LEVEL_STATUS);
|
||||
|
@ -141,7 +141,7 @@ static mesh_pdu_t * mesh_generic_level_status_message(mesh_model_t *generic_leve
|
||||
btstack_assert(state != NULL);
|
||||
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = NULL;
|
||||
mesh_upper_transport_pdu_t * transport_pdu = NULL;
|
||||
if (state->transition_data.base_transition.num_steps > 0) {
|
||||
uint8_t remaining_time = (((uint8_t)state->transition_data.base_transition.step_resolution) << 6) | (state->transition_data.base_transition.num_steps);
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_level_status_transition, state->transition_data.current_value,
|
||||
@ -290,7 +290,7 @@ static void generic_level_handle_set_move_message(mesh_model_t *mesh_model, mesh
|
||||
}
|
||||
|
||||
static void generic_level_get_handler(mesh_model_t *generic_level_server_model, mesh_pdu_t * pdu){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
if (transport_pdu != NULL) {
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_level_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu), (mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
@ -300,7 +300,7 @@ static void generic_level_get_handler(mesh_model_t *generic_level_server_model,
|
||||
static void generic_level_set_handler(mesh_model_t *generic_level_server_model, mesh_pdu_t * pdu){
|
||||
generic_level_handle_set_target_level_message(generic_level_server_model, pdu);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
if (transport_pdu != NULL) {
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_level_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu), (mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
@ -315,7 +315,7 @@ static void generic_level_set_unacknowledged_handler(mesh_model_t *generic_level
|
||||
static void generic_delta_set_handler(mesh_model_t *generic_level_server_model, mesh_pdu_t * pdu){
|
||||
generic_level_handle_set_delta_message(generic_level_server_model, pdu);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
if (transport_pdu != NULL) {
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_level_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu), (mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
@ -330,7 +330,7 @@ static void generic_delta_set_unacknowledged_handler(mesh_model_t *generic_level
|
||||
static void generic_move_get_handler(mesh_model_t *generic_level_server_model, mesh_pdu_t * pdu){
|
||||
generic_level_handle_set_move_message(generic_level_server_model, pdu);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_level_status_message(generic_level_server_model);
|
||||
if (transport_pdu != NULL) {
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_level_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu), (mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ static void generic_client_send_message_acknowledged(uint16_t src, uint16_t dest
|
||||
|
||||
uint8_t mesh_generic_on_off_client_get(mesh_model_t *mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index){
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_on_off_get);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_on_off_get);
|
||||
if (!transport_pdu) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
// send as segmented access pdu
|
||||
generic_client_send_message_acknowledged(mesh_access_get_element_address(mesh_model), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu, MESH_GENERIC_ON_OFF_STATUS);
|
||||
@ -103,7 +103,7 @@ uint8_t mesh_generic_on_off_client_get(mesh_model_t *mesh_model, uint16_t dest,
|
||||
uint8_t mesh_generic_on_off_client_set(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index,
|
||||
uint8_t on_off_value, uint8_t transition_time_gdtt, uint8_t delay_time_gdtt, uint8_t transaction_id){
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu;
|
||||
mesh_upper_transport_pdu_t * transport_pdu;
|
||||
if (transition_time_gdtt != 0) {
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_on_off_set_with_transition, on_off_value, transaction_id, transition_time_gdtt, delay_time_gdtt);
|
||||
} else {
|
||||
@ -117,7 +117,7 @@ uint8_t mesh_generic_on_off_client_set(mesh_model_t * mesh_model, uint16_t dest,
|
||||
|
||||
uint8_t mesh_generic_on_off_client_set_unacknowledged(mesh_model_t * mesh_model, uint16_t dest, uint16_t netkey_index, uint16_t appkey_index,
|
||||
uint8_t on_off_value, uint8_t transition_time_gdtt, uint8_t delay_time_gdtt, uint8_t transaction_id){
|
||||
mesh_transport_pdu_t * transport_pdu;
|
||||
mesh_upper_transport_pdu_t * transport_pdu;
|
||||
if (transition_time_gdtt != 0) {
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_on_off_set_unacknowledged_with_transition, on_off_value, transaction_id, transition_time_gdtt, delay_time_gdtt);
|
||||
} else {
|
||||
|
@ -122,7 +122,7 @@ static mesh_pdu_t * mesh_generic_on_off_status_message(mesh_model_t *generic_on_
|
||||
|
||||
mesh_generic_on_off_state_t * state = (mesh_generic_on_off_state_t *) generic_on_off_server_model->model_data;
|
||||
// setup message
|
||||
mesh_transport_pdu_t * transport_pdu = NULL;
|
||||
mesh_upper_transport_pdu_t * transport_pdu = NULL;
|
||||
if (state->transition_data.base_transition.num_steps > 0) {
|
||||
uint8_t remaining_time = (((uint8_t)state->transition_data.base_transition.step_resolution) << 6) | (state->transition_data.base_transition.num_steps);
|
||||
transport_pdu = mesh_access_setup_segmented_message(&mesh_generic_on_off_status_transition, state->transition_data.current_value,
|
||||
@ -135,7 +135,7 @@ static mesh_pdu_t * mesh_generic_on_off_status_message(mesh_model_t *generic_on_
|
||||
}
|
||||
|
||||
static void generic_on_off_get_handler(mesh_model_t *generic_on_off_server_model, mesh_pdu_t * pdu){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_on_off_status_message(generic_on_off_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_on_off_status_message(generic_on_off_server_model);
|
||||
if (!transport_pdu) return;
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_on_off_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -184,7 +184,7 @@ static bool generic_on_off_handle_set_message(mesh_model_t *mesh_model, mesh_pdu
|
||||
static void generic_on_off_set_handler(mesh_model_t *generic_on_off_server_model, mesh_pdu_t * pdu){
|
||||
bool send_status = generic_on_off_handle_set_message(generic_on_off_server_model, pdu);
|
||||
if (send_status){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) mesh_generic_on_off_status_message(generic_on_off_server_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) mesh_generic_on_off_status_message(generic_on_off_server_model);
|
||||
if (transport_pdu) {
|
||||
generic_server_send_message(mesh_access_get_element_address(generic_on_off_server_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
|
@ -108,19 +108,19 @@ const mesh_access_message_t mesh_foundation_health_attention_status = {
|
||||
static mesh_pdu_t * health_period_status(mesh_model_t * mesh_model){
|
||||
mesh_health_state_t * state = (mesh_health_state_t *) mesh_model->model_data;
|
||||
// setup message
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_foundation_health_period_status, state->fast_period_divisor);
|
||||
mesh_upper_transport_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_foundation_health_period_status, state->fast_period_divisor);
|
||||
return (mesh_pdu_t *) message_pdu;
|
||||
}
|
||||
|
||||
static mesh_pdu_t * health_attention_status(void){
|
||||
// setup message
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_foundation_health_attention_status, mesh_attention_timer_get());
|
||||
mesh_upper_transport_pdu_t * message_pdu = mesh_access_setup_message(false, &mesh_foundation_health_attention_status, mesh_attention_timer_get());
|
||||
return (mesh_pdu_t *) message_pdu;
|
||||
}
|
||||
|
||||
// report fault status - used for both current as well as registered faults, see registered_faults param
|
||||
static mesh_pdu_t * health_fault_status(mesh_model_t * mesh_model, uint32_t opcode, uint16_t company_id, bool registered_faults){
|
||||
mesh_segmented_pdu_t * message_pdu = mesh_access_message_init(opcode, false, 1);
|
||||
mesh_upper_transport_pdu_t * message_pdu = mesh_access_message_init(opcode, false, 1);
|
||||
if (!message_pdu) return NULL;
|
||||
|
||||
mesh_health_fault_t * fault = mesh_health_server_fault_for_company_id(mesh_model, company_id);
|
||||
@ -150,7 +150,7 @@ static void health_fault_get_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu)
|
||||
mesh_access_parser_init(&parser, (mesh_pdu_t*) pdu);
|
||||
uint16_t company_id = mesh_access_parser_get_u16(&parser);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_fault_status(mesh_model, MESH_FOUNDATION_OPERATION_HEALTH_FAULT_STATUS, company_id, true);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_fault_status(mesh_model, MESH_FOUNDATION_OPERATION_HEALTH_FAULT_STATUS, company_id, true);
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_access_get_element_address(mesh_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -172,7 +172,7 @@ static uint16_t process_message_fault_clear(mesh_model_t *mesh_model, mesh_pdu_t
|
||||
static void health_fault_clear_handler(mesh_model_t * mesh_model, mesh_pdu_t * pdu){
|
||||
uint16_t company_id = process_message_fault_clear(mesh_model, pdu);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_fault_status(mesh_model, MESH_FOUNDATION_OPERATION_HEALTH_FAULT_STATUS, company_id, true);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_fault_status(mesh_model, MESH_FOUNDATION_OPERATION_HEALTH_FAULT_STATUS, company_id, true);
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_access_get_element_address(mesh_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -240,7 +240,7 @@ static void health_fault_test_unacknowledged_handler(mesh_model_t * mesh_model,
|
||||
}
|
||||
|
||||
static void health_period_get_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_period_status(mesh_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_period_status(mesh_model);
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_access_get_element_address(mesh_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -260,7 +260,7 @@ static void process_message_period_set(mesh_model_t *mesh_model, mesh_pdu_t * pd
|
||||
static void health_period_set_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
|
||||
process_message_period_set(mesh_model, pdu);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_period_status(mesh_model);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_period_status(mesh_model);
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_access_get_element_address(mesh_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -272,7 +272,7 @@ static void health_period_set_unacknowledged_handler(mesh_model_t *mesh_model, m
|
||||
}
|
||||
|
||||
static void health_attention_get_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_attention_status();
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_attention_status();
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_access_get_element_address(mesh_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -302,7 +302,7 @@ static void process_message_attention_set(mesh_model_t *mesh_model, mesh_pdu_t *
|
||||
static void health_attention_set_handler(mesh_model_t *mesh_model, mesh_pdu_t * pdu){
|
||||
process_message_attention_set(mesh_model, pdu);
|
||||
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_attention_status();
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_attention_status();
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_access_get_element_address(mesh_model), mesh_pdu_src(pdu), mesh_pdu_netkey_index(pdu), mesh_pdu_appkey_index(pdu),(mesh_pdu_t *) transport_pdu);
|
||||
mesh_access_message_processed(pdu);
|
||||
@ -434,7 +434,7 @@ void mesh_health_server_report_test_done(uint16_t dest, uint16_t netkey_index, u
|
||||
|
||||
// response for acknowledged health fault test
|
||||
if (acknowledged){
|
||||
mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t *) health_fault_status(mesh_model, MESH_FOUNDATION_OPERATION_HEALTH_FAULT_STATUS, company_id, company_id);
|
||||
mesh_upper_transport_pdu_t * transport_pdu = (mesh_upper_transport_pdu_t *) health_fault_status(mesh_model, MESH_FOUNDATION_OPERATION_HEALTH_FAULT_STATUS, company_id, company_id);
|
||||
if (!transport_pdu) return;
|
||||
health_server_send_message(mesh_node_get_primary_element_address(), dest, netkey_index, appkey_index, (mesh_pdu_t *) transport_pdu);
|
||||
}
|
||||
|
@ -968,16 +968,3 @@ void mesh_lower_transport_init(){
|
||||
void mesh_lower_transport_set_higher_layer_handler(void (*pdu_handler)( mesh_transport_callback_type_t callback_type, mesh_transport_status_t status, mesh_pdu_t * pdu)){
|
||||
higher_layer_handler = pdu_handler;
|
||||
}
|
||||
|
||||
// buffer pool
|
||||
mesh_transport_pdu_t * mesh_transport_pdu_get(void){
|
||||
mesh_transport_pdu_t * transport_pdu = btstack_memory_mesh_transport_pdu_get();
|
||||
if (transport_pdu){
|
||||
transport_pdu->pdu_header.pdu_type = MESH_PDU_TYPE_TRANSPORT;
|
||||
}
|
||||
return transport_pdu;
|
||||
}
|
||||
|
||||
void mesh_transport_pdu_free(mesh_transport_pdu_t * transport_pdu){
|
||||
btstack_memory_mesh_transport_pdu_free(transport_pdu);
|
||||
}
|
||||
|
@ -75,10 +75,6 @@ typedef enum {
|
||||
MESH_TRANSPORT_STATUS_SEND_ABORT_BY_REMOTE,
|
||||
} mesh_transport_status_t;
|
||||
|
||||
// allocator
|
||||
mesh_transport_pdu_t * mesh_transport_pdu_get(void);
|
||||
void mesh_transport_pdu_free(mesh_transport_pdu_t * transport_pdu);
|
||||
|
||||
mesh_segmented_pdu_t * mesh_message_pdu_get(void);
|
||||
void mesh_message_pdu_free(mesh_segmented_pdu_t * message_pdu);
|
||||
|
||||
|
@ -147,26 +147,6 @@ typedef struct {
|
||||
btstack_linked_list_t segments;
|
||||
} mesh_segmented_pdu_t;
|
||||
|
||||
typedef struct {
|
||||
mesh_pdu_t pdu_header;
|
||||
|
||||
// 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 {
|
||||
// generic pdu header
|
||||
mesh_pdu_t pdu_header;
|
||||
|
@ -418,7 +418,7 @@ static void send_pts_segmented_access_messsage_unicast(void){
|
||||
uint16_t appkey_index = 0; // MESH_DEVICE_KEY_INDEX;
|
||||
|
||||
// send as segmented access pdu
|
||||
mesh_pdu_t * pdu = (mesh_pdu_t *) mesh_transport_pdu_get();
|
||||
mesh_pdu_t * pdu = (mesh_pdu_t *) btstack_memory_mesh_upper_transport_pdu_get();
|
||||
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;
|
||||
mesh_access_send_unacknowledged_pdu(pdu);
|
||||
@ -439,7 +439,7 @@ static void send_pts_segmented_access_messsage_group(void){
|
||||
uint16_t appkey_index = 0;
|
||||
|
||||
// send as segmented access pdu
|
||||
mesh_pdu_t * pdu = (mesh_pdu_t *) mesh_transport_pdu_get();
|
||||
mesh_pdu_t * pdu = (mesh_pdu_t *) btstack_memory_mesh_upper_transport_pdu_get();
|
||||
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;
|
||||
mesh_access_send_unacknowledged_pdu(pdu);
|
||||
|
@ -213,7 +213,7 @@ list_of_le_structs = [
|
||||
["gatt_client", "whitelist_entry", "sm_lookup_entry"],
|
||||
]
|
||||
list_of_mesh_structs = [
|
||||
['mesh_network_pdu', 'mesh_transport_pdu', 'mesh_segmented_pdu', 'mesh_upper_transport_pdu', 'mesh_network_key', 'mesh_transport_key', 'mesh_virtual_address', 'mesh_subnet']
|
||||
['mesh_network_pdu', 'mesh_segmented_pdu', 'mesh_upper_transport_pdu', 'mesh_network_key', 'mesh_transport_key', 'mesh_virtual_address', 'mesh_subnet']
|
||||
]
|
||||
|
||||
btstack_root = os.path.abspath(os.path.dirname(sys.argv[0]) + '/..')
|
||||
|
Loading…
x
Reference in New Issue
Block a user