Sha256: 02746a23d28037a18a3233cfcd5eba5f06ed9057e4a519754b44a74304d74d8f

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 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"
      )

      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.22 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb
dji_mqtt_connect-0.1.21 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb
dji_mqtt_connect-0.1.20.1 lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb