-
Notifications
You must be signed in to change notification settings - Fork 3
/
uCommProtocol_3C.pas
174 lines (143 loc) · 2.95 KB
/
uCommProtocol_3C.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
unit uCommProtocol_3C;
interface
uses
SysUtils, DateUtils, uInfoData;
Const
SOH = 'NDA';
ACK = 'NDA';
NAK = 'NDA';
CAN = 'NDA';
ID_INFO_DATA = 'NDA';
ID_GEN_CONF_DATA = 'NDA';
ID_GPS_CONF_DATA = 'NDA';
ID_GPRS_CONF_DATA = 'NDA';
ID_NEW_JOURN_DATA = 'NDA';
ID_PERIOD_JOURN_DATA = 'NDA';
ID_ALARM_JOURN_DATA = 'NDA';
EOS_SINGLE = 'NDA';
EOS_FIRST = 'NDA';
EOS_MIDDLE = 'NDA';
EOS_LAST = 'NDA';
EOS_TERM = 'NDA';
START_TIME_POINT = 'NDA';
GPS_FAKE = 'NDA';
type
TIMEI_STR = String[15];
PPackHeader = ^TPackHeader;
TPackHeader = record
'NDA'
end;
TPackData = record
'NDA'
end;
PIMEIHeader = ^TIMEIHeader;
TIMEIHeader = record
'NDA'
end;
PGenConfData = ^TGenConfData;
TGenConfData = record
'NDA'
end;
PGPSConfData = ^TGPSConfData;
TGPSConfData = record
'NDA'
end;
TpGPRSConfData = record
'NDA'
end;
TGPRSConfData = record
'NDA'
end;
TAllConfData = record
'NDA'
end;
function CRC_Comm3C(APtr: Pointer; ALen: Integer): Word;
function CRC7(APtr: Pointer; ALen: Integer): Byte;
function ExtractSN(ADataID: Byte; AData: PByte): Word;
function ExractIMEI(AData: PByte): TIMEI_STR;
function ExtractDataFromPack(Pack: PByte; PackLen: Integer;
var Data: PByte; var DataLen: Integer): Integer;
function DecodeInfoDateTime(IDT: TInfoDateTime): TDateTime;
function DecodeJournDateTime(UTC: Longword): TDateTime;
function DecodeLongitude(Lg: LongWord): Double;
function DecodeLatitude(Lt: LongWord): Double;
function DecodeAltitude(Alt: LongWord): Double;
function DecodeSpeed(Spd: Word): Double;
function DecodeCourse(Crs: Word): Double;
function DecodeIP(IP: LongWord): String;
function EOS_OfPack(AData: PByte): Byte;
implementation
function ExractIMEI(AData: PByte): TIMEI_STR;
var
HLWord, LLWord: LongWord;
begin
'NDA'
end;
function ExtractSN(ADataID: Byte; AData: PByte): Word;
begin
'NDA'
end;
function CRC_Comm3C(APtr: Pointer; ALen: Integer): Word;
var
i, j: Integer;
begin
'NDA'
end;
function CRC7(APtr: Pointer; ALen: Integer): Byte;
var
tCRC: Byte;
i: Integer;
begin
'NDA'
end;
function ExtractDataFromPack(Pack: PByte; PackLen: Integer;
var Data: PByte; var DataLen: Integer): Integer;
var
Header: PPackHeader;
DataCRC: PWord;
TempCRC: Word;
begin
'NDA'
end;
function DecodeInfoDateTime(IDT: TInfoDateTime): TDateTime;
var
FullYear: Word;
begin
'NDA'
end;
function DecodeJournDateTime(UTC: Longword): TDateTime;
begin
'NDA'
end;
function DecodeLongitude(Lg: LongWord): Double;
begin
'NDA'
end;
function DecodeLatitude(Lt: LongWord): Double;
begin
'NDA'
end;
function DecodeAltitude(Alt: LongWord): Double;
begin
'NDA'
end;
function DecodeSpeed(Spd: Word): Double;
begin
'NDA'
end;
function DecodeCourse(Crs: Word): Double;
begin
'NDA'
end;
function DecodeIP(IP: LongWord): String;
var
p: PByte;
tmpStr: String;
begin
'NDA'
end;
function EOS_OfPack(AData: PByte): Byte;
begin
'NDA'
end;
end.