2020-07-11 12:11:34 +02:00
|
|
|
/**
|
|
|
|
* provide bluetooth part of Exposure Notification API v1.2 as defined by Apple/Google
|
2020-07-11 17:33:47 +02:00
|
|
|
*
|
2020-07-11 12:11:34 +02:00
|
|
|
* Source documents:
|
2020-07-11 17:33:47 +02:00
|
|
|
*
|
2020-07-11 12:11:34 +02:00
|
|
|
* https://blog.google/documents/70/Exposure_Notification_-_Bluetooth_Specification_v1.2.2.pdf
|
2020-07-11 17:33:47 +02:00
|
|
|
*
|
2020-07-11 12:11:34 +02:00
|
|
|
* https://covid19-static.cdn-apple.com/applications/covid19/current/static/detection-tracing/pdf/ExposureNotification-BluetoothSpecificationv1.2.pdf
|
2020-07-11 17:33:47 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
2020-07-11 12:11:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include "esp_system.h"
|
|
|
|
#include "esp_log.h"
|
|
|
|
|
|
|
|
#include "ena.h"
|
|
|
|
#include "ena-storage.h"
|
|
|
|
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
|
|
|
|
void app_main(void)
|
|
|
|
{
|
|
|
|
// DEBUG set time
|
|
|
|
struct timeval tv = {1594459800, 0}; // current hardcoded timestamp (2020-07-11 09:30:00) ¯\_(ツ)_/¯
|
|
|
|
settimeofday(&tv, NULL);
|
|
|
|
|
|
|
|
esp_log_level_set(ENA_STORAGE_LOG, ESP_LOG_INFO);
|
2020-07-11 17:33:47 +02:00
|
|
|
ena_storage_erase(); // only needed on first start! TODO automatically check
|
2020-07-11 12:11:34 +02:00
|
|
|
|
|
|
|
ena_init();
|
|
|
|
|
|
|
|
// one second loop enough?
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
ena_run();
|
|
|
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
|
|
}
|
|
|
|
}
|
2020-07-11 17:33:47 +02:00
|
|
|
|