unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OoMisc, AdPort, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
ComPort: TApdComPort;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Timer1: TTimer;
Label13: TLabel;
Edit1: TEdit;
Button1: TButton;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Procedure Ordne(Zeichenkette:
String);
procedure ComPortTriggerAvail(CP: TObject; Count: Word);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
GPGGA:
Array[1..25]
Of String;
{ Public declarations }
end;
var
Form1: TForm1;
z:
string;
x, y: Integer;
Data:
String;
I: Integer;
Ergebnis1: TStringlist;
ggaline:
String[200];
gsaline:
String[200];
rmcline:
String[200];
speed:
string;
implementation
{$R *.dfm}
Procedure TForm1.Ordne(Zeichenkette:
String);
var i,j:integer;
ZS :
String;
array_seen : boolean;
begin
ZS :='
';
array_seen := false;
j:=1;
for i:=1
to length(Zeichenkette)
do
begin
if array_seen
then
if zeichenkette[i] ='
,'
then
begin
if ZS <> '
'
then
GPGGA[j] := ZS;
j:=j+1;
ZS := '
';
end
else
zs := zs+zeichenkette[i]
else
if zeichenkette[i] ='
,'
then array_seen := true;
end;
end;
procedure TForm1.ComPortTriggerAvail(CP: TObject; Count: Word);
begin
{ OnTriggerAvail; Read the data }
for I:= 0
to Count -1
do
begin
Data := ComPort.GetChar;
z := z + Data;
if Data = #10
then
begin
Ergebnis1 := TStringlist.Create;
if pos('
GPGGA',z) > 0
then
ggaline := z;
if pos('
GPGSA',z) > 0
then
gsaline := z;
if pos('
GPRMC',z) > 0
then
rmcline := z;
z := '
';
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
type
TStringDynArray =
array of string;
begin
ordne(ggaline);
Label1.Caption := GPGGA[1];
Label2.Caption := GPGGA[2] + GPGGA[3];
Label3.Caption := GPGGA[4] + GPGGA[5];
Label4.Caption := GPGGA[6];
Label5.Caption := GPGGA[7];
Label6.Caption := GPGGA[11] + GPGGA[12];
ordne(gsaline);
Label15.Caption := GPGGA[2];
ordne(rmcline);
Label16.Caption := GPGGA[2];
Label17.Caption := GPGGA[7];
Label18.Caption := GPGGA[9];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ComPort.ComNumber := strtoint(Edit1.Text);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
speed := '
0';
end;
end.