source: tmcsimulator/branches/FEPSimulator/DataPacker.h @ 159

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

network.h: commented data structs, DataPacker?.h moved include to header from source

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#include <stdio.h>
20
21class DataPacker {
22   
23public:
24    /**
25     * Returns packed data message to be sent to ATMS Server in fep_reply via RPC
26     *
27     * @param station The station for which the message is to be made
28     * @return The packed data message
29     */
30    static unsigned char * packData(STATION *station);
31
32private:
33    static unsigned char *msg;
34    // Packs the static data in message sent to ATMS
35    unsigned char * staticDataPack(STATION *station);
36    // Packs dynamic data in message sent to ATMS
37    int dynamicDataPack(STATION *station, int packNo, int pos);
38    // Sets last byte of message
39    char chksum(unsigned char *dataptr, int len);
40    // Tells whether or not data is available for specified lane
41    bool DataAvail(char flag, int num);
42    // Helper function: packs vol and occ into two byte data packet
43    VOLOCC packVOLOCC(int vol, int occ);
44
45};
46
47#endif  /* DATAPACKER_H */
48
Note: See TracBrowser for help on using the repository browser.