android app for https://otb-tracker.outsidethebox.top tracking
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
857 B

package top.outsidethebox.followme.data
import org.json.JSONObject
data class GpsPayload(
val latitude: Double,
val longitude: Double,
val speedKmh: Double? = null,
val accuracyM: Float? = null,
val headingDeg: Float? = null,
val altitudeM: Double? = null,
val recordedAt: String? = null,
val source: String = AppPrefs.DEFAULT_SOURCE
) {
fun toJson(): String {
val json = JSONObject()
json.put("latitude", latitude)
json.put("longitude", longitude)
speedKmh?.let { json.put("speed_kmh", it) }
accuracyM?.let { json.put("accuracy_m", it) }
headingDeg?.let { json.put("heading_deg", it) }
altitudeM?.let { json.put("altitude_m", it) }
recordedAt?.let { json.put("recorded_at", it) }
json.put("source", source)
return json.toString()
}
}