mesh: rename mesh_network_key_iterator into mesh_network_key_nid_iterator

This commit is contained in:
Matthias Ringwald 2019-04-23 18:59:19 +02:00
parent 13894af284
commit 1f32e0a720
3 changed files with 9 additions and 9 deletions

View File

@ -498,14 +498,14 @@ static void process_network_pdu_validate_b(void * arg){
} }
static void process_network_pdu_validate(mesh_network_pdu_t * network_pdu){ static void process_network_pdu_validate(mesh_network_pdu_t * network_pdu){
if (!mesh_network_key_iterator_has_more(&validation_network_key_it)){ if (!mesh_network_key_nid_iterator_has_more(&validation_network_key_it)){
printf("No valid network key found\n"); printf("No valid network key found\n");
btstack_memory_mesh_network_pdu_free(network_pdu); btstack_memory_mesh_network_pdu_free(network_pdu);
process_network_pdu_done(); process_network_pdu_done();
return; return;
} }
current_network_key = mesh_network_key_iterator_get_next(&validation_network_key_it); current_network_key = mesh_network_key_nid_iterator_get_next(&validation_network_key_it);
// calc PECB // calc PECB
uint32_t iv_index = iv_index_for_pdu(network_pdu); uint32_t iv_index = iv_index_for_pdu(network_pdu);
@ -528,7 +528,7 @@ static void process_network_pdu(mesh_network_pdu_t * network_pdu){
// init provisioning data iterator // init provisioning data iterator
uint8_t nid = nid_ivi & 0x7f; uint8_t nid = nid_ivi & 0x7f;
// uint8_t iv_index = network_pdu_data[0] >> 7; // uint8_t iv_index = network_pdu_data[0] >> 7;
mesh_network_key_iterator_init(&validation_network_key_it, nid); mesh_network_key_nid_iterator_init(&validation_network_key_it, nid);
process_network_pdu_validate(network_pdu); process_network_pdu_validate(network_pdu);
} }

View File

@ -75,13 +75,13 @@ const mesh_network_key_t * mesh_network_key_list_get(uint16_t netkey_index){
} }
// mesh network key iterator for a given nid // mesh network key iterator for a given nid
void mesh_network_key_iterator_init(mesh_network_key_iterator_t * it, uint8_t nid){ void mesh_network_key_nid_iterator_init(mesh_network_key_iterator_t *it, uint8_t nid){
btstack_linked_list_iterator_init(&it->it, &network_keys); btstack_linked_list_iterator_init(&it->it, &network_keys);
it->key = NULL; it->key = NULL;
it->nid = nid; it->nid = nid;
} }
int mesh_network_key_iterator_has_more(mesh_network_key_iterator_t * it){ int mesh_network_key_nid_iterator_has_more(mesh_network_key_iterator_t *it){
// find next matching key // find next matching key
while (1){ while (1){
if (it->key && it->key->nid == it->nid) return 1; if (it->key && it->key->nid == it->nid) return 1;
@ -91,7 +91,7 @@ int mesh_network_key_iterator_has_more(mesh_network_key_iterator_t * it){
return 0; return 0;
} }
const mesh_network_key_t * mesh_network_key_iterator_get_next(mesh_network_key_iterator_t * it){ const mesh_network_key_t * mesh_network_key_nid_iterator_get_next(mesh_network_key_iterator_t *it){
mesh_network_key_t * key = it->key; mesh_network_key_t * key = it->key;
it->key = NULL; it->key = NULL;
return key; return key;

View File

@ -139,21 +139,21 @@ void mesh_network_key_list_add_from_provisioning_data(const mesh_provisioning_da
* @param it * @param it
* @param nid * @param nid
*/ */
void mesh_network_key_iterator_init(mesh_network_key_iterator_t * it, uint8_t nid); void mesh_network_key_nid_iterator_init(mesh_network_key_iterator_t *it, uint8_t nid);
/** /**
* *
* @param it * @param it
* @return * @return
*/ */
int mesh_network_key_iterator_has_more(mesh_network_key_iterator_t * it); int mesh_network_key_nid_iterator_has_more(mesh_network_key_iterator_t *it);
/** /**
* *
* @param it * @param it
* @return * @return
*/ */
const mesh_network_key_t * mesh_network_key_iterator_get_next(mesh_network_key_iterator_t * it); const mesh_network_key_t * mesh_network_key_nid_iterator_get_next(mesh_network_key_iterator_t *it);
/** /**
* Set device key * Set device key