#include "GpsState.h" #include #include #include "pystring.h" namespace habboy_hw_iface { std::string GpsState::to_str() const { using namespace std; string res; res += "time=" + to_string(time) + ","; res += "lat=" + to_string(lat) + ","; res += "lon=" + to_string(lon) + ","; res += "alt=" + to_string(alt) + ","; res += "altmsl=" + to_string(altmsl) + ","; res += "sats=" + to_string(sats) + ","; res += "speed=" + to_string(speed) + ","; res += "heading=" + to_string(heading); return res; } void GpsState::from_str(std::string str) { using namespace std; vector tokens; pystring::split( str, tokens, "," ); for(auto t : tokens) { vector kv; pystring::split( t, kv, "=" ); if(kv.size() == 2) { if( kv[0] == "time" ) try { time = stoi(kv[1]); } catch(exception& e) { cout<<"ERR "<