Remove unnecessary variables and structures

This commit is contained in:
Marco 2021-05-21 14:50:19 +01:00
parent 71441e1587
commit ae9194665e
2 changed files with 32 additions and 51 deletions

View File

@ -371,7 +371,7 @@ void mk_cpm(facilities_t* facilities,CPM_t* cpm_tx, struct timespec* systemtime)
cpm_tx->header.protocolVersion = PROTOCOL_VERSION; cpm_tx->header.protocolVersion = PROTOCOL_VERSION;
cpm_tx->header.messageID = MESSAGE_ID; cpm_tx->header.messageID = MESSAGE_ID;
cpm_tx->header.stationID = STATION_ID; cpm_tx->header.stationID = facilities->id.value;
uint64_t generationDeltaTime = it2s_tender_get_clock(&facilities->epv) % 65536; // generationDeltaTime = TimestampIts mod 65 536 uint64_t generationDeltaTime = it2s_tender_get_clock(&facilities->epv) % 65536; // generationDeltaTime = TimestampIts mod 65 536

View File

@ -9,21 +9,14 @@
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <net/if.h>
#include <linux/if_packet.h>
#define LEAP_SECONDS 5
#define READ_BUFFER_SIZE 1024 // Buffer for Serial and Ethernet read function (Used in cp_service) #define READ_BUFFER_SIZE 1024 // Buffer for Serial and Ethernet read function (Used in cp_service)
#define STATION_ID 10
#define MESSAGE_ID 14
#define PROTOCOL_VERSION 1
#define CAN_BUFFER_SIZE 24 // Send cmd Buffer
#define CAN_SMS_BUFFER_SIZE 25 // Send cmd Buffer for sms transport protocol
#define SERIAL_PORT_BUFFER 13 // string buffer serial interface
#define BAUDRATE B115200 // default Baudrate
#define CRC16_LENGTH 2
#define CRC16_START_VALUE 0xFFFF // Start value CRC16 CCITT
#define NOF_OBJECTS 127 // Number of Object UMRR-0C #define NOF_OBJECTS 127 // Number of Object UMRR-0C
#define ROAD_ANGLE 120 #define ROAD_ANGLE 120
#define MESSAGE_ID 14
#define PROTOCOL_VERSION 1
#define RADAR_IP "11.11.11.13" // ITS-S interface connected to the radar #define RADAR_IP "11.11.11.13" // ITS-S interface connected to the radar
#define RADAR_PORT "55555" // Destination port from the radar #define RADAR_PORT "55555" // Destination port from the radar
@ -35,7 +28,7 @@ typedef struct
{ {
int i32_socket; // Socket descriptor server int i32_socket; // Socket descriptor server
int i32_client; // Socket descriptor UMRR-0C int i32_client; // Socket descriptor UMRR-0C
int i32_port; // listen on Port int i32_port; // Listen on Port
bool b_moxa; bool b_moxa;
struct sockaddr_in s_server; struct sockaddr_in s_server;
struct sockaddr_in s_client; struct sockaddr_in s_client;
@ -43,10 +36,10 @@ typedef struct
typedef struct typedef struct
{ {
int i32_fdSerial; //Serial Port descriptor int raw_fd;
char c_portNumber; struct sockaddr_ll sll;
struct termios s_config; struct ifreq ifr;
} S_SERIAL_T; } S_INTERFACE_CONNECTION_T;
typedef struct typedef struct
{ {
@ -62,35 +55,6 @@ typedef struct
u_int16_t u8_laneNumber; u_int16_t u8_laneNumber;
} S_PVR_T; } S_PVR_T;
typedef struct
{
u_int8_t u8_devid;
u_int8_t u8_partyp;
u_int8_t u8_parno;
int32_t i32_value;
float f_value;
u_int8_t u8_action;
u_int8_t u8_xor;
u_int8_t au8_can_cmd[CAN_BUFFER_SIZE];
u_int8_t au8_can_cmd_SMS_TRANSPORT_PROTOCOL[CAN_SMS_BUFFER_SIZE];
} S_COMMAND_T;
typedef struct
{
u_int16_t u16_startPattern;
u_int8_t u8_protocolVersion;
u_int8_t u8_headerLength;
u_int16_t u16_payloadLength;
u_int8_t u8_AppProtocolType;
u_int32_t u32_flags;
u_int16_t u16_headerCRC16;
u_int8_t au8_Payload[1024];
u_int8_t au8_Header[1024];
u_int16_t u16_PayloadCRC16;
u_int16_t u16_indexHeader;
u_int16_t u16_indexPayload;
} S_SMS_DATA_FRAME_T;
typedef struct typedef struct
{ {
u_int8_t u8_sensorStatus; u_int8_t u8_sensorStatus;
@ -166,13 +130,31 @@ typedef struct
uint64_t T_GenCpmMin; uint64_t T_GenCpmMin;
uint64_t T_GenCpmMax; uint64_t T_GenCpmMax;
/* Position of the radar (Value from toml) */ /* Position of the radar (Value from toml) */
int8_t radar_rotation; int8_t radar_rotation;
} dissemination_t; } dissemination_t;
/* Prototype Functions */ /* Prototype Functions */
/*
Summary : Waits for client to connect (Radar)
*/
bool waitingIncomingConnection(void);
/*
Summary : Creation of socket and binding to the radar add and port
param [in] char* radar_ip: Radar IP
param [in] char* radar_port: Radar PORT
*/
bool initEthernetConnection(const char* radar_ip,const char* radar_port);
/* /*
Summary : Initialization for dissemination control. (Memory allocation and mutex init Summary : Initialization for dissemination control. (Memory allocation and mutex init
@ -192,7 +174,6 @@ bool initEthernetConnection(const char* radar_ip,const char* radar_port);
/* /*
Summary: Read from Radar socket (s_socket.i32_socket) call the function to interpret data Summary: Read from Radar socket (s_socket.i32_socket) call the function to interpret data
param[in] void param[in] void
*/ */
void* cp_service(void* fc); void* cp_service(void* fc);