it2s-itss-facilities/src/pcm.h

44 lines
835 B
C

#pragma once
#include <stdbool.h>
#include <pcm/PCM.h>
#include <it2s-tender/geodesy.h>
#define MC_MAX_NEIGHBOURS 32
#define MC_RESOLUTION_TIMEOUT 1000
typedef struct {
uint64_t station_id;
bool intersecting;
uint64_t t_iid; /* initial intersection detection */
bool proposed;
uint64_t t_proposal;
} mc_neighbour_s;
typedef struct coordination {
bool active;
pthread_mutex_t lock;
uint64_t t_last_send_pcm;
uint64_t pcm_period_min;
uint64_t pcm_period_max;
mc_neighbour_s neighbours[MC_MAX_NEIGHBOURS];
uint8_t neighbours_len;
struct {
uint64_t id;
uint8_t link[8];
it2s_tender_region_t region;
} chain;
} coordination_s;
int pcm_check(void* fc, PCM_t* pcm);
void* pc_service(void* fc);
void coordination_init(coordination_s* coordination);