• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
March 28, 2024, 11:25:04 am

News:

SMF - Just Installed!


UTC datetime

Started by aaron, September 18, 2021, 05:01:31 pm

Previous topic - Next topic

aaron

Hello,
  Is there anywhere I can get the UTC datetime from the GPS?

Thanks.

Roman Novgorodov

Hello

The actual implementation of TnrGps component does not decode UTS field reply of GGA GPS command.

But you can get necessary info after handling TnrGps.OnGpPacket event:

procedure TForm1.nrGps1GpPacket(Sender: TObject; Command: TnrGpsCommands;
  Fields: TStrings; var Skip: Boolean);
begin
  if Command = TnrGpsCommands.gpsGGA then begin
     OutputDebugString(PChar('Datetime =' + Fields[1]));
  end;
  Skip := false;
end;


You can decode string Fields[1] and get Hours Minutes and Second.


I hope we will include UTC time decoding in the next version of library.


Roman Novgorodov
DeepSoftware llc



DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

aaron

hello,
Fields[1] will get Hours Minutes and Second.
but where can get the date?

Thanks.

Roman Novgorodov

October 03, 2021, 03:37:20 am #3 Last Edit: October 03, 2021, 03:58:30 am by Roman Novgorodov
Hello

Full DATETIME info is available after  ZDA request to GPS device.

you can try to decode the ZDA reply in GPS command handler:

procedure TForm1.nrGps1GpPacket(Sender: TObject; Command: TnrGpsCommands;
  Fields: TStrings; var Skip: Boolean);
begin
  if Command = TnrGpsCommands.gpsZDA then begin
     OutputDebugString(PChar('Time =' + Fields[1] + ' Date:' + Fields[2] + '-' + Fields[3] + '-' + Fields[4] + ' local zone:'+ Fields[5] +':' + Fields[6] ));
  end;
  Skip := false;
end;

We will add a more suitable way in the next release.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.