nmea_gps: Added str method for coordinate struct

Provide a method to print out a coordinate structure which can be
dropped into online mapping pages.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck 2018-06-01 10:20:00 -07:00
parent cdfb68c381
commit 9a959b578c
3 changed files with 13 additions and 0 deletions

View File

@ -616,3 +616,10 @@ std::string NMEAGPS::__str__()
return oss.str();
}
std::string coord_DD::__str__()
{
std::ostringstream oss;
oss << latitude << ", " << longitude;
return oss.str();
}

View File

@ -79,6 +79,11 @@ namespace upm {
double latitude = 0.0;
/** Longitude in decimal degrees */
double longitude = 0.0;
/**
* Provide a string representation of this structure.
* @return String representing coordinates
*/
std::string __str__();
};
/** Satellite structure definition */

View File

@ -13,6 +13,7 @@ JAVA_JNI_LOADLIBRARY(javaupm_nmea_gps)
%feature("python:slot", "tp_str", functype="reprfunc") upm::satellite::__str__;
%feature("python:slot", "tp_str", functype="reprfunc") upm::nmeatxt::__str__;
%feature("python:slot", "tp_str", functype="reprfunc") upm::NMEAGPS::__str__;
%feature("python:slot", "tp_str", functype="reprfunc") upm::coord_DD::__str__;
#endif
/* END Python syntax */