esp-nimble-cpp  1.4.1
NimBLEBeacon.h
1 /*
2  * NimBLEBeacon2.h
3  *
4  * Created: on March 15 2020
5  * Author H2zero
6  *
7  * Originally:
8  *
9  * BLEBeacon2.h
10  *
11  * Created on: Jan 4, 2018
12  * Author: kolban
13  */
14 
15 #ifndef MAIN_NIMBLEBEACON_H_
16 #define MAIN_NIMBLEBEACON_H_
17 
18 #include "NimBLEUUID.h"
24 class NimBLEBeacon {
25 private:
26  struct {
27  uint16_t manufacturerId;
28  uint8_t subType;
29  uint8_t subTypeLength;
30  uint8_t proximityUUID[16];
31  uint16_t major;
32  uint16_t minor;
33  int8_t signalPower;
34  } __attribute__((packed)) m_beaconData;
35 public:
36  NimBLEBeacon();
37  std::string getData();
38  uint16_t getMajor();
39  uint16_t getMinor();
40  uint16_t getManufacturerId();
42  int8_t getSignalPower();
43  void setData(const std::string &data);
44  void setMajor(uint16_t major);
45  void setMinor(uint16_t minor);
46  void setManufacturerId(uint16_t manufacturerId);
47  void setProximityUUID(const NimBLEUUID &uuid);
48  void setSignalPower(int8_t signalPower);
49 }; // NimBLEBeacon
50 
51 #endif /* MAIN_NIMBLEBEACON_H_ */
Representation of a beacon. See:
Definition: NimBLEBeacon.h:24
void setManufacturerId(uint16_t manufacturerId)
Set the manufacturer ID.
Definition: NimBLEBeacon.cpp:122
void setMinor(uint16_t minor)
Set the minor value.
Definition: NimBLEBeacon.cpp:131
uint16_t getMinor()
Get the minor value being advertised.
Definition: NimBLEBeacon.cpp:72
int8_t getSignalPower()
Get the signal power being advertised.
Definition: NimBLEBeacon.cpp:90
void setProximityUUID(const NimBLEUUID &uuid)
Set the proximity UUID.
Definition: NimBLEBeacon.cpp:140
uint16_t getManufacturerId()
Get the manufacturer ID being advertised.
Definition: NimBLEBeacon.cpp:63
void setData(const std::string &data)
Set the raw data for the beacon record.
Definition: NimBLEBeacon.cpp:99
NimBLEUUID getProximityUUID()
Get the proximity UUID being advertised.
Definition: NimBLEBeacon.cpp:81
uint16_t getMajor()
Get the major value being advertised.
Definition: NimBLEBeacon.cpp:54
void setMajor(uint16_t major)
Set the major value.
Definition: NimBLEBeacon.cpp:113
NimBLEBeacon()
Construct a default beacon object.
Definition: NimBLEBeacon.cpp:30
std::string getData()
Retrieve the data that is being advertised.
Definition: NimBLEBeacon.cpp:45
void setSignalPower(int8_t signalPower)
Set the signal power.
Definition: NimBLEBeacon.cpp:153
A model of a BLE UUID.
Definition: NimBLEUUID.h:37