read and parse Key Export, started WiFi and CWA connection

This commit is contained in:
Lurkars
2020-07-25 13:33:03 +02:00
parent 4ba1352a05
commit 20818020d8
32 changed files with 9907 additions and 258 deletions
+12 -19
View File
@@ -15,6 +15,7 @@
#define _ena_EXPOSURE_H_
#include <stdio.h>
#include "ena-crypto.h"
#define ENA_EXPOSURE_LOG "ESP-ENA-exposure" // TAG for Logging
@@ -134,25 +135,6 @@ typedef struct __attribute__((__packed__))
int risk_score_sum; // sum of all risk_scores
} ena_exposure_summary_t;
/**
* @brief structure for a reported TEK
*/
typedef struct __attribute__((__packed__))
{
uint8_t key_data[ENA_KEY_LENGTH]; // Key of infected user
uint32_t rolling_start_interval_number; // The interval number since epoch for which a key starts
uint8_t rolling_period; // Increments of 10 minutes describing how long a key is valid
ena_report_type_t report_type; // Type of diagnosis associated with a key.
uint32_t days_since_onset_of_symptoms; // Number of days elapsed between symptom onset and the TEK being used. E.g. 2 means TEK is 2 days after onset of symptoms.
} ena_tek_reported_t;
/**
* @brief check for exposure for a reported tek and store exposure information on finding
*
* @param[in] tek_reported the reported tek to check
*/
void ena_exposure_check(ena_tek_reported_t tek_reported);
/**
* @brief calculate risk score
*
@@ -174,4 +156,15 @@ void ena_exposure_summary(ena_exposure_config_t *config, ena_exposure_summary_t
*/
ena_exposure_config_t *ena_exposure_default_config(void);
/**
* @brief reads a Temporary Exposue Key Export binary and check for exposures
*
* @param[in] buf the buffer containing the binary data
* @param[in] size the size of the buffer
*
* @return
* esp_err_t status of reading binary
*/
esp_err_t ena_exposure_check_export(uint8_t *buf, size_t size);
#endif
+13 -1
View File
@@ -15,10 +15,17 @@
#define _ena_H_
#define ENA_LOG "ESP-ENA" // TAG for Logging
#define ENA_RAM (CONFIG_ENA_RAM) // change advertising payload and therefore the BT address
#define ENA_BT_ROTATION_TIMEOUT_INTERVAL (CONFIG_ENA_BT_ROTATION_TIMEOUT_INTERVAL) // change advertising payload and therefore the BT address
#define ENA_BT_RANDOMIZE_ROTATION_TIMEOUT_INTERVAL (CONFIG_ENA_BT_RANDOMIZE_ROTATION_TIMEOUT_INTERVAL) // random intervall change for BT address change
/**
* @brief Run Exposure Notification API
*
* This runs the complete BLE logic
*
*/
void ena_run(void);
/**
* @brief Start Exposure Notification API
*
@@ -28,4 +35,9 @@
*/
void ena_start(void);
/**
* @brief stop ena
*/
void ena_stop(void);
#endif