Sha256: 0ea641629bb2fbd987f2a662c288059aea4bacd912274af825bf8153780c6e1d

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Thing::Product
    # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/wayline.html#return-to-home-information
    # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#return-home-information
    class ReturnHomeInfoEventsMessage < EventsMessage
      attribute :_method, Types::String.enum("return_home_info")

      attribute :data do
        # Dock SN of the home point
        attribute? :home_dock_sn, Types::SerialNumber

        attribute? :multi_dock_home_info, Types::Array do
          # Dock serial number
          attribute :sn, Types::SerialNumber

          # {"max":"100","min":"0","step":"1","unit_name":null}
          attribute :estimated_battery_consumption, Types::Integer.constrained(gteq: 0, lteq: 100)

          # Home point distance
          attribute :home_distance, Types::JSON::Decimal

          # {"0":"Planning failed or in progress","1":"Path planning unreachable","2":"Path planning unreachable due to battery","3":"Destination reachable"}
          attribute :plan_status, Types::Integer.enum(0, 1, 2, 3)
        end

        attribute :planned_path_points, Types::Array.default([].freeze) do
          attribute :latitude, Types::Latitude
          attribute :longitude, Types::Longitude
          attribute :height, Types::JSON::Decimal
        end

        # {"0":"Last point of trajectory is located above the return point.","1":"Last point of trajectory is not located above the return point."}
        attribute? :last_point_type, Types::Integer.enum(0, 1)

        attribute :flight_id, Types::FlightID
      end

      # All the flight IDs in the message
      def flight_ids
        [data.flight_id]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.25.1 lib/dji_mqtt_connect/messages/thing/product/events/return_home_info.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/messages/thing/product/events/return_home_info.rb