Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
寻找健壮的Delphi NMEA解析器_Delphi_Parsing_Gps_Nmea - Fatal编程技术网

寻找健壮的Delphi NMEA解析器

寻找健壮的Delphi NMEA解析器,delphi,parsing,gps,nmea,Delphi,Parsing,Gps,Nmea,我正在寻找生产级的开源Delphi NMEA解析器 如果它能满足关键任务的要求就好了(我开玩笑!我相信用Win32系统是无法实现的) 到目前为止,我已经使用基本的windows API(NMEA 0183)通过串口实现了手腕式GPS(Garmin Foretrex 101)的基本接口 我还探索了一个开源VCL组件,用于处理与航空模型GPS(Garmin Gpsmap 196)的实验串行通信 谢谢。我最终使用了开源软件包中的t导入和t数据包 组件设置: object ComPort: TCo

我正在寻找生产级的开源Delphi NMEA解析器

如果它能满足关键任务的要求就好了(我开玩笑!我相信用Win32系统是无法实现的)

到目前为止,我已经使用基本的windows API(NMEA 0183)通过串口实现了手腕式GPS(Garmin Foretrex 101)的基本接口

我还探索了一个开源VCL组件,用于处理与航空模型GPS(Garmin Gpsmap 196)的实验串行通信


谢谢。

我最终使用了开源软件包中的t导入t数据包


组件设置:

  object ComPort: TComPort
    BaudRate = br4800
    Port = 'COM1'
    Parity.Bits = prNone
    StopBits = sbTwoStopBits
    DataBits = dbEight
    Events = [evRxChar, evTxEmpty, evRxFlag, evRing, evBreak, evCTS, evDSR, evError, evRLSD, evRx80Full]
    FlowControl.OutCTSFlow = False
    FlowControl.OutDSRFlow = False
    FlowControl.ControlDTR = dtrDisable
    FlowControl.ControlRTS = rtsDisable
    FlowControl.XonXoffOut = False
    FlowControl.XonXoffIn = False
    SyncMethod = smWindowSync
    OnAfterOpen = ComPortAfterOpen
    OnAfterClose = ComPortAfterClose
    Left = 904
    Top = 192
  end

ComDataPacket设置:

  object ComDataPacket: TComDataPacket
    ComPort = ComPort
    StartString = '$'
    StopString = '*'
    OnPacket = ComDataPacketPacket
    Left = 808
    Top = 240
  end

所用类型的摘录

type
  // NMEA 0185's messages used
  TMsgGP = (
    msgGP,    // Unknown message
    msgGPGGA, // Global Positioning System Fix Data
    msgGPGLL, // Geographic position, Latitude and Longitude
    msgGPGSV, // Satellites in view
    msgGPRMA, // Recommended minimum specific GPS/Transit data Loran C
    msgGPRMC, // Recommended minimum specific GPS/Transit data
    msgGPZDA  // Date and time
    );

  // Satellite properties
  TSatellite = record
    Identification: ShortInt;
    Elevation: 0..90;
    Azimut: Smallint;
    SignLevel: Smallint;
  end;
  // Array of satellites referenced
  TSatellites = array[1..MAX_SATS] of TSatellite;

  // GPS status informations
  TGPSDatas = record
    Latitude: Double;
    Longitude: Double;
    HeightAboveSea: Double;
    Speed: Double;
    UTCTime: TDateTime;
    Valid: Boolean;
    NbrSats: Shortint;
    NbrSatsUsed: Shortint;
  end;

ComDataPacketPacket事件处理程序:

procedure TForm1.ComDataPacketPacket(Sender: TObject; const Str: string);
var
  Resultat: TStringList;
  MsgCorrect, TypeMsg: string;
  i: Integer;
begin
  Resultat := TStringList.Create;
  try

    // Split the message into different parts.
    MsgCorrect := AnsiReplaceStr('$'+Str, ',,', ' , , ');
    Resultat.Text := AnsiReplaceStr(LeftStr(MsgCorrect, Length(MsgCorrect) - 1), ',', #13#10);

    // Get the message type
    TypeMsg := AnsiMidStr(Resultat[0], 4, 3);

    case IndexMsgGP(TypeMsg) of
      msgGPGGA:
        begin
        end;
      msgGPGLL:
        begin
        end;
      msgGPGSV:
        begin
          // If there are satellites referenced in the frame
          if Resultat.Count < 4 then
            FGPSDatas.NbrSats := 0
          else
            FGPSDatas.NbrSats := StrToInteger(Resultat[3]);

          if Resultat[2] = '1' then
          begin
            FSatRef := 0;

            // Initiate satellites values
            for i := 1 to 12 do
              with FSatellites[i] do
              begin
                Identification := 0;
                Elevation := 0;
                Azimut := 0;
                SignLevel := 0;
              end;
          end;

          i := 4;

          // For each referenced satellites
          while (i + 4) <= (Resultat.Count) do
          begin
            with FSatellites[FSatRef + 1] do
            begin
              Identification := StrToInteger(Resultat[i]);
              Elevation := StrToInteger(Resultat[i + 1]);
              Azimut := StrToInteger(Resultat[i + 2]);
              if Resultat[i + 3] <> '' then
                SignLevel := StrToInteger(Resultat[i + 3])
              else
                SignLevel := 0;
            end;
            Inc(i, 4);
            Inc(FSatRef);
          end;
        end;
      msgGPRMA:
        begin
        end;
      msgGPRMC:
        begin
        end;
      msgGPZDA:
        begin
        end;
      else
    end;
  finally
    Resultat.Free;
  end;
end;
过程TForm1.ComDataPacketPacket(发送方:TObject;const Str:string);
变量
结果:TStringList;
MsgCorrect,TypeMsg:string;
i:整数;
开始
结果:=TStringList.Create;
尝试
//将消息拆分为不同的部分。
MsgCorrect:=AnsiReplaceStr(“$”+Str,,“,”,”);
结果文本:=AnsiReplaceStr(LeftStr(MsgCorrect,Length(MsgCorrect)-1),',',#13#10);
//获取消息类型
TypeMsg:=AnsiMidStr(Resultat[0],4,3);
案例索引xmsggp(类型msg)的
msgGPGGA:
开始
结束;
msgGPGLL:
开始
结束;
msgGPGSV:
开始
//如果帧中引用了卫星
如果Resultat.Count小于4,则
FGPSDatas.NbrSats:=0
其他的
FGPSDatas.NbrSats:=strotinteger(Resultat[3]);
如果Resultat[2]=“1”,则
开始
FSatRef:=0;
//启动卫星值
对于i:=1到12 do
用F卫星[我]做
开始
标识:=0;
高程:=0;
方位角:=0;
符号级别:=0;
结束;
结束;
i:=4;
//对于每个参考卫星

虽然(i+4)不是开源的,但仍然很好。@LU-RD:谢谢,ZylSolf写了很多优秀的组件。如果你认为有些东西是无法实现的,那你为什么要它呢?很明显,你想要的是可以实现的,没有理由不能实现。@Ramhound:我从中了解到,在串行通信过程中,数据可能会被破坏。例如,在DIY空中喷洒制导系统中使用基于Win32的解决方案是毫无意义的。尽管如此,在应用程序级别上仍有改进的余地,但到目前为止,我不知道从哪里开始。这是为了分享我的发现(使用Delphi 2010进行测试)。谢谢