# frozen_string_literal: true module DjiMqttConnect module Thing::Product class DroneOsdMessage < OsdMessage STABLE_DATA_ATTRIBUTES = %i[ mode_code gear horizontal_speed vertical_speed latitude longitude height elevation attitude_head attitude_pitch attitude_roll home_distance wind_direction wind_speed ] attribute :data do include Mixins::LatitudeConditional include Mixins::LongitudeConditional attribute :attitude_head, Types::JSON::Decimal attribute :attitude_pitch, Types::JSON::Decimal attribute :attitude_roll, Types::JSON::Decimal attribute :battery do attribute :batteries, Types::Array do include Mixins::TemperatureConditional attribute :capacity_percent, Types::Integer attribute :firmware_version, Types::String attribute? :high_voltage_storage_days, Types::Integer attribute :index, Types::Integer attribute :loop_times, Types::Integer attribute :sn, Types::String attribute :sub_type, Types::DeviceSubType attribute :temperature, Types::Temperature attribute :type, Types::DeviceType attribute :voltage, Types::Integer end attribute :capacity_percent, Types::Integer attribute :landing_power, Types::Integer attribute :remain_flight_time, Types::Integer attribute :return_home_power, Types::Integer end attribute? :distance_limit_status do attribute :distance_limit, Types::Integer # {"0":"Not reached","1":"Reached"} attribute? :is_near_distance_limit, Types::Integer.enum(0, 1) # {"0":"Not set","1":"Have been set"} attribute :state, Types::Integer.enum(0, 1) end attribute :elevation, Types::JSON::Decimal attribute :firmware_version, Types::String attribute :gear, Types::Integer attribute :height, Types::JSON::Decimal attribute? :height_limit, Types::JSON::Decimal attribute :home_distance, Types::JSON::Decimal attribute :horizontal_speed, Types::JSON::Decimal attribute :latitude, Types::Latitude attribute :longitude, Types::Longitude attribute :mode_code, Types::Integer attribute :position_state do attribute :gps_number, Types::Integer attribute :is_fixed, Types::Integer attribute :quality, Types::Integer attribute :rtk_number, Types::Integer end attribute? :storage do attribute :total, Types::Integer attribute :used, Types::Integer end attribute :total_flight_distance, Types::JSON::Decimal attribute :total_flight_time, Types::JSON::Decimal attribute? :track_id, Types::String attribute :vertical_speed, Types::JSON::Decimal attribute :wind_direction, Types::JSON::Decimal attribute :wind_speed, Types::JSON::Decimal # M30 Fields attribute? :cameras, Types::Array do # {"0":"Photo taking","1":"Recording"} attribute :camera_mode, Types::Integer.enum(0, 1) # {"min":2,"max":20} attribute :ir_zoom_factor, Types::JSON::Decimal attribute :liveview_world_region do attribute :bottom, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1) attribute :left, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1) attribute :right, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1) attribute :top, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1) end attribute :payload_index, Types::String # {"0":"Idle","1":"Taking photo"} attribute :photo_state, Types::Integer.enum(0, 1) # {"0":"Idle","1":"Recording"} attribute :recording_state, Types::Integer.enum(0, 1) # {"unit":"s"} attribute :record_time, Types::Integer attribute :remain_photo_num, Types::Integer # {"unit":"s"} attribute :remain_record_duration, Types::Integer # {"min":2,"max":200} attribute :zoom_factor, Types::JSON::Decimal end # {"0":"Continue to execute the wayline task","1":"Exit the wayline task, and execute the remote controller out of control action."} attribute? :exit_wayline_when_rc_lost, Types::Integer.enum(0, 1) attribute? :is_near_area_limit, Types::Integer.enum(0, 1) # {"0":"Not reached","1":"Reached"} attribute? :is_near_height_limit, Types::Integer.enum(0, 1) attribute? :maintain_status do attribute :maintain_status_array, Types::Array do attribute :last_maintain_flight_sorties, Types::Integer # {"unit":"hour"} attribute :last_maintain_flight_time, Types::Integer attribute :last_maintain_time, Types::Integer # {"0":"No maintenance","1":"Drone basic maintenance","2":"Drone routine maintenance","3":"Drone deep maintenance","17":"Dock maintenance"} attribute :last_maintain_type, Types::Integer.enum(0, 1, 2, 3, 17) # {"0":"No maintenance","1":"Under maintenance"} attribute :state, Types::Integer.enum(0, 1) end end # {"0":"Off","1":"On"} attribute? :night_lights_state, Types::Integer.enum(0, 1) attribute? :obstacle_avoidance do # {"0":"Close","1":"Open"} attribute :horizon, Types::Integer.enum(0, 1) # {"0":"Close","1":"Open"} attribute :upside, Types::Integer.enum(0, 1) # {"0":"Close","1":"Open"} attribute :downside, Types::Integer.enum(0, 1) end # {"0":"Hovering","1":"Landing","2":"Returning to home"} attribute? :rc_lost_action, Types::Integer.enum(0, 1, 2) # {"unit":"m","min":20,"max":500} attribute? :rth_altitude, Types::Integer attribute? :total_flight_sorties, Types::Integer end end end end