吕
吕雪松
Unregistered / Unconfirmed
GUEST, unregistred user!
//Fix Data
//Example
//$GPGGA,235947.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,,,,0000*00
//$GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,19.7,M,,,,0000*1F
procedure TCommForm.DoSentence_GPGGA(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin
TY := GetStrItem(Sentence,',',3);
TX := GetStrItem(Sentence,',',5);
XX := 0.0;
YY := 0.0;
if (TY <> '') and (TX <> '') then
begin
YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;
IsLocated(XX,YY);
TimeStr := GetStrItem(Sentence,',',2);
UpdateTimeInfo(TimeStr);
UpdateCurStar(GetStrItem(Sentence,',',8));
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',6),GetStrItem(Sentence,',',4));
UpdateHDOPInfo(GetStrItem(Sentence,',',9));
UpdateDGPSInfo(GetStritem(Sentence,',',14),GetStrItem(GetStritem(Sentence,',',15),'*',1));
UpdateElevation(GetStrItem(Sentence,',',10));
end;
procedure TCommForm.DoSentence_GPGLL(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin
TY := GetStrItem(Sentence,',',2);
TX := GetStrItem(Sentence,',',4);
XX := 0.0;
YY := 0.0;
if (TY <> '') and (TX <> '') then
begin
YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;
IsLocated(XX,YY);
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',5),GetStrItem(Sentence,',',3));
UpdateTimeInfo(GetStrItem(Sentence,',',6));
end;
//目前可用的卫星
//$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
procedure TCommForm.DoSentence_GPGSA(Sentence : string);
var
ID : string;
Mode1,Mode2 : string;
I : integer;
begin
ID := Trim(GetStrItem(Sentence,',',2));
if ID = 'A' then
Mode1 := 'Auto 2D/3D' else
if ID = 'M' then
Mode1 := 'Forced 2D/3D';
ID := Trim(GetStrItem(Sentence,',',3));
if ID = '1' then
Mode2 := 'No Fix' else
if ID = '2' then
Mode2 := '2D' else
if ID = '3' then
Mode2 := '3D';
InitializeSignal;
for I := 4 to 15do
begin
ID := Trim(GetStrItem(Sentence,',',I));
UpdateActiveStar(I - 3,ID);
end;
UpdatePDOPInfo(GetStrItem(Sentence,',',16));
UpdateHDOPInfo(GetStrItem(Sentence,',',17));
UpdateVDOPInfo(GetStrItem(Sentence,',',18));
end;
procedure TCommForm.InitializeSignal;
var
I : integer;
begin
for I := 0 to 11do
begin
if ChannelList.Shape.Brush.Color = clBtnFace then
begin
ChannelList.Shape.Visible := FALSE;
ChannelList.Shape.Height := 0;
ChannelList.Shape.Top := 168 - ChannelList.Shape.Height;
ChannelList.Label_.Caption := '';
ChannelList.Shape.Visible := TRUE;
// Refresh;
end;
ChannelList.Shape.Brush.Color := clBtnFace;
end;
end;
procedure TCommForm.DoSentence_GPGSV(Sentence : string);
var
SeqNum : integer;
Star : TGeoStar;
TempInt,I : integer;
SNRStr : string;
SID : string;
begin
//得到报文数
MsgCount := StrToInt(GetStrItem(Sentence,',',2));
//当前报文序号
SeqNum := StrToInt(GetStrItem(Sentence,',',3));
if SeqNum = 1 then
begin
StarAmount := 0;
for I := 0 to StarList.Count - 1do
begin
TGeoStar(StarList.Items).Free;
end;
StarList.Clear;
end;
//得到可视未星数
StarInView := StrToInt(GetStrItem(Sentence,',',4));
TempInt := StarInView - StarAmount;
if TempInt > 4 then
TempInt := 4;
for I := 1 to TempIntdo
begin
Star := TGeoStar.Create;
SID := GetStrItem(Sentence,',',I * 4 + 1);
if SID <> '' then
begin
Star.ID := StrToInt(SID);
Star.Elevation := GetStrItem(Sentence,',',I * 4 + 2);
Star.Azimuth := GetStrItem(Sentence,',',I * 4 + 3);
if I = TempInt then
SNRStr := GetStrItem(GetStrItem(Sentence,',',I * 4 + 4),'*',1)
else
SNRStr := GetStrItem(Sentence,',',I * 4 + 4);
if Trim(SNRstr) = '' then
SNRStr := '0';
Star.SNR1 := StrToInt(SNRStr);
Star.ChannelID := I + StarAmount;
StarList.Add(Star)
end;
end;
Inc(StarAmount,TempInt);
if SeqNum = MsgCount then
begin
//更新卫星信息
//已经接收的卫星数量重新置为0
UpdateStarInfo;
end;
end;
procedure TCommForm.DoSentence_GPRMC(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin
TY := GetStrItem(Sentence,',',4);
TX := GetStrItem(Sentence,',',6);
XX := 0;
YY := 0;
if (TY <> '') and (TX <> '') then
begin
YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;
IsLocated(XX,YY);
TimeStr := GetStrItem(Sentence,',',2);
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',7),GetStrItem(Sentence,',',5));
end;
//Example
//$GPGGA,235947.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,,,,0000*00
//$GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,19.7,M,,,,0000*1F
procedure TCommForm.DoSentence_GPGGA(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin
TY := GetStrItem(Sentence,',',3);
TX := GetStrItem(Sentence,',',5);
XX := 0.0;
YY := 0.0;
if (TY <> '') and (TX <> '') then
begin
YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;
IsLocated(XX,YY);
TimeStr := GetStrItem(Sentence,',',2);
UpdateTimeInfo(TimeStr);
UpdateCurStar(GetStrItem(Sentence,',',8));
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',6),GetStrItem(Sentence,',',4));
UpdateHDOPInfo(GetStrItem(Sentence,',',9));
UpdateDGPSInfo(GetStritem(Sentence,',',14),GetStrItem(GetStritem(Sentence,',',15),'*',1));
UpdateElevation(GetStrItem(Sentence,',',10));
end;
procedure TCommForm.DoSentence_GPGLL(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin
TY := GetStrItem(Sentence,',',2);
TX := GetStrItem(Sentence,',',4);
XX := 0.0;
YY := 0.0;
if (TY <> '') and (TX <> '') then
begin
YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;
IsLocated(XX,YY);
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',5),GetStrItem(Sentence,',',3));
UpdateTimeInfo(GetStrItem(Sentence,',',6));
end;
//目前可用的卫星
//$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
procedure TCommForm.DoSentence_GPGSA(Sentence : string);
var
ID : string;
Mode1,Mode2 : string;
I : integer;
begin
ID := Trim(GetStrItem(Sentence,',',2));
if ID = 'A' then
Mode1 := 'Auto 2D/3D' else
if ID = 'M' then
Mode1 := 'Forced 2D/3D';
ID := Trim(GetStrItem(Sentence,',',3));
if ID = '1' then
Mode2 := 'No Fix' else
if ID = '2' then
Mode2 := '2D' else
if ID = '3' then
Mode2 := '3D';
InitializeSignal;
for I := 4 to 15do
begin
ID := Trim(GetStrItem(Sentence,',',I));
UpdateActiveStar(I - 3,ID);
end;
UpdatePDOPInfo(GetStrItem(Sentence,',',16));
UpdateHDOPInfo(GetStrItem(Sentence,',',17));
UpdateVDOPInfo(GetStrItem(Sentence,',',18));
end;
procedure TCommForm.InitializeSignal;
var
I : integer;
begin
for I := 0 to 11do
begin
if ChannelList.Shape.Brush.Color = clBtnFace then
begin
ChannelList.Shape.Visible := FALSE;
ChannelList.Shape.Height := 0;
ChannelList.Shape.Top := 168 - ChannelList.Shape.Height;
ChannelList.Label_.Caption := '';
ChannelList.Shape.Visible := TRUE;
// Refresh;
end;
ChannelList.Shape.Brush.Color := clBtnFace;
end;
end;
procedure TCommForm.DoSentence_GPGSV(Sentence : string);
var
SeqNum : integer;
Star : TGeoStar;
TempInt,I : integer;
SNRStr : string;
SID : string;
begin
//得到报文数
MsgCount := StrToInt(GetStrItem(Sentence,',',2));
//当前报文序号
SeqNum := StrToInt(GetStrItem(Sentence,',',3));
if SeqNum = 1 then
begin
StarAmount := 0;
for I := 0 to StarList.Count - 1do
begin
TGeoStar(StarList.Items).Free;
end;
StarList.Clear;
end;
//得到可视未星数
StarInView := StrToInt(GetStrItem(Sentence,',',4));
TempInt := StarInView - StarAmount;
if TempInt > 4 then
TempInt := 4;
for I := 1 to TempIntdo
begin
Star := TGeoStar.Create;
SID := GetStrItem(Sentence,',',I * 4 + 1);
if SID <> '' then
begin
Star.ID := StrToInt(SID);
Star.Elevation := GetStrItem(Sentence,',',I * 4 + 2);
Star.Azimuth := GetStrItem(Sentence,',',I * 4 + 3);
if I = TempInt then
SNRStr := GetStrItem(GetStrItem(Sentence,',',I * 4 + 4),'*',1)
else
SNRStr := GetStrItem(Sentence,',',I * 4 + 4);
if Trim(SNRstr) = '' then
SNRStr := '0';
Star.SNR1 := StrToInt(SNRStr);
Star.ChannelID := I + StarAmount;
StarList.Add(Star)
end;
end;
Inc(StarAmount,TempInt);
if SeqNum = MsgCount then
begin
//更新卫星信息
//已经接收的卫星数量重新置为0
UpdateStarInfo;
end;
end;
procedure TCommForm.DoSentence_GPRMC(Sentence : string);
var
XX,YY :do
uble;
TimeStr : String;
TX,TY : string;
begin
TY := GetStrItem(Sentence,',',4);
TX := GetStrItem(Sentence,',',6);
XX := 0;
YY := 0;
if (TY <> '') and (TX <> '') then
begin
YY := StrToFloat(TY);
XX := StrToFloat(TX);
//'直接端口连接'以后改成本窗口选择的设备名称
MainForm.UpdateCarList('D','端口' + ComboBox2.Text + '设备',TimeStr,'1','0',XX/100,YY/100);
end;
IsLocated(XX,YY);
TimeStr := GetStrItem(Sentence,',',2);
UpdateXYInfo(XX,YY,GetStrItem(Sentence,',',7),GetStrItem(Sentence,',',5));
end;