Merge branch 'libpax-only' into development
This commit is contained in:
25 files changed
+625
-1531
No files matched your search
@@ -1,17 +0,0 @@
|
||||
#ifndef _BLESCAN_H
|
||||
#define _BLESCAN_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "macsniff.h"
|
||||
|
||||
// Bluetooth specific includes
|
||||
#include <esp_bt.h>
|
||||
#include <esp_bt_main.h>
|
||||
#include <esp_gap_ble_api.h>
|
||||
#include <esp_blufi_api.h> // needed for BLE_ADDR types, do not remove
|
||||
#include <esp_coexist.h>
|
||||
|
||||
void start_BLEscan(void);
|
||||
void stop_BLEscan(void);
|
||||
|
||||
#endif
|
||||
+2
-4
@@ -1,6 +1,7 @@
|
||||
#ifndef _CYCLIC_H
|
||||
#define _CYCLIC_H
|
||||
|
||||
#include <libpax_api.h>
|
||||
#include "globals.h"
|
||||
#include "senddata.h"
|
||||
#include "rcommand.h"
|
||||
@@ -10,11 +11,8 @@
|
||||
#include "display.h"
|
||||
#include "sds011read.h"
|
||||
#include "sdcard.h"
|
||||
#include "macsniff.h"
|
||||
#include "reset.h"
|
||||
#if LIBPAX
|
||||
#include <libpax_api.h>
|
||||
#endif
|
||||
#include "led.h"
|
||||
|
||||
extern Ticker cyclicTimer;
|
||||
|
||||
|
||||
+2
-14
@@ -15,7 +15,6 @@
|
||||
#include <set>
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include "mallocator.h"
|
||||
#include <bsec.h>
|
||||
|
||||
#define _bit(b) (1U << (b))
|
||||
@@ -100,13 +99,6 @@ typedef struct {
|
||||
uint8_t Message[PAYLOAD_BUFFER_SIZE];
|
||||
} MessageBuffer_t;
|
||||
|
||||
// Struct for MAC processing queue
|
||||
typedef struct {
|
||||
uint8_t mac[6];
|
||||
int8_t rssi;
|
||||
snifftype_t sniff_type;
|
||||
} MacBuffer_t;
|
||||
|
||||
typedef struct {
|
||||
int32_t latitude;
|
||||
int32_t longitude;
|
||||
@@ -131,24 +123,20 @@ typedef struct {
|
||||
float pm25;
|
||||
} sdsStatus_t;
|
||||
|
||||
extern std::set<uint16_t, std::less<uint16_t>, Mallocator<uint16_t>> macs;
|
||||
extern std::array<uint64_t, 0xff>::iterator it;
|
||||
extern std::array<uint64_t, 0xff> beacons;
|
||||
|
||||
extern configData_t cfg; // current device configuration
|
||||
extern char clientId[20]; // unique clientID
|
||||
extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer
|
||||
extern uint8_t volatile channel; // wifi channel rotation counter
|
||||
extern uint8_t volatile rf_load; // RF traffic indicator
|
||||
extern uint8_t batt_level; // display value
|
||||
extern uint16_t volatile macs_wifi, macs_ble; // display values
|
||||
#if LIBPAX
|
||||
extern uint16_t volatile libpax_macs_ble, libpax_macs_wifi; // libpax values
|
||||
#endif
|
||||
extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC
|
||||
extern timesource_t timeSource;
|
||||
extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ;
|
||||
extern SemaphoreHandle_t I2Caccess;
|
||||
extern TaskHandle_t irqHandlerTask, ClockTask, macProcessTask;
|
||||
extern TaskHandle_t irqHandlerTask, ClockTask;
|
||||
extern TimerHandle_t WifiChanTimer;
|
||||
extern Timezone myTZ;
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef _MACSNIFF_H
|
||||
#define _MACSNIFF_H
|
||||
|
||||
// ESP32 Functions
|
||||
#include <esp_wifi.h>
|
||||
|
||||
// Hash function for scrambling MAC addresses
|
||||
#include "hash.h"
|
||||
#include "senddata.h"
|
||||
#include "cyclic.h"
|
||||
#include "led.h"
|
||||
|
||||
#if (COUNT_ENS)
|
||||
#include "corona.h"
|
||||
#endif
|
||||
|
||||
uint32_t renew_salt(void);
|
||||
uint64_t macConvert(uint8_t *paddr);
|
||||
esp_err_t macQueueInit(void);
|
||||
void mac_process(void *pvParameters);
|
||||
void IRAM_ATTR mac_add(uint8_t *paddr, int8_t rssi, snifftype_t sniff_type);
|
||||
uint16_t mac_analyze(MacBuffer_t MacBuffer);
|
||||
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb);
|
||||
|
||||
#endif
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "globals.h"
|
||||
#include "reset.h"
|
||||
#include "i2c.h"
|
||||
#include "blescan.h"
|
||||
#include "wifiscan.h"
|
||||
#include "configmanager.h"
|
||||
#include "cyclic.h"
|
||||
#include "beacon_array.h"
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
|
||||
This Mallocator code was taken from:
|
||||
|
||||
CppCon2014 Presentations
|
||||
STL Features And Implementation Techniques
|
||||
Stephan T. Lavavej
|
||||
|
||||
https://github.com/CppCon/CppCon2014
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MALLOCATOR_H
|
||||
#define _MALLOCATOR_H
|
||||
|
||||
#include <stdlib.h> // size_t, malloc, free
|
||||
#include <new> // bad_alloc, bad_array_new_length
|
||||
#include "esp32-hal-psram.h" // ps_malloc
|
||||
|
||||
template <class T> struct Mallocator {
|
||||
typedef T value_type;
|
||||
Mallocator() noexcept {} // default ctor not required
|
||||
template <class U> Mallocator(const Mallocator<U> &) noexcept {}
|
||||
template <class U> bool operator==(const Mallocator<U> &) const noexcept {
|
||||
return true;
|
||||
}
|
||||
template <class U> bool operator!=(const Mallocator<U> &) const noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
T *allocate(const size_t n) const {
|
||||
if (n == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
if (n > static_cast<size_t>(-1) / sizeof(T)) {
|
||||
throw std::bad_array_new_length();
|
||||
}
|
||||
|
||||
#ifndef BOARD_HAS_PSRAM
|
||||
void *const pv = malloc(n * sizeof(T));
|
||||
#else
|
||||
void *const pv = ps_malloc(n * sizeof(T));
|
||||
#endif
|
||||
|
||||
if (!pv) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
return static_cast<T *>(pv);
|
||||
}
|
||||
void deallocate(T *const p, size_t) const noexcept { free(p); }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -8,12 +8,9 @@
|
||||
#include "configmanager.h"
|
||||
#include "lorawan.h"
|
||||
#include "sensor.h"
|
||||
#include "macsniff.h"
|
||||
#include "wifiscan.h"
|
||||
#include "cyclic.h"
|
||||
#include "timekeeper.h"
|
||||
#include "timesync.h"
|
||||
#include "blescan.h"
|
||||
|
||||
// maximum number of elements in rcommand interpreter queue
|
||||
#define RCMD_QUEUE_SIZE 5
|
||||
|
||||
+1
-7
@@ -1,6 +1,7 @@
|
||||
#ifndef _SENDDATA_H
|
||||
#define _SENDDATA_H
|
||||
|
||||
#include <libpax_api.h>
|
||||
#include "spislave.h"
|
||||
#include "mqttclient.h"
|
||||
#include "cyclic.h"
|
||||
@@ -9,18 +10,11 @@
|
||||
#include "display.h"
|
||||
#include "sdcard.h"
|
||||
|
||||
|
||||
#if (COUNT_ENS)
|
||||
#include "corona.h"
|
||||
#endif
|
||||
|
||||
#if LIBPAX
|
||||
#include <libpax_api.h>
|
||||
|
||||
extern struct count_payload_t count_from_libpax;
|
||||
#endif
|
||||
|
||||
|
||||
extern Ticker sendTimer;
|
||||
|
||||
void SendPayload(uint8_t port);
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef _WIFISCAN_H
|
||||
#define _WIFISCAN_H
|
||||
|
||||
// ESP32 Functions
|
||||
#include <esp_wifi.h>
|
||||
|
||||
#include "hash.h" // Hash function for scrambling MAC addresses
|
||||
#include "antenna.h" // code for switching wifi antennas
|
||||
#include "macsniff.h"
|
||||
|
||||
extern TimerHandle_t WifiChanTimer;
|
||||
|
||||
void wifi_sniffer_init(void);
|
||||
void switch_wifi_sniffer(uint8_t state);
|
||||
void IRAM_ATTR wifi_sniffer_packet_handler(void *buff,
|
||||
wifi_promiscuous_pkt_type_t type);
|
||||
void switchWifiChannel(TimerHandle_t xTimer);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user