2011-12-14 21 views
5

Estoy buscando el analizador sintáctico Delivered NMEA de grado de producción.En busca del analizador sintáctico Delivered NMEA

Estará bien si cumple con los requisitos críticos de la misión (¡estoy bromeando! Creo que no es posible usar un sistema Win32).

Hasta ahora, he jugado con la interfaz básica de un GPS de muñeca (Garmin Foretrex 101) a través del puerto en serie utilizando Windows API básica (NMEA 0183).

También he explorado un componente VCL de código abierto para manejar la comunicación serie experimental con un GPS de modelo de aviación (Garmin Gpsmap 196).

Gracias.

+3

No es de código abierto, pero sigue siendo bueno, es [componentes NMEA GPS de ZylSoft] (http://www.zylsoft.com/). –

+0

@ LU RD: Gracias, ZylSolf ha escrito muchos componentes destacados. – menjaraz

+0

Si crees que algo no es posible, ¿por qué lo pides? Claramente, lo que desea es alcanzable, no existe una razón por la que no pueda obtenerse. –

Respuesta

4

que terminan usando TComPort y TComDataPacket del paquete de código abierto TComPort. ajuste


de ComPort:

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 

configuración ComDataPacket:

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

Extracto del tipo usado

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; 

manejador ComDataPacketPacket Evento:

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; 

procesamiento NMEA se llevó a cabo en el controlador de eventos.

+1

Esto es para compartir mis hallazgos (probado con Delphi 2010). Gracias. – menjaraz

Cuestiones relacionadas