it2s-itss-facilities/src/denm.h

54 lines
985 B
C

#ifndef FACILITIES_DENM_H
#define FACILITIES_DENM_H
#include <stdint.h>
#include <denmv2/DENM.h>
#include <pthread.h>
#include <stdbool.h>
enum EVENT_STATE {
EVENT_ACTIVE,
EVENT_CANCELLED,
EVENT_NEGATED
};
typedef struct event {
DENM_t *denm;
uint32_t station_id;
uint32_t sn;
uint64_t detection_time;
uint64_t reference_time;
uint64_t expiration_time;
uint8_t cause;
uint8_t subcause;
uint32_t latitude;
uint32_t longitude;
bool enabled;
enum EVENT_STATE state;
} event_t;
typedef struct den {
event_t ** events;
uint32_t sn;
uint16_t no_active_events;
uint16_t no_max_events;
pthread_mutex_t lock;
} den_t;
enum EVENT_CHECK_RESULT {
EVENT_NEW,
EVENT_INVALID,
EVENT_PASSED,
EVENT_CANCELLATION,
EVENT_NEGATION,
EVENT_UPDATE,
EVENT_REPEATED,
EVENT_NUMBER_EXCEEDED
};
enum EVENT_CHECK_RESULT check_event(den_t *den, DENM_t *denm);
void* den_service(void *fc);
#endif