/* * File: DataPacker.h * * DataPacker has a single static public method packData(..) that returns the * packed data message that is sent to the ATMS Server in the fep_reply struct * via RPC. * * @author John A. Torres * @version 9/8/2017 */ #ifndef DATAPACKER_H #define DATAPACKER_H // Include dependencies #include "network.h" #include #include #include class DataPacker { public: /** * Returns packed data message to be sent to ATMS Server in fep_reply via RPC * * @param station The station for which the message is to be made * @return The packed data message */ static unsigned char * packData(STATION *station); private: static unsigned char *msg; // Packs the static data in message sent to ATMS unsigned char * staticDataPack(STATION *station); // Packs dynamic data in message sent to ATMS int dynamicDataPack(STATION *station, int packNo, int pos); // Sets last byte of message char chksum(unsigned char *dataptr, int len); // Tells whether or not data is available for specified lane bool DataAvail(char flag, int num); // Helper function: packs vol and occ into two byte data packet VOLOCC packVOLOCC(int vol, int occ); }; #endif /* DATAPACKER_H */