/* $GPRMC,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,*hh<CR><LF> <1> UTC Time of position fix, hhmmss format <2> Status, A = Valid position, V = NAV receiver warning <3> Latitude,ddmm.mmm format (leading zeros will be transmitted) <4> Latitude hemisphere, N or S <5> Longitude,dddmm.mmm format (leading zeros will be transmitted) <6> Longitude hemisphere, E or W <7> Speed over ground, 0.0 to 999.9 knots <8> Course over ground 000.0 to 359.9 degrees, true (leading zeros will be transmitted) <9> UTC date of position fix, ddmmyy format <10> Magnetic variation, 000.0 to 180.0 degrees (leading zeros will be transmitted) <11> Magnetic variation direction, E or W (westerly variation adds to true course) */ static bool FormatGPRMC(char *buffer, size_t buffer_size, const MoreData &info) { char lat_buffer[20]; char long_buffer[20]; const GeoPoint location = info.location_available ? info.location : GeoPoint::Zero(); FormatLatitude(lat_buffer, sizeof(lat_buffer), location.latitude); FormatLongitude(long_buffer, sizeof(long_buffer), location.longitude); const BrokenDateTime now = info.time_available && info.date_time_utc.IsDatePlausible() ? info.date_time_utc : BrokenDateTime::NowUTC(); snprintf(buffer, buffer_size, "GPRMC,%02u%02u%02u,%c,%s,%s,%05.1f,%05.1f,%02u%02u%02u,,", now.hour, now.minute, now.second, info.location.IsValid() ? 'A' : 'V', lat_buffer, long_buffer, (double)Units::ToUserUnit(info.ground_speed, Unit::KNOTS), (double)info.track.Degrees(), now.day, now.month, now.year % 100); return true; }
bool FormatLongitude(Angle longitude, TCHAR *buffer, size_t size) { return FormatLongitude(longitude, buffer, size, user_coordinate_format); }