Sha256: 277356de26e7ee258c9c134cd1dee4c1ba0f2441d1a95bc1eb31ec0f181286be

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 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: Time.now.strftime("%s%L").to_i,
          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

1 entries across 1 versions & 1 rubygems

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