Sha256: 0425b04e6925202e84803e812b02f052ba6563ca51785496ee18e67b59259260

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module DjiMqttConnect
  module Thing::Product
    # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/topic-definition.html#events-reply-struct-example
    class EventsReplyMessage < Message
      # a result of 0 means we approve of this action
      def self.build_for(events_message, result: 0)
        new(
          _method: events_message._method,
          tid: events_message.tid,
          bid: events_message.bid,
          timestamp: current_timestamp,
          data: {
            result: result
          }
        )
      end

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

      attribute :_method, Types::String.enum(
        "airsense_warning",
        "device_exit_homing_notify",
        "device_reboot",
        "file_upload_callback",
        "fileupload_progress",
        "flight_areas_drone_location",
        "flight_areas_sync_progress",
        "flighttask_progress",
        "flighttask_ready",
        "highest_priority_upload_flighttask_media",
        "offline_map_sync_progress"
      )

      attribute :data do
        include Mixins::ResultMessage

        attribute :result, Types::ResultCode
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.23 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb
dji_mqtt_connect-0.1.22.2 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb
dji_mqtt_connect-0.1.22.1 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb