mirror of
https://github.com/Lurkars/esp-ena.git
synced 2026-05-08 20:10:37 +02:00
add/update interface
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#define _ena_EXPOSURE_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "ena-crypto.h"
|
||||
|
||||
#define ENA_EXPOSURE_LOG "ESP-ENA-exposure" // TAG for Logging
|
||||
@@ -135,6 +135,7 @@ typedef struct __attribute__((__packed__))
|
||||
*/
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
uint32_t last_update; // timestamp of last update of exposure data
|
||||
int days_since_last_exposure; // Number of days since the most recent exposure.
|
||||
int num_exposures; // Number of all exposure information
|
||||
int max_risk_score; // max. risk score of all exposure information
|
||||
@@ -142,10 +143,52 @@ typedef struct __attribute__((__packed__))
|
||||
} ena_exposure_summary_t;
|
||||
|
||||
/**
|
||||
* @brief calculate risk score
|
||||
* @brief calculate transmission risk score
|
||||
*
|
||||
* @param[in] config the exposure configuration used for calculating score
|
||||
* @param[in] params the exposure parameter to calculate with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int ena_exposure_transmission_risk_score(ena_exposure_config_t *config, ena_exposure_parameter_t params);
|
||||
|
||||
/**
|
||||
* @brief calculate duration risk score
|
||||
*
|
||||
* @param[in] config the exposure configuration used for calculating score
|
||||
* @param[in] params the exposure parameter to calculate with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int ena_exposure_duration_risk_score(ena_exposure_config_t *config, ena_exposure_parameter_t params);
|
||||
|
||||
/**
|
||||
* @brief calculate days risk score
|
||||
*
|
||||
* @param[in] config the exposure configuration used for calculating score
|
||||
* @param[in] params the exposure parameter to calculate with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int ena_exposure_days_risk_score(ena_exposure_config_t *config, ena_exposure_parameter_t params);
|
||||
|
||||
/**
|
||||
* @brief calculate attenuation risk score
|
||||
*
|
||||
* @param[in] config the exposure configuration used for calculating score
|
||||
* @param[in] params the exposure parameter to calculate with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int ena_exposure_attenuation_risk_score(ena_exposure_config_t *config, ena_exposure_parameter_t params);
|
||||
|
||||
/**
|
||||
* @brief calculate overall risk score
|
||||
*
|
||||
* @param[in] config the exposure configuration used for calculating score
|
||||
* @param[in] params the exposure parameter to calculate with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int ena_exposure_risk_score(ena_exposure_config_t *config, ena_exposure_parameter_t params);
|
||||
|
||||
@@ -153,12 +196,22 @@ int ena_exposure_risk_score(ena_exposure_config_t *config, ena_exposure_paramete
|
||||
* @brief returns the current exposure summary
|
||||
*
|
||||
* @param[in] config the exposure configuration used for calculating scores
|
||||
* @param[out] summary pointer to exposure summary to write to
|
||||
*/
|
||||
void ena_exposure_summary(ena_exposure_config_t *config, ena_exposure_summary_t *summary);
|
||||
void ena_exposure_summary(ena_exposure_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief return the current exposure summary
|
||||
*
|
||||
* @return
|
||||
* ena_exposure_summary_t pointer to the current exposure summary
|
||||
*/
|
||||
ena_exposure_summary_t *ena_exposure_current_summary(void);
|
||||
|
||||
/**
|
||||
* @brief return a default exposure configuration
|
||||
*
|
||||
* @return
|
||||
* ena_exposure_config_t default exposure configuration
|
||||
*/
|
||||
ena_exposure_config_t *ena_exposure_default_config(void);
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
#include "ena-crypto.h"
|
||||
|
||||
#define ENA_STORAGE_LOG "ESP-ENA-storage" // TAG for Logging
|
||||
#define ENA_STORAGE_PARTITION_NAME (CONFIG_ENA_STORAGE_PARTITION_NAME) // name of partition to use for storing
|
||||
#define ENA_STORAGE_START_ADDRESS (CONFIG_ENA_STORAGE_START_ADDRESS) // start address of storage
|
||||
#define ENA_STORAGE_TEK_MAX (CONFIG_ENA_STORAGE_TEK_MAX) // Period of storing TEKs // length of a stored beacon -> RPI keysize + AEM size + 4 Bytes for ENIN + 4 Bytes for RSSI
|
||||
#define ENA_STORAGE_TEMP_BEACONS_MAX (CONFIG_ENA_STORAGE_TEMP_BEACONS_MAX) // Maximum number of temporary stored beacons // length of a stored beacon -> RPI keysize + AEM size + 4 Bytes for ENIN + 4 Bytes for RSSI
|
||||
#define ENA_STORAGE_LOG "ESP-ENA-storage" // TAG for Logging
|
||||
#define ENA_STORAGE_PARTITION_NAME (CONFIG_ENA_STORAGE_PARTITION_NAME) // name of partition to use for storing
|
||||
#define ENA_STORAGE_START_ADDRESS (CONFIG_ENA_STORAGE_START_ADDRESS) // start address of storage
|
||||
#define ENA_STORAGE_TEK_MAX (CONFIG_ENA_STORAGE_TEK_MAX) // Period of storing TEKs // length of a stored beacon -> RPI keysize + AEM size + 4 Bytes for ENIN + 4 Bytes for RSSI
|
||||
#define ENA_STORAGE_TEMP_BEACONS_MAX (CONFIG_ENA_STORAGE_TEMP_BEACONS_MAX) // Maximum number of temporary stored beacons // length of a stored beacon -> RPI keysize + AEM size + 4 Bytes for ENIN + 4 Bytes for RSSI
|
||||
#define ENA_STORAGE_EXPOSURE_INFORMATION_MAX (CONFIG_ENA_STORAGE_EXPOSURE_INFORMATION_MAX) // Maximum number of stored exposure information
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ typedef struct __attribute__((__packed__))
|
||||
uint32_t day; // Day of the exposure, using UTC, encapsulated as the time of the beginning of that day.
|
||||
int typical_attenuation; // Aggregation of the attenuations of all of a given diagnosis key's beacons received during the scan, in dB.
|
||||
int min_attenuation; // Minimum attenuation of all of a given diagnosis key's beacons received during the scan, in dB.
|
||||
int duration_minutes; //The duration of the exposure in minutes.
|
||||
int duration_minutes; //The duration of the exposure in minutes.
|
||||
int report_type; // Type of diagnosis associated with a key.
|
||||
} ena_exposure_information_t;
|
||||
|
||||
@@ -90,6 +90,21 @@ void ena_storage_write(size_t address, void *data, size_t size);
|
||||
*/
|
||||
void ena_storage_shift_delete(size_t address, size_t end_address, size_t size);
|
||||
|
||||
/**
|
||||
* @brief get timestamp of most recent exposure data
|
||||
*
|
||||
* @return
|
||||
* unix timestamp
|
||||
*/
|
||||
uint32_t ena_storage_read_last_exposure_date(void);
|
||||
|
||||
/**
|
||||
* @brief set timestamp of most recent exposure data
|
||||
*
|
||||
* @param[in] timestamp unix timestamp
|
||||
*/
|
||||
void ena_storage_write_last_exposure_date(uint32_t timestamp);
|
||||
|
||||
/**
|
||||
* @brief get last stored TEK
|
||||
*
|
||||
@@ -218,7 +233,6 @@ void ena_storage_erase(void);
|
||||
*/
|
||||
void ena_storage_erase_tek(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief erase all stored exposure information
|
||||
*
|
||||
@@ -248,7 +262,6 @@ void ena_storage_erase_beacon(void);
|
||||
*/
|
||||
void ena_storage_dump_teks(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief dump all stored exposure information to serial output
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user