Files
esp-anchor/components/ble_scanner/include/ble_scanner.h
T

36 lines
1.1 KiB
C

#pragma once
#include <stdint.h>
typedef enum {
BLE_BEACON_IBEACON,
BLE_BEACON_ALTBEACON,
BLE_BEACON_EDDYSTONE_UID,
BLE_BEACON_EDDYSTONE_URL,
} ble_beacon_type_t;
typedef struct {
ble_beacon_type_t type;
char id[64]; /* beacon identifier; encoding varies by type:
iBeacon: "UUID-MAJOR-MINOR"
AltBeacon: 40-char hex beacon ID
Eddystone UID: "NAMESPACE.INSTANCE" hex
Eddystone URL: decoded URL string */
int8_t tx_power; /* calibrated TX power from beacon payload */
int8_t rssi; /* measured signal strength */
} ble_beacon_t;
typedef void (*ble_scanner_cb_t)(const ble_beacon_t *beacon);
/**
* Initialise the NimBLE stack and register the scan callback. Must be called
* once before ble_scanner_start(). Starts the NimBLE host task internally.
*/
void ble_scanner_init(ble_scanner_cb_t cb);
/** Start passive BLE scanning. */
void ble_scanner_start(void);
/** Stop BLE scanning. */
void ble_scanner_stop(void);