Module: DjiMqttConnect::Factories::ServicesMessages

Included in:
DjiMqttConnect::Factories
Defined in:
lib/dji_mqtt_connect/factories/services_messages.rb

Instance Method Summary collapse

Instance Method Details

#build_thing_product_alarm_state_switch_services_messageObject



5
6
7
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 5

def build_thing_product_alarm_state_switch_services_message
  Thing::Product::AlarmStateSwitchServicesMessage.build(action: Thing::Product::AlarmStateSwitchServicesMessage::ACTION_OPEN)
end

#build_thing_product_cover_close_services_messageObject



9
10
11
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 9

def build_thing_product_cover_close_services_message
  Thing::Product::CoverCloseServicesMessage.build
end

#build_thing_product_cover_open_services_messageObject



13
14
15
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 13

def build_thing_product_cover_open_services_message
  Thing::Product::CoverOpenServicesMessage.build
end

#build_thing_product_debug_mode_close_services_messageObject



17
18
19
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 17

def build_thing_product_debug_mode_close_services_message
  Thing::Product::DebugModeCloseServicesMessage.build
end

#build_thing_product_debug_mode_open_services_messageObject



21
22
23
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 21

def build_thing_product_debug_mode_open_services_message
  Thing::Product::DebugModeOpenServicesMessage.build
end

#build_thing_product_fileupload_list_services_messageObject



25
26
27
28
29
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 25

def build_thing_product_fileupload_list_services_message
  Thing::Product::FileuploadListServicesMessage.build(
    module_list: [0, 3]
  )
end

#build_thing_product_fileupload_start_services_messageObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 31

def build_thing_product_fileupload_start_services_message
  timestamp = Message.current_timestamp
  Thing::Product::FileuploadStartServicesMessage.build(
    data: {
      bucket: "stg-dji-service-hz-ksd7",
      region: "hz",
      credentials: {
        access_key_id: "STS.access_key_id",
        access_key_secret: "access_key_secret",
        expire: 3600,
        security_token: "security_token"
      },
      endpoint: "https://oss-cn-hangzhou.aliyuncs.com",
      params: {
        files: [
          {
            list: [
              {
                boot_index: 1111,
                end_time: timestamp - 3000,
                size: 33789,
                start_time: timestamp - 4000
              },
              {
                boot_index: 22222,
                end_time: timestamp - 1000,
                size: 33789,
                start_time: timestamp - 2000
              }
            ],
            module: "3",
            object_key: "object_key"
          }
        ]
      },
      provider: "ali"
    }
  )
end

#build_thing_product_flighttask_execute_services_messageObject



71
72
73
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 71

def build_thing_product_flighttask_execute_services_message
  Thing::Product::FlighttaskExecuteServicesMessage.build(flight_id: SecureRandom.uuid)
end

#build_thing_product_flighttask_pause_services_messageObject



75
76
77
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 75

def build_thing_product_flighttask_pause_services_message
  Thing::Product::FlighttaskPauseServicesMessage.build
end

#build_thing_product_flighttask_prepare_services_messageObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 79

def build_thing_product_flighttask_prepare_services_message
  Thing::Product::FlighttaskPrepareServicesMessage.build(
    data: {
      execute_time: 1234567890123,
      flight_id: "xxxxxxx",
      task_type: 2,
      file: {
        url: "https://xxx.com/xxxx",
        fingerprint: "xxxx"
      },
      ready_conditions: {
        battery_capacity: 90,
        begin_time: 1234567890123,
        end_time: 1234567890123
      },
      executable_conditions: {
        storage_capacity: 1000
      },
      break_point: {
        index: 1,
        state: 0,
        progress: 0.34,
        wayline_id: 0
      },
      rth_altitude: 100,
      rth_mode: 1,
      out_of_control_action: 0,
      exit_wayline_when_rc_lost: 0,
      wayline_precision_type: 0
    }
  )
end

#build_thing_product_flighttask_progress_get_services_messageObject



116
117
118
119
120
121
122
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 116

def build_thing_product_flighttask_progress_get_services_message
  Thing::Product::FlighttaskProgressGetServicesMessage.build(
    data: {
      sn: "SN1234567890"
    }
  )
end

#build_thing_product_flighttask_recovery_services_messageObject



112
113
114
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 112

def build_thing_product_flighttask_recovery_services_message
  Thing::Product::FlighttaskRecoveryServicesMessage.build
end

#build_thing_product_flighttask_stop_services_messageObject



124
125
126
127
128
129
130
131
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 124

def build_thing_product_flighttask_stop_services_message
  Thing::Product::FlighttaskStopServicesMessage.build(
    data: {
      flight_id: SecureRandom.uuid,
      reason: 0
    }
  )
end

#build_thing_product_flighttask_undo_services_messageObject



133
134
135
136
137
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 133

def build_thing_product_flighttask_undo_services_message
  Thing::Product::FlighttaskUndoServicesMessage.build(
    flight_ids: [SecureRandom.uuid, SecureRandom.uuid]
  )
end

#build_thing_product_live_lens_change_services_messageObject

Live Stream (Services Messages) ###



141
142
143
144
145
146
147
148
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 141

def build_thing_product_live_lens_change_services_message
  Thing::Product::LiveLensChangeServicesMessage.build(
    data: {
      video_id: "1ZNDH1D0010098/39-0-7/normal-0",
      video_type: "wide"
    }
  )
end

#build_thing_product_live_set_quality_services_messageObject



150
151
152
153
154
155
156
157
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 150

def build_thing_product_live_set_quality_services_message
  Thing::Product::LiveSetQualityServicesMessage.build(
    data: {
      video_id: "1ZNDH1D0010098/39-0-7/normal-0",
      video_quality: 0
    }
  )
end

#build_thing_product_live_start_push_services_messageObject



159
160
161
162
163
164
165
166
167
168
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 159

def build_thing_product_live_start_push_services_message
  Thing::Product::LiveStartPushServicesMessage.build(
    data: {
      url: "channel=1ZNDH1D0010098_39-0-7&sn=1ZNDH1D0010098&token=006dca67721582a48768ec4d817b7b25a86IADk%2Fcm%2Fdv%2BHY6qT%2FAKM6y7TcUe4lXNvZpycH7vUMAlM6pFALUKF2zyCIgA82pQE8cCoYAQAAQDxwKhgAgDxwKhgAwDxwKhgBADxwKhg&uid=50000",
      url_type: 0,
      video_id: "1ZNDH1D0010098/39-0-7/normal-0",
      video_quality: 0
    }
  )
end

#build_thing_product_live_stop_push_services_messageObject



170
171
172
173
174
175
176
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 170

def build_thing_product_live_stop_push_services_message
  Thing::Product::LiveStopPushServicesMessage.build(
    data: {
      video_id: "1ZNDH1D0010098/39-0-7/normal-0"
    }
  )
end

#build_thing_product_return_home_cancel_services_messageObject



182
183
184
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 182

def build_thing_product_return_home_cancel_services_message
  Thing::Product::ReturnHomeCancelServicesMessage.build
end

#build_thing_product_return_home_services_messageObject



178
179
180
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 178

def build_thing_product_return_home_services_message
  Thing::Product::ReturnHomeServicesMessage.build
end

#build_thing_product_return_specific_home_services_message(home_dock_sn: "SN1234567890") ⇒ Object



186
187
188
# File 'lib/dji_mqtt_connect/factories/services_messages.rb', line 186

def build_thing_product_return_specific_home_services_message(home_dock_sn: "SN1234567890")
  Thing::Product::ReturnSpecificHomeServicesMessage.build(home_dock_sn: home_dock_sn)
end