94 lines
2.4 KiB
C
94 lines
2.4 KiB
C
#ifndef FACILITIES_CAM_H
|
|
#define FACILITIES_CAM_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <pthread.h>
|
|
#include <stdbool.h>
|
|
|
|
#include <camv2/CAM.h>
|
|
#include <itss-transport/BTPDataIndication.h>
|
|
|
|
#include <it2s-tender/epv.h>
|
|
|
|
#define POS_HISTORY_MAX_LEN 24
|
|
#define PATH_HISTORY_MAX_LEN POS_HISTORY_MAX_LEN-1
|
|
|
|
typedef enum CID_CAM {
|
|
CID_PROTECTED_ZONES,
|
|
CID_PUBLIC_TRANSPORT,
|
|
CID_SPECIAL_TRANSPORT,
|
|
CID_DANGEROUS_GOODS,
|
|
CID_ROADWORK,
|
|
CID_RESCUE,
|
|
CID_EMERGENCY,
|
|
CID_SAFETY_CAR,
|
|
CID_CLOSED_LANES,
|
|
CID_REQUEST_FOR_RIGHT_OF_WAY,
|
|
CID_REQUEST_FOR_FREE_CROSSING_AT_A_TRAFFIC_LIGHT,
|
|
CID_NO_PASSING,
|
|
CID_NO_PASSING_FOR_TRUCKS,
|
|
CID_SPEED_LIMIT,
|
|
CID_RESERVED0,
|
|
CID_RESERVED1,
|
|
} CID_CAM_e;
|
|
|
|
typedef struct cid_ssp_bm {
|
|
const char* container;
|
|
const uint32_t bitmap_val;
|
|
} cid_ssp_bm_t;
|
|
|
|
enum CAM_CHECK_R {
|
|
CAM_OK,
|
|
CAM_INVALID,
|
|
CAM_BAD_PERMISSIONS
|
|
};
|
|
|
|
typedef struct pos_vector {
|
|
uint64_t ts;
|
|
uint16_t heading;
|
|
int32_t lon;
|
|
int32_t lat;
|
|
int32_t alt;
|
|
uint16_t speed;
|
|
} pos_vector_t;
|
|
|
|
typedef struct lightship {
|
|
bool active;
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
uint8_t type;
|
|
|
|
uint64_t last_cam;
|
|
uint64_t next_cam_max;
|
|
uint64_t next_cam_min;
|
|
|
|
uint64_t last_cam_lfc;
|
|
|
|
pos_vector_t** pos_history;
|
|
uint16_t pos_history_len;
|
|
|
|
|
|
bool is_vehicle_near;
|
|
uint64_t last_vehicle;
|
|
|
|
uint32_t vehicle_gen_min;
|
|
uint32_t vehicle_gen_max;
|
|
uint32_t rsu_gen_min;
|
|
uint32_t rsu_vehicle_permanence;
|
|
|
|
ProtectedCommunicationZone_t ** pz;
|
|
uint16_t pz_len;
|
|
} lightship_t;
|
|
|
|
lightship_t* lightship_init();
|
|
|
|
int lightship_check(lightship_t* lightship, it2s_tender_epv_t* epv);
|
|
void lightship_reset_timer(lightship_t*lightship, it2s_tender_epv_t* epv);
|
|
|
|
enum CAM_CHECK_R check_cam(void* fc, BTPDataIndication_t* bdi, CAM_t* cam, it2s_tender_epv_t* epv, uint8_t* ssp, uint32_t ssp_len);
|
|
void* ca_service(void* fc);
|
|
|
|
#endif
|