示例#1
0
void locapi_pi::Notify()
{
	// Get the report status
	if (spLoc && SUCCEEDED(spLoc->GetReportStatus(IID_ILatLongReport, &status))) 
	{
		wxLogMessage(_T("LOCAPI: Tick, going to get position..."));
		CComPtr<ILocationReport> spLocationReport; // This is our location report object
		CComPtr<ILatLongReport> spLatLongReport; // This is our LatLong report object

		// Get the current location report,
		// then get the ILatLongReport interface from ILocationReport,
		// then ensure it isn't NULL
		if ((SUCCEEDED(spLoc->GetReport(IID_ILatLongReport, &spLocationReport))) &&
			(SUCCEEDED(spLocationReport->QueryInterface(&spLatLongReport))))
		{
			lfPrevLat = lfThisLat;
			lfPrevLng = lfThisLng;

			// Fetch the new latitude & longitude
			spLatLongReport->GetLatitude(&lfThisLat);
			spLatLongReport->GetLongitude(&lfThisLng);
			wxLogMessage(wxString::Format( _T("LOCAPI: Position: %f, %f"), lfThisLat, lfThisLng) );
			GLL stc;
			stc.Position.Latitude.Set( fabs(lfThisLat), lfThisLat > 0 ? _T("N") : _T("N") );
			stc.Position.Longitude.Set( fabs(lfThisLng), lfThisLng > 0 ? _T("E") : _T("W") );
			stc.Talker = _T("GP");
			stc.UTCTime = wxDateTime::Now().ToUTC().Format( _T("%H%M%S") );
			SENTENCE snt;
			stc.Write( snt );

			PushNMEABuffer( snt.Sentence + _T("\r\n") );
		}
	}
}
void NmeaConverter_pi::SendNMEASentence(wxString sentence)
{
    sentence.Trim();
    wxString Checksum = ComputeChecksum(sentence);
    sentence = sentence.Append(wxT("*"));
    sentence = sentence.Append(Checksum);
    sentence = sentence.Append(wxT("\r\n"));
    PushNMEABuffer(sentence);
}
示例#3
0
void vdr_pi::Notify()
{
      wxString str;
      int pos = m_istream.GetCurrentLine();

      if (m_istream.Eof() || pos==-1)
            str = m_istream.GetFirstLine();
      else
            str = m_istream.GetNextLine();

      PushNMEABuffer(str+_T("\r\n"));

      if ( m_pvdrcontrol )
            m_pvdrcontrol->SetProgress(pos);
}