Sha256: 6afea56d1d362c09cc414ab8602ebd19897613b48c576e0eef67f0c7ba8fe12b

Contents?: true

Size: 978 Bytes

Versions: 2

Compression:

Stored size: 978 Bytes

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(
        "file_upload_callback",
        "fileupload_progress",
        "highest_priority_upload_flighttask_media"
      )

      attribute :data do
        attribute :result, Types::Integer
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dji_mqtt_connect-0.1.12.1 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb
dji_mqtt_connect-0.1.12 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb