package com.sinognss.gnss.demo

import android.os.Bundle

/**
 * @author: zhangchao
 * @date: 2026/6/25
 * @description:
 * @param lat: 纬度
 * @param lon: 经度
 * @param alt: 高程（地面点-应用了天线高）
 * @param oAlt: 原始高程（相位中心）
 * @param n: 北偏移
 * @param e: 东偏移
 * @param z: 垂直偏移
 * @param utcTime: 时间戳
 * @param diffType: 差分类型  解状态 0-无效解 1-单点解 2-差分解  3-浮动解 4-固定解 10-基准站  200-未知
 * @param trackSatNum: 跟踪卫星数
 * @param solutionSatNum: 解算卫星数
 * @param diffDelay: 差分延迟
 *
 */
data class GnssDataBean(
    var lat: Double = 0.0,
    var lon: Double = 0.0,
    var alt: Double = 0.0,
    var oAlt: Double = 0.0,
    var n: Double = 0.0,
    var e: Double = 0.0,
    var z: Double = 0.0,
    var utcTime: Long = 0L,
    var diffType: Int = 0,
    var trackSatNum: Int = 0,
    var solutionSatNum: Int = 0,
    var diffDelay: Double = 0.0
) {
    fun toBundle(): Bundle {
        return Bundle().apply {
            putDouble("lat", lat)
            putDouble("lon", lon)
            putDouble("alt", alt)
            putDouble("oAlt", oAlt)
            putDouble("n", n)
            putDouble("e", e)
            putDouble("z", z)
            putLong("utcTime", utcTime)
            putInt("diffType", diffType)
            putInt("trackSatNum", trackSatNum)
            putInt("solutionSatNum", solutionSatNum)
            putDouble("diffDelay", diffDelay)
        }
    }

    companion object {
        fun parse(data: Bundle): GnssDataBean {
            return GnssDataBean(
                lat = data.getDouble("lat"),
                lon = data.getDouble("lon"),
                alt = data.getDouble("alt"),
                oAlt = data.getDouble("oAlt"),
                n = data.getDouble("n"),
                e = data.getDouble("e"),
                z = data.getDouble("z"),
                utcTime = data.getLong("utcTime"),
                diffType = data.getInt("diffType"),
                trackSatNum = data.getInt("trackSatNum"),
                solutionSatNum = data.getInt("solutionSatNum"),
                diffDelay = data.getDouble("diffDelay")
            )
        }
    }
}