-
-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #631 from cyberman54/CWA
Covid-19 exposure notifications system scanning function
- Loading branch information
Showing
17 changed files
with
237 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef _CORONA_h | ||
#define _CORONA_H | ||
|
||
// inspired by https://github.com/kmetz/BLEExposureNotificationBeeper | ||
// (c) by Kaspar Metz | ||
// modified for use in the Paxcounter by AQ | ||
|
||
#include "globals.h" | ||
#include <map> | ||
|
||
bool cwa_init(void); | ||
void cwa_mac_add(uint16_t hashedmac); | ||
void cwa_clear(void); | ||
uint16_t cwa_report(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,6 @@ | |
#include "sensor.h" | ||
#include "lorawan.h" | ||
#include "timekeeper.h" | ||
#include "corona.h" | ||
|
||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,19 +37,19 @@ halfile = generic.h | |
|
||
[platformio] | ||
; upload firmware to board with usb cable | ||
;default_envs = usb | ||
default_envs = usb | ||
; upload firmware to a jfrog bintray repository | ||
;default_envs = ota | ||
; use latest versions of libraries | ||
default_envs = dev | ||
;default_envs = dev | ||
description = Paxcounter is a device for metering passenger flows in realtime. It counts how many mobile devices are around. | ||
|
||
[common] | ||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c" | ||
release_version = 1.9.996 | ||
release_version = 2.0.1 | ||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! | ||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose | ||
debug_level = 4 | ||
debug_level = 3 | ||
extra_scripts = pre:build.py | ||
otakeyfile = ota.conf | ||
lorakeyfile = loraconf.h | ||
|
@@ -64,16 +64,16 @@ lib_deps_display = | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
TFT_eSPI@>=2.2.8 | ||
TFT_eSPI@>=2.2.18 | ||
lib_deps_ledmatrix = | ||
Ultrathin_LED_Matrix@>=1.0.0 | ||
lib_deps_rgbled = | ||
SmartLeds@>=1.2.0 | ||
SmartLeds@>=1.2.1 | ||
lib_deps_gps = | ||
1655@>=1.0.2 ; #1655 TinyGPSPlus by Mikal Hart | ||
lib_deps_sensors = | ||
Adafruit Unified Sensor@>=1.1.4 | ||
Adafruit BME280 Library@>=2.0.2 | ||
Adafruit BME280 Library@>=2.1.0 | ||
Adafruit BMP085 Library@>=1.1.0 | ||
BSEC Software [email protected] | ||
https://github.com/ricki-z/SDS011.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// 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) | ||
|
||
// 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 SOME_FORM_OF_DEBUG | ||
ESP_LOGD(TAG, "CWA: forget old notifier: %d", cwaSeenNotifiers.size()); | ||
for (auto const ¬ifier : cwaSeenNotifiers) { | ||
ESP_LOGD(TAG, "CWA forget <%X>", 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.