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

Revision 79, 1.9 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#ifndef __NETWORK_H_INCLUDED__
2#define __NETWORK_H_INCLUDED__
3
4#include <stdlib.h>
5#include <math.h>
6#include <vector>
7
8using namespace std;
9
10/*** CONSTANTS ***/
11const int Fixed_Byte_To_Checksum = 25; // the first byte is not considered in the calculation of "BYTE 2"
12const int CONTROL_DATA_LEN = 27;
13
14char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5",
15                                                "ML_6", "HOV_Lane", "FYW_Conn"};
16char * const dp6[8] = { "OS_1", "OS_2", "OS_3", "OS_4", "OS_5",
17                                                "OS_6", "COLL_DIST_2", "COLL_DIST_OFF"};
18char * const dp7[8] = { "DEMAND", "PASSAGE", "QUEUE", "RAMP_ON",
19                                                "RAMP_OFF", "RAMP_HOV", "COLL_DIST_1", "COLL_DIST_ON"};
20char * const dp8[8] = { "SD_1", "SD_2", "SD_3", "SD_4", "SD_5",
21                                                "SD_6", "Pass_Vol_Count", "X"};
22
23// FEP line: has several lds
24typedef struct fep_line FEP_LINE;
25struct  fep_line
26{
27        int             lineNum;
28        vector<long>    lds;
29        vector<long>    ldsIndex;       // location in ldsMap
30
31        short   count;  // actual count from caltrans
32        int     schedule;
33        int     lineInfo;
34        long    systemKey;
35        long    globalSeq;
36        long    schedleSeq;
37};
38
39// Loop detector
40typedef struct loop LOOP;
41struct loop
42{
43    long loopID;
44    char *loop_loc;
45   
46    int vol;
47    float occ;
48    double spd;
49};
50
51// Loop detector station: has several loops
52typedef struct Lds_loop LDS_LOOP;
53struct  Lds_loop
54{
55        // Each lds has its own line_num and drop (Caltrans use)
56        long    lds;
57        short   line_num;
58        short   drop;
59       
60        vector<LOOP*> loops;
61
62        // LDS data
63        unsigned char   *dataPack;
64        int             length;         // total length of data (max: 87)
65        int             pos;            // pointer for data preparation
66        int             MlTotVol;       // each 30 sec, the following will be updated
67        int             OppTotVol;      // each 30 sec, the following will be updated
68};
69
70typedef struct volOcc VOLOCC;
71struct  volOcc
72{
73   char high;
74   char low;
75};
76
77
78#endif
Note: See TracBrowser for help on using the repository browser.