nimble_scanlist.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
25 #ifndef NIMBLE_SCANLIST_H
26 #define NIMBLE_SCANLIST_H
27 
28 #include "clist.h"
29 #include "net/ble.h"
30 #include "nimble/ble.h"
31 #include "nimble_scanner.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 #ifndef NIMBLE_SCANLIST_SIZE
41 #define NIMBLE_SCANLIST_SIZE (20U)
42 #endif
43 
47 typedef struct {
49  ble_addr_t addr;
50  uint8_t ad[BLE_ADV_PDU_LEN];
51  uint8_t ad_len;
52  int8_t last_rssi;
53  uint32_t adv_msg_cnt;
54  uint32_t first_update;
55  uint32_t last_update;
56  uint8_t type;
57  uint8_t phy_pri;
58  uint8_t phy_sec;
60 
65 
77 void nimble_scanlist_update(uint8_t type, const ble_addr_t *addr,
78  const nimble_scanner_info_t *info,
79  const uint8_t *ad, size_t len);
80 
90 
101 
106 
111 
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* NIMBLE_SCANLIST_H */
Circular linked list.
#define BLE_ADV_PDU_LEN
max size of legacy ADV packets
Definition: ble.h:49
void nimble_scanlist_clear(void)
Clear all entries in the list.
void nimble_scanlist_update(uint8_t type, const ble_addr_t *addr, const nimble_scanner_info_t *info, const uint8_t *ad, size_t len)
Add/update the entry for the a scanned node.
nimble_scanlist_entry_t * nimble_scanlist_get_by_pos(unsigned pos)
Get an entry of the scanlist by its position.
void nimble_scanlist_print_entry(nimble_scanlist_entry_t *e)
Dump a single scanlist entry to STDIO.
nimble_scanlist_entry_t * nimble_scanlist_get_next(nimble_scanlist_entry_t *e)
Get the next entry from the list, pass NULL for getting the first entry.
void nimble_scanlist_init(void)
Initialize the scanlist.
void nimble_scanlist_print(void)
Dump the entire scanlist to STDIO using nimble_scanlist_print_entry()
Scanner abstraction for NimBLE.
List node structure.
Definition: list.h:40
Data structure for holding a single scanlist entry.
uint32_t adv_msg_cnt
number of adv packets by a node
int8_t last_rssi
last RSSI of a scanned node
uint8_t type
advertising packet type
uint8_t phy_sec
secondary PHY advertised
uint32_t first_update
first packet timestamp
ble_addr_t addr
a node's BLE address
clist_node_t node
list node
uint8_t phy_pri
primary PHY used
uint8_t ad_len
length of the advertising data
uint32_t last_update
last packet timestamp
Additional information about received advertising packets.
General BLE values as defined by the BT standard.