beacon monitor bugfix
This commit is contained in:
1 parent
455c2c8149
commit
dec9cfe703
5 files changed
+12
-12
No files matched your search
+2
-2
@@ -1,9 +1,9 @@
|
||||
#ifndef _BEACON_ARRAY_H
|
||||
#define _BEACON_ARRAY_H
|
||||
|
||||
std::array<uint64_t, 0xfe>::iterator it;
|
||||
std::array<uint64_t, 0xff>::iterator it;
|
||||
|
||||
std::array<uint64_t, 0xfe> beacons = {0x0102030405060708, 0xaaaaaaaaaaaaaaaa,
|
||||
std::array<uint64_t, 0xff> beacons = {0x0102030405060708, 0xaaaaaaaaaaaaaaaa,
|
||||
0xaaaaaaaaaaaaaaa1, 0x0000807abf6f522b,
|
||||
0x0000807abfedb08e, 0x00005BEEB69AA8FC,
|
||||
0x0000DB53A5362400};
|
||||
|
||||
+2
-2
@@ -48,8 +48,8 @@ extern portMUX_TYPE timerMux;
|
||||
extern volatile int SendCycleTimerIRQ, HomeCycleIRQ, DisplayTimerIRQ,
|
||||
ChannelTimerIRQ, ButtonPressedIRQ;
|
||||
|
||||
extern std::array<uint64_t, 0xfe>::iterator it;
|
||||
extern std::array<uint64_t, 0xfe> beacons;
|
||||
extern std::array<uint64_t, 0xff>::iterator it;
|
||||
extern std::array<uint64_t, 0xff> beacons;
|
||||
|
||||
#ifdef HAS_GPS
|
||||
#include "gps.h"
|
||||
|
||||
+5
-5
@@ -27,12 +27,12 @@ uint16_t reset_salt(void) {
|
||||
return salt;
|
||||
}
|
||||
|
||||
uint8_t isBeacon(uint64_t mac) {
|
||||
int8_t isBeacon(uint64_t mac) {
|
||||
it = std::find(beacons.begin(), beacons.end(), mac);
|
||||
if (it != beacons.end())
|
||||
return std::distance(beacons.begin(), it);
|
||||
else
|
||||
return 0xff;
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint64_t macConvert(uint8_t *paddr) {
|
||||
@@ -45,7 +45,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
||||
|
||||
char buff[16]; // temporary buffer for printf
|
||||
bool added = false;
|
||||
uint8_t beaconID; // beacon number in test monitor mode
|
||||
int8_t beaconID; // beacon number in test monitor mode
|
||||
uint16_t hashedmac; // temporary buffer for generated hash value
|
||||
uint32_t addr2int,
|
||||
vendor2int; // temporary buffer for shortened MAC and Vendor OUI
|
||||
@@ -98,8 +98,8 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
||||
// in beacon monitor mode check if seen MAC is a known beacon
|
||||
if (cfg.monitormode) {
|
||||
beaconID = isBeacon(macConvert(paddr));
|
||||
if (beaconID != 0xff) {
|
||||
ESP_LOGI(TAG, "Beacon ID#%d detected", beaconID);
|
||||
if (beaconID >= 0) {
|
||||
ESP_LOGI(TAG, "Beacon ID#d detected", beaconID);
|
||||
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
|
||||
blink_LED(COLOR_WHITE, 2000);
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ void set_gps(uint8_t val[]) {
|
||||
};
|
||||
|
||||
void set_beacon(uint8_t val[]) {
|
||||
if ( (sizeof(*val) / sizeof(val[0]) == 7) && (val[0] <= 0xff ) ) {
|
||||
if (sizeof(*val) / sizeof(val[0]) == 7) {
|
||||
uint8_t id = val[0]; // use first parameter as beacon storage id
|
||||
memmove(val, val + 1, 6); // strip off storage id
|
||||
beacons[id] = macConvert(val); // store beacon MAC in array
|
||||
|
||||
Reference in new issue
Block a user