package com.cr.common

import com.cr.cruav.CrApplication
import com.cr.cruav.R
import com.cr.data.DEFAULT_LOCATION
import com.cr.data.DEFAULT_STR

/**
 * 操作系统：MAC系统
 * 创建者：王成
 * 创建日期：2023/3/9 15:57
 * 描述：飞行器信息
 */
data class CrFlightControlInfo(var isConnection: Boolean = false) :CrDataCommon(){
    // define: 2023/3/9 电池电量
    var batteryPercent: Int = 0

    // define: 2023/3/9 产品名称
    var productName: String = DEFAULT_STR

    // define: 2023/3/9 卫星数量
    var gpsCount: String = DEFAULT_STR

    // define: 2023/3/9 IMU状态
    var imuState: String = DEFAULT_STR

    // define: 2023/3/14 指南针状态
    var compassState: String = DEFAULT_STR

    // define: 2023/8/15 飞行器位置
    var longitude:Double = 0.0
    var latitude:Double = 0.0
    var altitude:Double = 0.0
    var takeoffAltitude:Double = 0.0  // define: 2023/8/15 起飞海拔
    var isLocationValid:Boolean = false

    var longitudeStr:String = DEFAULT_LOCATION
    var latitudeStr:String = DEFAULT_LOCATION
    var altitudeStr:String = DEFAULT_STR
    var takeoffAltitudeStr:String = DEFAULT_STR

    // define: 2023/8/15 速度
    var speedX:Double = 0.0
    var speedY:Double = 0.0
    var speedZ:Double = 0.0

    // define: 2023/8/15 返航位置
    var homeLongitude:Double = 0.0
    var homeLatitude:Double = 0.0
    var homeDistance:Double = 0.0
    var homeAltitude:Int = 0
    var homeDistanceStr:String = DEFAULT_STR
    var homeAltitudeStr:String = DEFAULT_STR

    var homeOldLongitude:Double = 0.0
    var homeOldLatitude:Double = 0.0
    var isUpdateHomeLocation:Boolean = false
    var isHomeLocationValid:Boolean = false

    // define: 2023/8/17 飞行器姿态
    var pitch:Double = 0.0
    var yaw:Double = 0.0
    var roll:Double = 0.0

    // define: 2023/9/26 飞行器电调
    var motorsIsOn = false



    /**
     * 重置
     */
    override fun reset() {
        isConnection = false
        batteryPercent = 0
        productName = DEFAULT_STR
        gpsCount = DEFAULT_STR
        imuState = DEFAULT_STR
        compassState = DEFAULT_STR
        // todo: 2023/8/17 位置相关
        longitude = 0.0
        latitude = 0.0
        altitude = 0.0
        longitudeStr = DEFAULT_LOCATION
        latitudeStr = DEFAULT_LOCATION
        altitudeStr = DEFAULT_STR
        isLocationValid = false
        // todo: 2023/8/17 起飞相关
        takeoffAltitude = 0.0
        takeoffAltitudeStr = DEFAULT_STR
        // todo: 2023/8/17 速速相关
        speedX = 0.0
        speedY = 0.0
        speedZ = 0.0
        // todo: 2023/8/17 返航相关
        homeLongitude = 0.0
        homeLatitude = 0.0
        homeAltitude = 0
        homeDistance = 0.0
        homeDistanceStr = DEFAULT_STR
        homeAltitudeStr = DEFAULT_STR
        homeOldLatitude = 0.0
        homeOldLongitude = 0.0
        isUpdateHomeLocation = false
        isHomeLocationValid = false
        // todo: 2023/8/17 姿态相关
        pitch = 0.0
        yaw = 0.0
        roll = 0.0
        // todo: 2023/9/26 电调
        motorsIsOn = false
    }
}