Warning: Can't use blame annotator:
svn blame failed on branches/green_dot/DataPacker.h: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator/branches/green_dot/DataPacker.h @ 165

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

green_dot now has datapacking implemented

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