mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-31 00:32:52 +00:00
mesh: simplify mesh_transport_key_iterator
This commit is contained in:
parent
0cdba057f6
commit
7f00ba15e4
@ -201,13 +201,17 @@ mesh_transport_key_iterator_init(mesh_transport_key_iterator_t *it, uint16_t net
|
||||
it->netkey_index = netkey_index;
|
||||
it->aid = aid;
|
||||
it->akf = akf;
|
||||
it->first = 1;
|
||||
it->key = NULL;
|
||||
if (it->akf){
|
||||
it->key = NULL;
|
||||
} else {
|
||||
it->key = &mesh_transport_device_key;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int mesh_transport_key_iterator_has_more(mesh_transport_key_iterator_t *it){
|
||||
if (it->akf == 0){
|
||||
return it->first;
|
||||
return it->key != NULL;
|
||||
}
|
||||
// find next matching key
|
||||
while (1){
|
||||
@ -219,10 +223,6 @@ int mesh_transport_key_iterator_has_more(mesh_transport_key_iterator_t *it){
|
||||
}
|
||||
|
||||
const mesh_transport_key_t * mesh_transport_key_iterator_get_next(mesh_transport_key_iterator_t *it){
|
||||
if (it->akf == 0) {
|
||||
it->first = 0;
|
||||
return &mesh_transport_device_key;
|
||||
}
|
||||
mesh_transport_key_t * key = it->key;
|
||||
it->key = NULL;
|
||||
return key;
|
||||
|
@ -104,7 +104,6 @@ typedef struct {
|
||||
uint16_t netkey_index;
|
||||
uint8_t akf;
|
||||
uint8_t aid;
|
||||
uint8_t first;
|
||||
} mesh_transport_key_iterator_t;
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user