remove unused ENS/CWA code
This commit is contained in:
1 parent
efca209795
commit
db60afe05d
18 files changed
+9
-167
No files matched your search
@@ -84,11 +84,6 @@ function Decoder(bytes, port) {
|
||||
}
|
||||
}
|
||||
|
||||
if (port === 10) {
|
||||
// ENS count
|
||||
return decode(bytes, [uint16], ['ens']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -90,11 +90,6 @@ function decodeUplink(input) {
|
||||
data = decode(input.bytes, [uint32, uint8], ['time', 'timestatus']);
|
||||
}
|
||||
}
|
||||
|
||||
if (input.fPort === 10) {
|
||||
// ENS count
|
||||
data = decode(input.bytes, [uint16], ['ens']);
|
||||
}
|
||||
|
||||
data.bytes = input.bytes; // comment out if you do not want to include the original payload
|
||||
data.port = input.fPort; // comment out if you do not want to inlude the port
|
||||
|
||||
@@ -84,13 +84,6 @@ function decodeUplink(input) {
|
||||
}
|
||||
}
|
||||
|
||||
if (input.fPort === 10) {
|
||||
var i = 0;
|
||||
if (input.bytes.length >= 2) {
|
||||
data.ens = (input.bytes[i++] << 8) | input.bytes[i++];
|
||||
}
|
||||
}
|
||||
|
||||
if (data.hdop) {
|
||||
data.hdop /= 100;
|
||||
data.latitude /= 1000000;
|
||||
|
||||
@@ -57,7 +57,6 @@ static void defaultConfig(configData_t *myconfig) {
|
||||
myconfig->wifiant = 0; // 0=internal, 1=external (for LoPy/LoPy4)
|
||||
myconfig->rgblum = RGBLUMINOSITY; // RGB Led luminosity (0..100%)
|
||||
myconfig->payloadmask = PAYLOADMASK; // payloads as defined in default
|
||||
myconfig->enscount = COUNT_ENS; // 0=disabled, 1=enabled
|
||||
|
||||
#ifdef HAS_BME680
|
||||
// initial BSEC state for BME680 sensor
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// routines for counting the number of devices which advertise Exposure
|
||||
// Notification Service e.g. "Corona Warn App" in Germany
|
||||
|
||||
// copied from https://github.com/kmetz/BLEExposureNotificationBeeper
|
||||
// (c) by Kaspar Metz
|
||||
// modified for use in the Paxcounter by AQ
|
||||
|
||||
#if (COUNT_ENS) && !(BLECOUNTER)
|
||||
#warning ENS-Counter needs Bluetooth, but Bluetooth compile option is disabled
|
||||
#endif
|
||||
|
||||
#if (COUNT_ENS)
|
||||
|
||||
// Local logging tag
|
||||
static const char TAG[] = __FILE__;
|
||||
|
||||
#define BT_BD_ADDR_HEX(addr) \
|
||||
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
||||
|
||||
#include "corona.h"
|
||||
|
||||
// When to forget old senders ** currently not used **
|
||||
#define FORGET_AFTER_MINUTES 2
|
||||
|
||||
// array of timestamps for seen notifiers: hash -> timestamp[ms]
|
||||
static std::map<uint16_t, unsigned long> cwaSeenNotifiers;
|
||||
|
||||
// Remove notifiers last seen over FORGET_AFTER_MINUTES ago.
|
||||
void cwa_clear() {
|
||||
#ifdef VERBOSE
|
||||
ESP_LOGV(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size());
|
||||
for (auto const ¬ifier : cwaSeenNotifiers) {
|
||||
ESP_LOGD(TAG, "CWA forget <%04X>", notifier.first);
|
||||
// }
|
||||
}
|
||||
#endif
|
||||
// clear everything, otherwise we would count the same device again, as in the
|
||||
// next cycle it likely will advertise with a different hash-value
|
||||
cwaSeenNotifiers.clear();
|
||||
}
|
||||
|
||||
// return the total number of devices seen advertising ENS
|
||||
uint16_t cwa_report(void) { return cwaSeenNotifiers.size(); }
|
||||
|
||||
bool cwa_init(void) {
|
||||
ESP_LOGD(TAG, "init BLE-scanner for ENS");
|
||||
return true;
|
||||
}
|
||||
|
||||
void cwa_mac_add(uint16_t hashedmac) {
|
||||
cwaSeenNotifiers[hashedmac] = millis(); // hash last seen at ....
|
||||
}
|
||||
|
||||
#endif
|
||||
+2
-12
@@ -268,12 +268,7 @@ void dp_drawPage(bool nextpage) {
|
||||
else
|
||||
dp_printf("WIFI:off");
|
||||
if (cfg.blescan)
|
||||
#if (COUNT_ENS)
|
||||
if (cfg.enscount)
|
||||
dp_printf(" CWA:%-5d", cwa_report());
|
||||
else
|
||||
#endif
|
||||
dp_printf("BLTH:%-5d", count_from_libpax.ble_count);
|
||||
dp_printf("BLTH:%-5d", count_from_libpax.ble_count);
|
||||
else
|
||||
dp_printf(" BLTH:off");
|
||||
#elif ((WIFICOUNTER) && (!BLECOUNTER))
|
||||
@@ -284,12 +279,7 @@ void dp_drawPage(bool nextpage) {
|
||||
#elif ((!WIFICOUNTER) && (BLECOUNTER))
|
||||
if (cfg.blescan)
|
||||
dp_printf("BLTH:%-5d", count_from_libpax.ble_count);
|
||||
#if (COUNT_ENS)
|
||||
if (cfg.enscount)
|
||||
dp_printf("(CWA:%d)", cwa_report());
|
||||
else
|
||||
#endif
|
||||
dp_printf("BLTH:off");
|
||||
dp_printf("BLTH:off");
|
||||
#else
|
||||
dp_printf("Sniffer disabled");
|
||||
#endif
|
||||
|
||||
@@ -90,12 +90,7 @@ function decodeUplink(input) {
|
||||
data = decode(input.bytes, [uint32, uint8], ['time', 'timestatus']);
|
||||
}
|
||||
}
|
||||
|
||||
if (input.fPort === 10) {
|
||||
// ENS count
|
||||
data = decode(input.bytes, [uint16], ['ens']);
|
||||
}
|
||||
|
||||
|
||||
data.bytes = input.bytes; // comment out if you do not want to include the original payload
|
||||
data.port = input.fPort; // comment out if you do not want to inlude the port
|
||||
|
||||
|
||||
@@ -337,15 +337,9 @@ void setup() {
|
||||
// initialize sensors
|
||||
#if (HAS_SENSORS)
|
||||
#if (HAS_SENSOR_1)
|
||||
#if (COUNT_ENS)
|
||||
ESP_LOGI(TAG, "init CWA-counter");
|
||||
if (cwa_init())
|
||||
strcat_P(features, " CWA");
|
||||
#else
|
||||
strcat_P(features, " SENS(1)");
|
||||
sensor_init();
|
||||
#endif
|
||||
#endif
|
||||
#if (HAS_SENSOR_2)
|
||||
strcat_P(features, " SENS(2)");
|
||||
sensor_init();
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
#define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms
|
||||
#define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle
|
||||
|
||||
// Corona Exposure Notification Service(ENS) counter
|
||||
#define COUNT_ENS 0 // count found number of devices which advertise Exposure Notification Service
|
||||
// set to 1 if you want to enable this function [default=0]
|
||||
|
||||
/* Note: guide for setting bluetooth parameters
|
||||
*
|
||||
* |< Scan Window > |< Scan Window > | ... |< Scan Window > |
|
||||
|
||||
+1
-10
@@ -397,15 +397,6 @@ void set_flush(uint8_t val[]) {
|
||||
// used to open receive window on LoRaWAN class a nodes
|
||||
};
|
||||
|
||||
void set_enscount(uint8_t val[]) {
|
||||
ESP_LOGI(TAG, "Remote command: set ENS_COUNT to %s", val[0] ? "on" : "off");
|
||||
cfg.enscount = val[0] ? 1 : 0;
|
||||
if (val[0])
|
||||
cfg.payloadmask |= (uint8_t)SENSOR1_DATA;
|
||||
else
|
||||
cfg.payloadmask &= (uint8_t)~SENSOR1_DATA;
|
||||
}
|
||||
|
||||
void set_loadconfig(uint8_t val[]) {
|
||||
ESP_LOGI(TAG, "Remote command: load config from NVRAM");
|
||||
loadConfig();
|
||||
@@ -430,7 +421,7 @@ static const cmd_t table[] = {
|
||||
{0x10, set_rgblum, 1}, {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},
|
||||
{0x18, set_flush, 0}, {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},
|
||||
|
||||
@@ -159,10 +159,6 @@ void sendData() {
|
||||
payload.reset();
|
||||
payload.addSensor(sensor_read(1));
|
||||
SendPayload(SENSOR1PORT);
|
||||
#if (COUNT_ENS)
|
||||
if (cfg.countermode != 1)
|
||||
cwa_clear();
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if (HAS_SENSOR_2)
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
#include "globals.h"
|
||||
#include "sensor.h"
|
||||
|
||||
#if (COUNT_ENS)
|
||||
#include "payload.h"
|
||||
#include "corona.h"
|
||||
extern PayloadConvert payload;
|
||||
#endif
|
||||
|
||||
// Local logging tag
|
||||
static const char TAG[] = __FILE__;
|
||||
|
||||
@@ -53,16 +47,10 @@ uint8_t *sensor_read(uint8_t sensor) {
|
||||
case 1:
|
||||
|
||||
// insert user specific sensor data frames here
|
||||
// note: Sensor1 fields are used for ENS count, if ENS detection enabled
|
||||
#if (COUNT_ENS)
|
||||
if (cfg.enscount)
|
||||
payload.addCount(cwa_report(), MAC_SNIFF_BLE_ENS);
|
||||
#else
|
||||
buf[0] = length;
|
||||
buf[1] = 0x01;
|
||||
buf[2] = 0x02;
|
||||
buf[3] = 0x03;
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
|
||||
|
||||
Reference in new issue
Block a user