nimble_scanner.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 
21 #ifndef NIMBLE_SCANNER_H
22 #define NIMBLE_SCANNER_H
23 
24 #include <stdint.h>
25 
26 #include "host/ble_hs.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 enum {
36  NIMBLE_SCANNER_OK = 0,
37  NIMBLE_SCANNER_SCANNING = 1,
38  NIMBLE_SCANNER_STOPPED = 2,
39  NIMBLE_SCANNER_ERR = -1,
40 };
41 
52 typedef void(*nimble_scanner_cb)(uint8_t type,
53  const ble_addr_t *addr, int8_t rssi,
54  const uint8_t *ad, size_t ad_len);
55 
66 int nimble_scanner_init(const struct ble_gap_disc_params *params,
67  nimble_scanner_cb disc_cb);
68 
72 int nimble_scanner_start(void);
73 
77 void nimble_scanner_stop(void);
78 
85 int nimble_scanner_status(void);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif /* NIMBLE_SCANNER_H */
92 
nimble_scanner_stop
void nimble_scanner_stop(void)
Stop scanning.
nimble_scanner_cb
void(* nimble_scanner_cb)(uint8_t type, const ble_addr_t *addr, int8_t rssi, const uint8_t *ad, size_t ad_len)
Callback signature triggered by this module for each discovered advertising packet.
Definition: nimble_scanner.h:52
nimble_scanner_status
int nimble_scanner_status(void)
Get the current scanning status.
nimble_scanner_start
int nimble_scanner_start(void)
Start scanning using timing parameters configured on initialization.
nimble_scanner_init
int nimble_scanner_init(const struct ble_gap_disc_params *params, nimble_scanner_cb disc_cb)
Initialize the scanner module.