1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| //---------------------------------------------------------------------------
// Port GPS RX
//---------------------------------------------------------------------------
void __fastcall TMain_Dlg::VaComm2RxChar(TObject *Sender, int Count)
{
AnsiString Gps_Data;
int i;
Gps = VaComm2->ReadText(); // Lire le Port Serie en ASCII
// GPS_RX->Lines->Add( IntToStr(Count) + " bytes"); / /Voir le Nombre de Bytes Recu
// GPS_RX->Lines->Add(Gps.Length() + " bytes"); //Voir le Nombre de Bytes Recu
char GPS_Count[Gps.Length()];
//==================================================================================
// while (Gps[i] >= 13) ;
for( i = 1; i < Gps.Length(); i++) // Faire une boucle selon la longeur de Gps.Length()
{
if(Gps[i]!= 13) // != '*' Detecter EOF ou Line feed ou caractere de mon choix
// tant qu'on a pas rencontré le caractère 13 retour a la ligne '*'
Gps_Data = Gps_Data + Gps[i]; // Refaire la Trame de Gps_Data
else // sinon, donc on a rencontré le caractère 13 retour a la ligne
i = Gps.Length(); // on met i = Gps.Length() comme ça la boucle For va s'arrêter tout de suite.
}
GPS_RX->Lines->Add(Gps_Data); // Affiche la Trame recue dans le RichEdit GPS_RX
Gps_Rx = MidStr(Gps_Data,0,6); //Filtré dans la trame Gps_Rx les 6 premiers caratères
if ( GLL_Select -> Checked)
{
if (Gps_Rx == "$GPGLL") // Valeur à filtré $GPGLL
{
Debut_Latitude->Text = MidStr(Gps_Data,8,11);
Debut_Longitude->Text = MidStr(Gps_Data,20,12);
Fin_Latitude->Text = MidStr(Gps_Data,8,11);
Fin_Longitude->Text = MidStr(Gps_Data,20,12);
YoYo_Latitude->Text = MidStr(Gps_Data,8,11);
YoYo_Longitude->Text = MidStr(Gps_Data,20,12);
}
}
if ( GGA_Select -> Checked)
{
if (Gps_Rx == "$GPGGA") // Valeur à filtré $GPGGA
{
Debut_Latitude->Text = MidStr(Gps_Data,19,11);
Debut_Longitude->Text = MidStr(Gps_Data,31,12);
Fin_Latitude->Text = MidStr(Gps_Data,19,11);
Fin_Longitude->Text = MidStr(Gps_Data,31,12);
YoYo_Latitude->Text = MidStr(Gps_Data,19,11);
YoYo_Longitude->Text = MidStr(Gps_Data,31,12);
}
}
//AnsiString Receive = VaComm2->ReadText();
//Memo1->Lines->Text = Memo1->Lines->Text + VaComm2->ReadText();
//Memo1->Lines->Add("Reading " + IntToStr(Count) + " bytes");
} |
Partager