# frozen_string_literal: true module DjiMqttConnect module Thing::Product # Report wayline task progress # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#report-wayline-task-progress class FlighttaskProgressEventsMessage < EventsMessage attribute :_method, Types::String.enum("flighttask_progress") attribute :data do include Mixins::ResultMessage attribute :result, Types::ResultCode attribute :output do attribute :ext do attribute :current_waypoint_index, Types::Integer attribute? :media_count, Types::Integer attribute :track_id, Types::String | Types::Nil attribute :flight_id, Types::String attribute? :break_point do attribute :index, Types::Integer # {"0":"On the wayline segment","1":"On the waypoint"} attribute :state, Types::Integer.enum(0, 1) # {"min":"0","max":"1.0"} attribute :progress, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1.0) attribute :wayline_id, Types::Integer attribute :break_reason, Types::Integer attribute :latitude, Types::Latitude attribute :longitude, Types::Longitude # {"unit":"m","unitName":"meter"} attribute :height, Types::JSON::Decimal attribute :attitude_head, Types::Integer | Types::JSON::Decimal end end # {"partially_done":"partially done","sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"} attribute :status, Types::String.enum( "partially_done", "sent", "in_progress", "ok", "paused", "rejected", "failed", "canceled", "timeout" ) def humanized_status I18n.t(status, scope: "dji_mqtt_connect.flighttask_status", default: status.titleize) end attribute :progress do # {"0-4":"MissionCenter starting, checking and resuming","5-18":"Waiting state","19, 20":"Task executing","21-29":"Returning to home","30-39":"Pulling logs","Others":"Interaction completed"} attribute :current_step, Types::Integer # {"min":"0","max":"100","step":"1"} attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100) end end end end end end