Merge pull request #778 from cyberman54/libpax-only
sync development <-> libpax-only
This commit is contained in:
commit
5d9e4ddf54
10
README.md
10
README.md
@ -144,7 +144,7 @@ Note: If you use this software you do this at your own risk. That means that you
|
||||
|
||||
# Privacy disclosure
|
||||
|
||||
Paxcounter generates identifiers for sniffed MAC adresses and collects them temporary in the device's RAM for a configurable scan cycle time (default 60 seconds). After each scan cycle the collected identifiers are cleared. Identifiers are generated by salting and hashing MAC adresses. The random salt value changes after each scan cycle. Identifiers and MAC adresses are never transferred to the LoRaWAN network. No persistent storing of MAC adresses, identifiers or timestamps and no other kind of analytics than counting are implemented in this code. Wireless networks are not touched by this code, but MAC adresses from wireless devices as well within as not within wireless networks, regardless if encrypted or unencrypted, are sniffed and processed by this code. If the bluetooth option in the code is enabled, bluetooth MACs are scanned and processed by the included BLE stack, then hashed and counted by this code.
|
||||
Paxcounter generates identifiers for sniffed Wifi or Bluetooth MAC adresses and and collects them temporary in the device's RAM for a configurable scan cycle time (default 60 seconds). After each scan cycle the collected identifiers are cleared. Identifiers are generated by using the last 2 bytes of universal MAC adresses. Personal MAC adresses remain untouched and are not evaluated. Identifiers and MAC adresses are never transferred to the LoRaWAN network. No persistent storing of MAC adresses, identifiers or timestamps and no other kind of analytics than counting are implemented in this code. Wireless networks are not touched by this code, but MAC adresses from wireless devices as well within as not within wireless networks, regardless if encrypted or unencrypted, are sniffed and processed by this code.
|
||||
|
||||
# LED blink pattern
|
||||
|
||||
@ -221,7 +221,6 @@ This describes how to set up a mobile PaxCounter:<br> Follow all steps so far fo
|
||||
Bluetooth low energy service UUID 0xFD6F, used by Google/Apple COVID-19 Exposure Notification System, can be monitored and counted. By comparing with the total number of observed devices this <A HREF="https://linux-fuer-wi.blogspot.com/2020/10/suche-die-zahl-64879.html">gives an indication</A> how many people staying in proximity are using Apps for tracing COVID-19 exposures, e.g. in Germany the "Corona Warn App". To achive best results with this funcion, use following settings in `paxcounter.conf`:
|
||||
|
||||
#define COUNT_ENS 1 // enable ENS monitoring function
|
||||
#define MACFILTER 0 // disable MAC filter
|
||||
#define BLECOUNTER 1 // enable bluetooth sniffing
|
||||
#define WIFICOUNTER 0 // disable wifi sniffing (improves BLE scan speed)
|
||||
#define HAS_SENSOR_1 1 // optional: transmit ENS counter data to server
|
||||
@ -320,7 +319,7 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering.
|
||||
byte 13: Wifi antenna switch (0=internal, 1=external) [default 0]
|
||||
byte 14: count randomizated MACs only (0=disabled, 1=enabled) [default 1]
|
||||
byte 15: RGB LED luminosity (0..100 %) [default 30]
|
||||
byte 16: Payload filter mask
|
||||
byte 16: 0 (reserved)
|
||||
byte 17: Beacon proximity alarm mode (1=on, 0=off) [default 0]
|
||||
bytes 18-28: Software version (ASCII format, terminating with zero)
|
||||
|
||||
@ -460,11 +459,6 @@ Send for example `8386` as Downlink on Port 2 to get battery status and time/dat
|
||||
0 ... 255 duration for scanning a bluetooth advertising channel in seconds/100
|
||||
e.g. 8 -> each channel is scanned for 80 milliseconds [default]
|
||||
|
||||
0x0D (NOT YET IMPLEMENTED) set BLE and WIFI MAC filter mode
|
||||
|
||||
0 = disabled (use to count devices, not people)
|
||||
1 = enabled [default]
|
||||
|
||||
0x0E set Bluetooth scanner
|
||||
|
||||
0 = disabled
|
||||
|
@ -80,7 +80,6 @@ typedef struct __attribute__((packed)) {
|
||||
uint8_t blescan; // 0=disabled, 1=enabled
|
||||
uint8_t wifiscan; // 0=disabled, 1=enabled
|
||||
uint8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
|
||||
uint8_t macfilter; // 0=disabled, 1=enabled
|
||||
uint8_t rgblum; // RGB Led luminosity (0..100%)
|
||||
uint8_t monitormode; // 0=disabled, 1=enabled
|
||||
uint8_t payloadmask; // bitswitches for payload data
|
||||
@ -129,7 +128,6 @@ 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 batt_level; // display value
|
||||
extern uint16_t volatile libpax_macs_ble, libpax_macs_wifi; // libpax values
|
||||
extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC
|
||||
@ -137,7 +135,6 @@ extern timesource_t timeSource;
|
||||
extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ;
|
||||
extern SemaphoreHandle_t I2Caccess;
|
||||
extern TaskHandle_t irqHandlerTask, ClockTask;
|
||||
extern TimerHandle_t WifiChanTimer;
|
||||
extern Timezone myTZ;
|
||||
|
||||
#endif
|
||||
|
@ -248,7 +248,7 @@ var bitmap1 = function (byte) {
|
||||
}
|
||||
var i = bytesToInt(byte);
|
||||
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
|
||||
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'filter', 'alarm']
|
||||
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'reserved', 'alarm']
|
||||
.reduce(function (obj, pos, index) {
|
||||
obj[pos] = +bm[index];
|
||||
return obj;
|
||||
|
@ -263,7 +263,7 @@ var bitmap1 = function (byte) {
|
||||
}
|
||||
var i = bytesToInt(byte);
|
||||
var bm = ('00000000' + Number(i).toString(2)).substr(-8).split('').map(Number).map(Boolean);
|
||||
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'filter', 'alarm']
|
||||
return ['adr', 'screensaver', 'screen', 'countermode', 'blescan', 'antenna', 'reserved', 'alarm']
|
||||
.reduce(function (obj, pos, index) {
|
||||
obj[pos] = +bm[index];
|
||||
return obj;
|
||||
|
@ -51,7 +51,6 @@ static void defaultConfig(configData_t *myconfig) {
|
||||
myconfig->blescan = BLECOUNTER; // 0=disabled, 1=enabled
|
||||
myconfig->wifiscan = WIFICOUNTER; // 0=disabled, 1=enabled
|
||||
myconfig->wifiant = 0; // 0=internal, 1=external (for LoPy/LoPy4)
|
||||
myconfig->macfilter = MACFILTER; // 0=disabled, 1=enabled
|
||||
myconfig->rgblum = RGBLUMINOSITY; // RGB Led luminosity (0..100%)
|
||||
myconfig->monitormode = 0; // 0=disabled, 1=enabled
|
||||
myconfig->payloadmask = PAYLOADMASK; // payloads as defined in default
|
||||
|
@ -399,10 +399,6 @@ void setup() {
|
||||
strcat_P(features, " SDS");
|
||||
#endif
|
||||
|
||||
#if (MACFILTER)
|
||||
strcat_P(features, " FILTER");
|
||||
#endif
|
||||
|
||||
// initialize matrix display
|
||||
#ifdef HAS_MATRIX_DISPLAY
|
||||
strcat_P(features, " LED_MATRIX");
|
||||
|
@ -19,10 +19,8 @@
|
||||
#define COUNTERMODE 0 // 0=cyclic, 1=cumulative, 2=cyclic confirmed
|
||||
|
||||
// MAC sniffing parameters
|
||||
#define MACFILTER 1 // set to 0 if you want to scan all devices, 1 to scan only devices with random MACs (aka smartphones) [default = 1]
|
||||
#define BLECOUNTER 1 // set to 0 if you do not want to install the BLE sniffer
|
||||
#define WIFICOUNTER 1 // set to 0 if you do not want to install the WIFI sniffer
|
||||
#define MAC_QUEUE_SIZE 50 // size of MAC processing buffer (number of MACs) [default = 50]
|
||||
|
||||
// BLE scan parameters
|
||||
#define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below
|
||||
|
@ -49,7 +49,7 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
buffer[cursor++] = value.blescantime;
|
||||
buffer[cursor++] = value.blescan;
|
||||
buffer[cursor++] = value.wifiant;
|
||||
buffer[cursor++] = value.macfilter;
|
||||
buffer[cursor++] = 0; // reserved
|
||||
buffer[cursor++] = value.rgblum;
|
||||
buffer[cursor++] = value.payloadmask;
|
||||
buffer[cursor++] = value.monitormode;
|
||||
@ -58,7 +58,8 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
uint32_t mem, uint8_t reset0, uint32_t restarts) {
|
||||
uint32_t mem, uint8_t reset0,
|
||||
uint32_t restarts) {
|
||||
|
||||
buffer[cursor++] = highByte(voltage);
|
||||
buffer[cursor++] = lowByte(voltage);
|
||||
@ -181,14 +182,15 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
writeUint8(value.rgblum);
|
||||
writeBitmap(value.adrmode ? true : false, value.screensaver ? true : false,
|
||||
value.screenon ? true : false, value.countermode ? true : false,
|
||||
value.blescan ? true : false, value.wifiant ? true : false,
|
||||
value.macfilter ? true : false, value.monitormode ? true : false);
|
||||
value.blescan ? true : false, value.wifiant ? true : false, 0,
|
||||
value.monitormode ? true : false);
|
||||
writeUint8(value.payloadmask);
|
||||
writeVersion(value.version);
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
uint32_t mem, uint8_t reset0, uint32_t restarts) {
|
||||
uint32_t mem, uint8_t reset0,
|
||||
uint32_t restarts) {
|
||||
writeUint16(voltage);
|
||||
writeUptime(uptime);
|
||||
writeUint8((byte)cputemp);
|
||||
@ -400,7 +402,8 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float celsius,
|
||||
uint32_t mem, uint8_t reset0, uint32_t restarts) {
|
||||
uint32_t mem, uint8_t reset0,
|
||||
uint32_t restarts) {
|
||||
uint16_t temp = celsius * 10;
|
||||
uint16_t volt = voltage / 10;
|
||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||
|
@ -55,6 +55,12 @@ void set_reset(uint8_t val[]) {
|
||||
|
||||
void set_rssi(uint8_t val[]) {
|
||||
cfg.rssilimit = val[0] * -1;
|
||||
libpax_counter_stop();
|
||||
libpax_config_t current_config;
|
||||
libpax_get_current_config(¤t_config);
|
||||
current_config.wifi_rssi_threshold = cfg.rssilimit;
|
||||
libpax_update_config(¤t_config);
|
||||
init_libpax();
|
||||
ESP_LOGI(TAG, "Remote command: set RSSI limit to %d", cfg.rssilimit);
|
||||
}
|
||||
|
||||
@ -76,12 +82,33 @@ void set_sleepcycle(uint8_t val[]) {
|
||||
|
||||
void set_wifichancycle(uint8_t val[]) {
|
||||
cfg.wifichancycle = val[0];
|
||||
// TODO update libpax configuration
|
||||
libpax_counter_stop();
|
||||
libpax_config_t current_config;
|
||||
libpax_get_current_config(¤t_config);
|
||||
|
||||
if (cfg.wifichancycle == 0) {
|
||||
ESP_LOGI(TAG, "Remote command: set Wifi channel hopping to off");
|
||||
current_config.wifi_channel_map = WIFI_CHANNEL_1;
|
||||
} else {
|
||||
ESP_LOGI(
|
||||
TAG,
|
||||
"Remote command: set Wifi channel hopping interval to %.1f seconds",
|
||||
cfg.wifichancycle / float(100));
|
||||
}
|
||||
|
||||
current_config.wifi_channel_switch_interval = cfg.wifichancycle;
|
||||
libpax_update_config(¤t_config);
|
||||
init_libpax();
|
||||
}
|
||||
|
||||
void set_blescantime(uint8_t val[]) {
|
||||
cfg.blescantime = val[0];
|
||||
// TODO update libpax configuration
|
||||
libpax_counter_stop();
|
||||
libpax_config_t current_config;
|
||||
libpax_get_current_config(¤t_config);
|
||||
current_config.blescantime = cfg.blescantime;
|
||||
libpax_update_config(¤t_config);
|
||||
init_libpax();
|
||||
}
|
||||
|
||||
void set_countmode(uint8_t val[]) {
|
||||
@ -258,12 +285,6 @@ void set_wifiant(uint8_t val[]) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_macfilter(uint8_t val[]) {
|
||||
ESP_LOGI(TAG, "Remote command: set macfilter mode to %s",
|
||||
val[0] ? "on" : "off");
|
||||
cfg.macfilter = val[0] ? 1 : 0;
|
||||
}
|
||||
|
||||
void set_rgblum(uint8_t val[]) {
|
||||
// Avoid wrong parameters
|
||||
cfg.rgblum = (val[0] <= 100) ? (uint8_t)val[0] : RGBLUMINOSITY;
|
||||
@ -393,18 +414,18 @@ static const cmd_t table[] = {
|
||||
{0x07, set_loraadr, 1}, {0x08, set_screensaver, 1},
|
||||
{0x09, set_reset, 1}, {0x0a, set_sendcycle, 1},
|
||||
{0x0b, set_wifichancycle, 1}, {0x0c, set_blescantime, 1},
|
||||
{0x0d, set_macfilter, 1}, {0x0e, set_blescan, 1},
|
||||
{0x0f, set_wifiant, 1}, {0x10, set_rgblum, 1},
|
||||
{0x11, set_monitor, 1}, {0x12, set_beacon, 7},
|
||||
{0x13, set_sensor, 2}, {0x14, set_payloadmask, 1},
|
||||
{0x15, set_bme, 1}, {0x16, set_batt, 1},
|
||||
{0x17, set_wifiscan, 1}, {0x18, set_enscount, 1},
|
||||
{0x19, set_sleepcycle, 2}, {0x20, set_loadconfig, 0},
|
||||
{0x21, set_saveconfig, 0}, {0x80, get_config, 0},
|
||||
{0x81, get_status, 0}, {0x83, get_batt, 0},
|
||||
{0x84, get_gps, 0}, {0x85, get_bme, 0},
|
||||
{0x86, get_time, 0}, {0x87, set_timesync, 0},
|
||||
{0x88, set_time, 4}, {0x99, set_flush, 0}};
|
||||
{0x0e, set_blescan, 1}, {0x0f, set_wifiant, 1},
|
||||
{0x10, set_rgblum, 1}, {0x11, set_monitor, 1},
|
||||
{0x12, set_beacon, 7}, {0x13, set_sensor, 2},
|
||||
{0x14, set_payloadmask, 1}, {0x15, set_bme, 1},
|
||||
{0x16, set_batt, 1}, {0x17, set_wifiscan, 1},
|
||||
{0x18, set_enscount, 1}, {0x19, set_sleepcycle, 2},
|
||||
{0x20, set_loadconfig, 0}, {0x21, set_saveconfig, 0},
|
||||
{0x80, get_config, 0}, {0x81, get_status, 0},
|
||||
{0x83, get_batt, 0}, {0x84, get_gps, 0},
|
||||
{0x85, get_bme, 0}, {0x86, get_time, 0},
|
||||
{0x87, set_timesync, 0}, {0x88, set_time, 4},
|
||||
{0x99, set_flush, 0}};
|
||||
|
||||
static const uint8_t cmdtablesize =
|
||||
sizeof(table) / sizeof(table[0]); // number of commands in command table
|
||||
|
Loading…
Reference in New Issue
Block a user