Move type declarations in contacts.h

This commit is contained in:
H1ghBre4k3r 2021-02-01 22:57:53 +01:00 committed by Patrick Rathje
parent fa8d82c496
commit 917f103999
2 changed files with 31 additions and 37 deletions

View File

@ -24,41 +24,6 @@
#include "exposure-notification.h"
#include "covid.h"
typedef struct contact {
uint32_t most_recent_contact_time; //TODO: what is the correct type here?
uint32_t first_contact_time; //TODO: what is the correct type here?
uint16_t cnt;
int8_t max_rssi;
rolling_proximity_identifier_t rolling_proximity_identifier;
associated_encrypted_metadata_t associated_encrypted_metadata;
} contact_t;
//short term contacts: number of people we meet in the 5 minute window. Records any contact, will later be checked whether this contact is longer than 5 minutes
#ifndef MAX_CONTACTS
#define MAX_CONTACTS 1000
#endif
//number of contact during on day.
#ifndef MAX_PERIOD_CONTACTS
#define MAX_PERIOD_CONTACTS 400
#endif
//number of perdios (=days) we record data for
#ifndef PERIODS
#define PERIODS 14
#endif
typedef struct period_contacts{
int cnt;
period_contact_t period_contacts[MAX_PERIOD_CONTACTS];
} period_contacts_t;
static contact_t contacts[MAX_CONTACTS];
static uint32_t contact_count = 0;

View File

@ -10,17 +10,46 @@
#include <zephyr.h>
#include <zephyr/types.h>
#include "covid_types.h"
#include "covid.h"
#include "covid_types.h"
//short term contacts: number of people we meet in the 5 minute window. Records any contact, will later be checked whether this contact is longer than 5 minutes
#ifndef MAX_CONTACTS
#define MAX_CONTACTS 1000
#endif
//number of contact during on day.
#ifndef MAX_PERIOD_CONTACTS
#define MAX_PERIOD_CONTACTS 400
#endif
//number of perdios (=days) we record data for
#ifndef PERIODS
#define PERIODS 14
#endif
typedef struct period_contact {
uint32_t duration;
uint16_t cnt;
int8_t max_rssi; //TODO also store avg rssi?
int8_t max_rssi; //TODO also store avg rssi?
rolling_proximity_identifier_t rolling_proximity_identifier;
associated_encrypted_metadata_t associated_encrypted_metadata;
} period_contact_t;
typedef struct period_contacts {
int cnt;
period_contact_t period_contacts[MAX_PERIOD_CONTACTS];
} period_contacts_t;
typedef struct contact {
uint32_t most_recent_contact_time; //TODO: what is the correct type here?
uint32_t first_contact_time; //TODO: what is the correct type here?
uint16_t cnt;
int8_t max_rssi;
rolling_proximity_identifier_t rolling_proximity_identifier;
associated_encrypted_metadata_t associated_encrypted_metadata;
} contact_t;
void init_contacts();
int check_add_contact(uint32_t contact_time, rolling_proximity_identifier_t* rpi, associated_encrypted_metadata_t* aem, int8_t rssi);
void key_change(int current_period_index);