2020-06-08 11:15:05 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Olaf Landsiedel
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONTACTS_H
|
|
|
|
#define CONTACTS_H
|
|
|
|
|
|
|
|
#include <zephyr.h>
|
|
|
|
#include <zephyr/types.h>
|
|
|
|
|
|
|
|
#include "covid.h"
|
2021-02-01 22:57:53 +01:00
|
|
|
#include "covid_types.h"
|
2021-07-21 14:05:08 +02:00
|
|
|
#include "ens/storage.h"
|
2021-04-25 14:57:52 +02:00
|
|
|
#include "exposure-notification.h"
|
2021-02-01 22:57:53 +01:00
|
|
|
|
2021-07-21 14:05:08 +02:00
|
|
|
typedef struct infected_for_period_key_ctx {
|
|
|
|
ENPeriodKey* key;
|
|
|
|
int infected;
|
|
|
|
} infected_for_period_key_ctx_t;
|
|
|
|
|
2021-04-25 14:57:52 +02:00
|
|
|
void print_key(_ENBaseKey* key);
|
2020-06-08 11:15:05 +02:00
|
|
|
void print_rpi(rolling_proximity_identifier_t* rpi);
|
|
|
|
void print_aem(associated_encrypted_metadata_t* aem);
|
|
|
|
|
2021-07-21 14:05:08 +02:00
|
|
|
/**
|
|
|
|
* Register a new record in the system. This includes adding it to the storage and adding it to the bloom filter.
|
|
|
|
*
|
|
|
|
* @param record record to add
|
|
|
|
* @returns 0 in case of success, -ERRNO in case of an error
|
|
|
|
*/
|
|
|
|
int register_record(record_t* record);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of infected records for a given PeriodKey.
|
|
|
|
*
|
|
|
|
* @param key the PeriodKey
|
|
|
|
* @param timestamp the timestamp of the period
|
|
|
|
*
|
|
|
|
* @returns the number of infected records or -ERRNO in case of an error
|
|
|
|
*/
|
|
|
|
int get_number_of_infected_for_period(ENPeriodKey* key, time_t timestamp);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of infected records for multiple PeriodKeys.
|
|
|
|
*
|
|
|
|
* @param ctx array of period keys and timestamps with field "infected" for the number of infected records
|
|
|
|
* @param timestamp the timestamp of the period
|
|
|
|
* @param count the number of periods in the array
|
|
|
|
*/
|
|
|
|
void get_number_of_infected_for_multiple_periods(infected_for_period_key_ctx_t* ctx, time_t timestamp, int count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup fixed test data for storage.
|
|
|
|
*/
|
|
|
|
void setup_test_data();
|
|
|
|
|
2020-06-08 11:15:05 +02:00
|
|
|
#endif
|