|
|
@ -276,20 +276,18 @@ void CAPRSWriter::sendIdFrameMobile()
|
|
|
|
buffer[ret] = '\0';
|
|
|
|
buffer[ret] = '\0';
|
|
|
|
|
|
|
|
|
|
|
|
// Parse the GPS data
|
|
|
|
// Parse the GPS data
|
|
|
|
char* pLatitude = ::strtok((char*)buffer, ","); // Latitude
|
|
|
|
char* pLatitude = ::strtok((char*)buffer, ",\n"); // Latitude
|
|
|
|
char* pLongitude = ::strtok(NULL, ","); // Longitude
|
|
|
|
char* pLongitude = ::strtok(NULL, ",\n"); // Longitude
|
|
|
|
char* pAltitude = ::strtok(NULL, ","); // Altitude (m)
|
|
|
|
char* pAltitude = ::strtok(NULL, ",\n"); // Altitude (m)
|
|
|
|
char* pVelocity = ::strtok(NULL, ","); // Velocity (kms/h)
|
|
|
|
char* pVelocity = ::strtok(NULL, ",\n"); // Velocity (kms/h)
|
|
|
|
char* pBearing = ::strtok(NULL, "\n"); // Bearing
|
|
|
|
char* pBearing = ::strtok(NULL, "\n"); // Bearing
|
|
|
|
|
|
|
|
|
|
|
|
if (pLatitude == NULL || pLongitude == NULL || pAltitude == NULL || pVelocity == NULL || pBearing == NULL)
|
|
|
|
if (pLatitude == NULL || pLongitude == NULL || pAltitude == NULL)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
float rawLatitude = ::atof(pLatitude);
|
|
|
|
float rawLatitude = ::atof(pLatitude);
|
|
|
|
float rawLongitude = ::atof(pLongitude);
|
|
|
|
float rawLongitude = ::atof(pLongitude);
|
|
|
|
float rawAltitude = ::atof(pAltitude);
|
|
|
|
float rawAltitude = ::atof(pAltitude);
|
|
|
|
float rawVelocity = ::atof(pVelocity);
|
|
|
|
|
|
|
|
float rawBearing = ::atof(pBearing);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char desc[200U];
|
|
|
|
char desc[200U];
|
|
|
|
if (m_txFrequency != 0U) {
|
|
|
|
if (m_txFrequency != 0U) {
|
|
|
@ -342,13 +340,14 @@ void CAPRSWriter::sendIdFrameMobile()
|
|
|
|
lat, (rawLatitude < 0.0F) ? 'S' : 'N',
|
|
|
|
lat, (rawLatitude < 0.0F) ? 'S' : 'N',
|
|
|
|
lon, (rawLongitude < 0.0F) ? 'W' : 'E');
|
|
|
|
lon, (rawLongitude < 0.0F) ? 'W' : 'E');
|
|
|
|
|
|
|
|
|
|
|
|
if (::strlen(pBearing) > 0U && ::strlen(pVelocity) > 0U)
|
|
|
|
if (pBearing != NULL && pVelocity != NULL) {
|
|
|
|
::sprintf(output + ::strlen(output), "%03.0f/%03.0f", rawBearing, rawVelocity * 0.539957F);
|
|
|
|
float rawVelocity = ::atof(pVelocity);
|
|
|
|
|
|
|
|
float rawBearing = ::atof(pBearing);
|
|
|
|
|
|
|
|
|
|
|
|
if (::strlen(pAltitude) > 0U)
|
|
|
|
::sprintf(output + ::strlen(output), "%03.0f/%03.0f", rawBearing, rawVelocity * 0.539957F);
|
|
|
|
::sprintf(output + ::strlen(output), "/A=%06.0f", float(rawAltitude) * 3.28F);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
::sprintf(output + ::strlen(output), "%s %s", band, desc);
|
|
|
|
::sprintf(output + ::strlen(output), "/A=%06.0f%s %s", float(rawAltitude) * 3.28F, band, desc);
|
|
|
|
|
|
|
|
|
|
|
|
m_thread->write(output);
|
|
|
|
m_thread->write(output);
|
|
|
|
|
|
|
|
|
|
|
|