Sha256: 3c148e7da7ef4c6918477b8fb0b9f58e0d2e0c7961a05cc479a67755c015d820

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Thing::Product
    # When a dock reports the task termination, this method should be issued to the other dock during the multi-dock task.
    # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#task-termination
    class FlighttaskStopServicesMessage < ServicesMessage
      def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
        new(
          bid: bid,
          tid: tid,
          timestamp: timestamp,
          _method: "flighttask_stop",
          data: data
        )
      end

      attribute :tid, Types::UUID
      attribute :bid, Types::UUID
      attribute :timestamp, Types::Timestamp

      attribute :_method, Types::String.enum("flighttask_stop")

      attribute :data do
        attribute :flight_id, Types::FlightID

        # {"0":"Normal termination","1":"The state machine of the other dock is abnormal"}
        attribute :reason, Types::Integer.enum(0, 1)
      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/services/flighttask_stop.rb
dji_mqtt_connect-0.1.25 lib/dji_mqtt_connect/messages/thing/product/services/flighttask_stop.rb