| 1 | #ifndef __NETWORK_H_INCLUDED__ |
|---|
| 2 | #define __NETWORK_H_INCLUDED__ |
|---|
| 3 | |
|---|
| 4 | #include <stdlib.h> |
|---|
| 5 | #include <math.h> |
|---|
| 6 | #include <vector> |
|---|
| 7 | |
|---|
| 8 | using namespace std; |
|---|
| 9 | |
|---|
| 10 | /*** CONSTANTS ***/ |
|---|
| 11 | const int Fixed_Byte_To_Checksum = 25; // the first byte is not considered in the calculation of "BYTE 2" |
|---|
| 12 | const int CONTROL_DATA_LEN = 27; |
|---|
| 13 | |
|---|
| 14 | char * const dp5[8] = { "ML_1", "ML_2", "ML_3", "ML_4", "ML_5", |
|---|
| 15 | "ML_6", "HOV_Lane", "FYW_Conn"}; |
|---|
| 16 | char * const dp6[8] = { "OS_1", "OS_2", "OS_3", "OS_4", "OS_5", |
|---|
| 17 | "OS_6", "COLL_DIST_2", "COLL_DIST_OFF"}; |
|---|
| 18 | char * const dp7[8] = { "DEMAND", "PASSAGE", "QUEUE", "RAMP_ON", |
|---|
| 19 | "RAMP_OFF", "RAMP_HOV", "COLL_DIST_1", "COLL_DIST_ON"}; |
|---|
| 20 | char * 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 |
|---|
| 24 | typedef struct fep_line FEP_LINE; |
|---|
| 25 | struct 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 |
|---|
| 40 | typedef struct loop LOOP; |
|---|
| 41 | struct 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 |
|---|
| 52 | typedef struct Station STATION; |
|---|
| 53 | struct Station |
|---|
| 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 | |
|---|
| 70 | typedef struct volOcc VOLOCC; |
|---|
| 71 | struct volOcc |
|---|
| 72 | { |
|---|
| 73 | char high; |
|---|
| 74 | char low; |
|---|
| 75 | }; |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | #endif |
|---|