source: tmcsimulator/branches/fep_rpc_client/DataPacker.h @ 79

Revision 79, 1.3 KB checked in by jtorres, 9 years ago (diff)

new atmsdriver package in trunk. fep_rpc_client dynamic data packing added in branches. fep_rpc_client refactored data packing code into static DataPacker? class. Added vds_data folder into config/. Added new project configuration for ATMSDriver.

Line 
1/*
2 * File:   DataPacker.h
3 *
4 * DataPacker has a single static public method packData(..) that returns the
5 * packed data message that is sent to the ATMS Server in the fep_reply struct
6 * via RPC.
7 *
8 * @author John A. Torres
9 * @version 9/8/2017
10 */
11
12#ifndef DATAPACKER_H
13#define DATAPACKER_H
14
15// Include dependencies
16#include "network.h";
17#include <iostream>
18#include <string.h>
19
20class DataPacker {
21   
22public:
23    /**
24     * Returns packed data message to be sent to ATMS Server in fep_reply via RPC
25     *
26     * @param station The station for which the message is to be made
27     * @return The packed data message
28     */
29    static unsigned char * packData(LDS_LOOP *station);
30
31private:
32    static unsigned char *msg;
33    // Packs the static data in message sent to ATMS
34    unsigned char * staticDataPack(LDS_LOOP *station);
35    // Packs dynamic data in message sent to ATMS
36    int dynamicDataPack(LDS_LOOP *station, int packNo, int pos);
37    // Sets last byte of message
38    char chksum(unsigned char *dataptr, int len);
39    // Tells whether or not data is available for specified lane
40    bool DataAvail(char flag, int num);
41    // Helper function: packs vol and occ into two byte data packet
42    VOLOCC packVOLOCC(int vol, int occ);
43
44};
45
46#endif  /* DATAPACKER_H */
47
Note: See TracBrowser for help on using the repository browser.