bool LiveTrack24::StartTracking(SessionID session, const TCHAR *username, const TCHAR *password, unsigned tracking_interval, VehicleType vtype, const TCHAR *vname, OperationEnvironment &env) { // http://www.livetrack24.com/track.php?leolive=2&sid=42664778&pid=1& // client=YourProgramName&v=1&user=yourusername&pass=yourpass& // phone=Nokia 2600c&gps=BT GPS&trk1=4&vtype=16388& // vname=vehicle name and model const WideToUTF8Converter username2(username); const WideToUTF8Converter password2(password); const WideToUTF8Converter vname2(vname); if (!username2.IsValid() || !password2.IsValid() || !vname2.IsValid()) return false; #ifdef _UNICODE NarrowString<32> version; version.SetASCII(XCSoar_VersionLong); #else const char *version = XCSoar_VersionLong; #endif NarrowString<2048> url; url.Format("http://%s/track.php?leolive=2&sid=%u&pid=%u&" "client=%s&v=%s&user=%s&pass=%s&vtype=%u&vname=%s", GetServer(), session, 1, "XCSoar", version, (const char *)username2, (const char *)password, vtype, vname); return SendRequest(url, env); }
/** * Clean a string and write it to the Port. */ static bool WriteCleanString(Port &port, const TCHAR *p, OperationEnvironment &env, unsigned timeout_ms) { NarrowString<256> buffer; buffer.SetASCII(p); CleanString(buffer.buffer()); return port.FullWriteString(buffer, env, timeout_ms); }