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 
9 #pragma once
10 
27 #include "clist.h"
28 #include "net/ble.h"
29 #include "nimble/ble.h"
30 #include "nimble_scanner.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 #ifndef NIMBLE_SCANLIST_SIZE
40 #define NIMBLE_SCANLIST_SIZE (20U)
41 #endif
42 
46 typedef struct {
48  ble_addr_t addr;
49  uint8_t ad[BLE_ADV_PDU_LEN];
50  uint8_t ad_len;
51  int8_t last_rssi;
52  uint32_t adv_msg_cnt;
53  uint32_t first_update;
54  uint32_t last_update;
55  uint8_t type;
56  uint8_t phy_pri;
57  uint8_t phy_sec;
59 
64 
76 void nimble_scanlist_update(uint8_t type, const ble_addr_t *addr,
77  const nimble_scanner_info_t *info,
78  const uint8_t *ad, size_t len);
79 
89 
100 
105 
110 
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
Circular linked list.
#define BLE_ADV_PDU_LEN
max size of legacy ADV packets
Definition: ble.h:48
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:39
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.