Module: DjiMqttConnect::Factories
Overview
Factories for building example messages
Do not include this in your production code
Defined Under Namespace
Modules: EventsMessages, OsdMessages, ServicesMessages, StateMessages
Instance Method Summary
collapse
#build_thing_product_state_message_with_ar_info_switch, #build_thing_product_state_message_with_commander_flight_height, #build_thing_product_state_message_with_commander_flight_mode, #build_thing_product_state_message_with_commander_mode_lost_action, #build_thing_product_state_message_with_current_commander_flight_mode, #build_thing_product_state_message_with_current_rth_mode, #build_thing_product_state_message_with_firmware_version, #build_thing_product_state_message_with_flysafe_database_version, #build_thing_product_state_message_with_geo_caging_status, #build_thing_product_state_message_with_live_capacity, #build_thing_product_state_message_with_live_status, #build_thing_product_state_message_with_mode_code_reason, #build_thing_product_state_message_with_offline_map_enable, #build_thing_product_state_message_with_payloads, #build_thing_product_state_message_with_rtcm_info, #build_thing_product_state_message_with_uom_real_name_state, #build_thing_product_state_message_with_wireless_link_topo, #build_thing_product_state_message_with_wpmz_version, #build_thing_proudct_state_message_with_rth_mode
#build_thing_product_alarm_state_switch_services_message, #build_thing_product_camera_aim_services_message, #build_thing_product_camera_aim_services_message_data, #build_thing_product_camera_aim_services_reply_message, #build_thing_product_camera_exposure_mode_set_services_message, #build_thing_product_camera_exposure_mode_set_services_message_data, #build_thing_product_camera_exposure_mode_set_services_reply_message, #build_thing_product_camera_exposure_set_services_message, #build_thing_product_camera_exposure_set_services_message_data, #build_thing_product_camera_exposure_set_services_reply_message, #build_thing_product_camera_focal_length_set_services_message, #build_thing_product_camera_focal_length_set_services_message_data, #build_thing_product_camera_focal_length_set_services_reply_message, #build_thing_product_camera_focus_mode_set_services_message, #build_thing_product_camera_focus_mode_set_services_message_data, #build_thing_product_camera_focus_mode_set_services_reply_message, #build_thing_product_camera_focus_value_set_services_message, #build_thing_product_camera_focus_value_set_services_message_data, #build_thing_product_camera_focus_value_set_services_reply_message, #build_thing_product_camera_frame_zoom_services_message, #build_thing_product_camera_frame_zoom_services_message_data, #build_thing_product_camera_frame_zoom_services_reply_message, #build_thing_product_camera_look_at_services_message, #build_thing_product_camera_look_at_services_message_data, #build_thing_product_camera_look_at_services_reply_message, #build_thing_product_camera_mode_switch_services_message, #build_thing_product_camera_mode_switch_services_message_data, #build_thing_product_camera_mode_switch_services_reply_message, #build_thing_product_camera_photo_stop_services_message, #build_thing_product_camera_photo_stop_services_reply_message, #build_thing_product_camera_photo_take_services_message, #build_thing_product_camera_photo_take_services_reply_message, #build_thing_product_camera_point_focus_action_services_message, #build_thing_product_camera_point_focus_action_services_message_data, #build_thing_product_camera_point_focus_action_services_reply_message, #build_thing_product_camera_recording_start_services_message, #build_thing_product_camera_recording_start_services_reply_message, #build_thing_product_camera_recording_stop_services_message, #build_thing_product_camera_recording_stop_services_reply_message, #build_thing_product_camera_screen_drag_services_message, #build_thing_product_camera_screen_drag_services_message_data, #build_thing_product_camera_screen_drag_services_reply_message, #build_thing_product_camera_screen_split_services_message, #build_thing_product_camera_screen_split_services_message_data, #build_thing_product_camera_screen_split_services_reply_message, #build_thing_product_charge_close_services_message, #build_thing_product_charge_close_services_reply_message, #build_thing_product_charge_open_services_message, #build_thing_product_charge_open_services_reply_message, #build_thing_product_cover_close_services_message, #build_thing_product_cover_force_close_services_message, #build_thing_product_cover_force_close_services_reply_message, #build_thing_product_cover_open_services_message, #build_thing_product_debug_mode_close_services_message, #build_thing_product_debug_mode_open_services_message, #build_thing_product_drc_mode_enter_services_message, #build_thing_product_drc_mode_enter_services_message_data, #build_thing_product_drc_mode_enter_services_reply_message, #build_thing_product_drc_mode_exit_services_message, #build_thing_product_drc_mode_exit_services_reply_message, #build_thing_product_drone_close_services_message, #build_thing_product_drone_open_services_message, #build_thing_product_fileupload_list_services_message, #build_thing_product_fileupload_start_services_message, #build_thing_product_flight_authority_grab_services_message, #build_thing_product_flight_authority_grab_services_reply_message, #build_thing_product_flighttask_execute_services_message, #build_thing_product_flighttask_pause_services_message, #build_thing_product_flighttask_prepare_services_message, #build_thing_product_flighttask_progress_get_services_message, #build_thing_product_flighttask_recovery_services_message, #build_thing_product_flighttask_stop_services_message, #build_thing_product_flighttask_undo_services_message, #build_thing_product_fly_to_point_services_message, #build_thing_product_fly_to_point_stop_services_message, #build_thing_product_fly_to_point_update_services_message, #build_thing_product_gimbal_reset_services_message, #build_thing_product_gimbal_reset_services_message_data, #build_thing_product_gimbal_reset_services_reply_message, #build_thing_product_ir_metering_area_set_services_message, #build_thing_product_ir_metering_area_set_services_message_data, #build_thing_product_ir_metering_area_set_services_reply_message, #build_thing_product_ir_metering_mode_set_services_message, #build_thing_product_ir_metering_mode_set_services_message_data, #build_thing_product_ir_metering_mode_set_services_reply_message, #build_thing_product_ir_metering_point_set_services_message, #build_thing_product_ir_metering_point_set_services_message_data, #build_thing_product_ir_metering_point_set_services_reply_message, #build_thing_product_live_camera_change_services_message, #build_thing_product_live_lens_change_services_message, #build_thing_product_live_set_quality_services_message, #build_thing_product_live_start_push_services_message, #build_thing_product_live_stop_push_services_message, #build_thing_product_ota_create_services_message, #build_thing_product_ota_create_services_message_data, #build_thing_product_ota_create_services_reply_message, #build_thing_product_payload_authority_grab_services_message, #build_thing_product_payload_authority_grab_services_reply_message, #build_thing_product_photo_storage_set_services_message, #build_thing_product_photo_storage_set_services_message_data, #build_thing_product_photo_storage_set_services_reply_message, #build_thing_product_return_home_cancel_services_message, #build_thing_product_return_home_services_message, #build_thing_product_return_specific_home_services_message, #build_thing_product_takeoff_to_point_services_message, #build_thing_product_takeoff_to_point_services_reply_message, #build_thing_product_video_storage_set_services_message, #build_thing_product_video_storage_set_services_message_data, #build_thing_product_video_storage_set_services_reply_message
#build_thing_product_dock_osd_message_with_link_status, #build_thing_product_dock_osd_message_with_maintenance_status, #build_thing_product_dock_osd_message_with_sub_device, #build_thing_product_drone_osd_message, #build_thing_product_flight_hub_dock_osd_message, #build_thing_product_flight_hub_drone_osd_message
#build_thing_product_airsense_warning_events_message, #build_thing_product_camera_photo_take_progress_events_message, #build_thing_product_charge_close_events_message, #build_thing_product_charge_open_events_message, #build_thing_product_cover_close_events_message, #build_thing_product_cover_force_close_events_message, #build_thing_product_cover_open_events_message, #build_thing_product_device_exit_homing_notify_events_message, #build_thing_product_device_format_events_message, #build_thing_product_device_reboot_events_message, #build_thing_product_drone_close_events_message, #build_thing_product_drone_open_events_message, #build_thing_product_file_upload_callback_events_message, #build_thing_product_fileupload_progress_events_message, #build_thing_product_flighttask_progress_events_message, #build_thing_product_flighttask_ready_events_message, #build_thing_product_fly_to_point_progress_events_message, #build_thing_product_highest_priority_upload_flighttask_media_events_message, #build_thing_product_obstacle_avoidance_notify_events_message, #build_thing_product_offline_map_sync_progress_events_message, #build_thing_product_ota_progress_events_message, #build_thing_product_release_terminal_control_area_events_message, #build_thing_product_return_home_info_events_message, #build_thing_product_takeoff_to_point_progress_events_message
Instance Method Details
#build_thing_product_airport_bind_status_requests_message ⇒ Object
#build_thing_product_airport_bind_status_requests_reply_message ⇒ Object
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/dji_mqtt_connect/factories.rb', line 114
def build_thing_product_airport_bind_status_requests_reply_message
airport_bind_status_request = build_thing_product_airport_bind_status_requests_message
Thing::Product::AirportBindStatusRequestsReplyMessage.build_for(
airport_bind_status_request,
result: 0,
bind_status: airport_bind_status_request.data.devices.map.with_index do |device, index|
{
sn: device.sn,
is_device_bind_organization: (index % 2).zero?,
organization_id: "12345678",
organization_name: "12345",
device_callsign: "Device organization callsign"
}
end
)
end
|
#build_thing_product_airport_organization_bind_requests_message ⇒ Object
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/dji_mqtt_connect/factories.rb', line 132
def build_thing_product_airport_organization_bind_requests_message
message_data = {
bind_devices: [
{
device_binding_code: "",
organization_id: "curo",
device_callsign: "",
sn: "DOCK01",
device_secret: "DEVICE_SECRET",
device_nonce: "DEVICE_NONCE",
device_model_key: "3-1-0"
},
{
device_binding_code: "",
organization_id: "curo",
device_callsign: "",
sn: "M30DRONE01",
device_secret: "DEVICE_SECRET",
device_nonce: "DEVICE_NONCE",
device_model_key: "0-67-0"
}
]
}
Thing::Product::AirportOrganizationBindRequestsMessage.new(
_method: "airport_organization_bind",
_data: message_data,
tid: Message.generate_tid,
bid: Message.generate_bid,
timestamp: Message.current_timestamp,
data: message_data,
gateway: "DOCK01"
)
end
|
#build_thing_product_airport_organization_bind_requests_reply_message ⇒ Object
167
168
169
170
171
172
173
174
|
# File 'lib/dji_mqtt_connect/factories.rb', line 167
def build_thing_product_airport_organization_bind_requests_reply_message
airport_organization_bind_request = build_thing_product_airport_organization_bind_requests_message
Thing::Product::AirportOrganizationBindRequestsReplyMessage.build_for(
airport_organization_bind_request,
result: 0
)
end
|
#build_thing_product_airport_organization_get_requests_message ⇒ Object
#build_thing_product_airport_organization_get_requests_reply_message ⇒ Object
192
193
194
195
196
197
198
199
200
201
202
|
# File 'lib/dji_mqtt_connect/factories.rb', line 192
def build_thing_product_airport_organization_get_requests_reply_message
airport_organization_get_request = build_thing_product_airport_organization_get_requests_message
Thing::Product::AirportOrganizationGetRequestsReplyMessage.build_for(
airport_organization_get_request,
result: 0,
output: {
organization_name: "12345"
}
)
end
|
#build_thing_product_alarm_state_switch_services_reply_message ⇒ Object
#build_thing_product_config_requests_message ⇒ Object
#build_thing_product_config_requests_reply_message ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/dji_mqtt_connect/factories.rb', line 80
def build_thing_product_config_requests_reply_message
request_message = build_thing_product_config_requests_message
reply_data = {
ntp_server_host: "http://time.google.com/",
app_id: "123456",
app_key: "app_key",
app_license: "app_license"
}
Thing::Product::ConfigRequestsReplyMessage.build_for(request_message, data: reply_data)
end
|
#build_thing_product_cover_close_services_reply_message ⇒ Object
#build_thing_product_cover_open_services_reply_message ⇒ Object
#build_thing_product_debug_mode_close_services_reply_message ⇒ Object
#build_thing_product_debug_mode_open_services_reply_message ⇒ Object
#build_thing_product_flight_areas_drone_location_events_message ⇒ Object
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/dji_mqtt_connect/factories.rb', line 204
def build_thing_product_flight_areas_drone_location_events_message
message_data = {
drone_locations: [
{
area_id: "d275c4e1-d864-4736-8b5d-5f5882ee9bdd",
area_distance: 100.11,
is_in_area: true
}
]
}
Thing::Product::FlightAreasDroneLocationEventsMessage.new(
_method: "flight_areas_drone_location",
tid: Message.generate_tid,
bid: Message.generate_bid,
timestamp: Message.current_timestamp,
data: message_data,
_data: message_data.deep_stringify_keys
)
end
|
#build_thing_product_flight_areas_get_requests_message ⇒ Object
#build_thing_product_flight_areas_get_requests_reply_message ⇒ Object
259
260
261
262
|
# File 'lib/dji_mqtt_connect/factories.rb', line 259
def build_thing_product_flight_areas_get_requests_reply_message
request_message = build_thing_product_flight_areas_get_requests_message
Thing::Product::FlightAreasGetRequestsReplyMessage.build_for(request_message, files: [])
end
|
#build_thing_product_flight_areas_sync_progress_events_message ⇒ Object
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/dji_mqtt_connect/factories.rb', line 225
def build_thing_product_flight_areas_sync_progress_events_message
message_data = {
file: {
name: "geofence_xxx.json",
checksum: "sha256"
},
status: "synchronized",
reason: 0
}
Thing::Product::FlightAreasSyncProgressEventsMessage.new(
_method: "flight_areas_sync_progress",
tid: Message.generate_tid,
bid: Message.generate_bid,
timestamp: Message.current_timestamp,
data: message_data,
_data: message_data.deep_stringify_keys
)
end
|
#build_thing_product_flighttask_execute_services_reply_message ⇒ Object
#build_thing_product_flighttask_pause_services_reply_message ⇒ Object
#build_thing_product_flighttask_prepare_services_reply_message ⇒ Object
#build_thing_product_flighttask_recovery_services_reply_message ⇒ Object
#build_thing_product_flighttask_resource_get_requests_message ⇒ Object
#build_thing_product_flighttask_resource_get_requests_reply_message ⇒ Object
279
280
281
282
283
284
285
286
287
288
289
|
# File 'lib/dji_mqtt_connect/factories.rb', line 279
def build_thing_product_flighttask_resource_get_requests_reply_message
flighttask_resource_get_request = build_thing_product_flighttask_resource_get_requests_message
Thing::Product::FlighttaskResourceGetRequestsReplyMessage.build_for(
flighttask_resource_get_request,
result: 0,
file: {
fingerprint: "signxxxx",
url: "https://xx.oss-cn-hangzhou.aliyuncs.com/xx.kmz?Expires=xx&OSSAccessKeyId=xxx&Signature=xxx"
}
)
end
|
#build_thing_product_flighttask_undo_services_reply_message ⇒ Object
#build_thing_product_live_camera_change_services_reply_message ⇒ Object
#build_thing_product_live_lens_change_services_reply_message ⇒ Object
Live Stream (Services Reply Messages) ###
#build_thing_product_live_set_quality_services_reply_message ⇒ Object
#build_thing_product_live_start_push_services_reply_message ⇒ Object
#build_thing_product_live_stop_push_services_reply_message ⇒ Object
#build_thing_product_offline_map_get_requests_message ⇒ Object
#build_thing_product_offline_map_get_requests_reply_message ⇒ Object
307
308
309
310
311
312
313
314
|
# File 'lib/dji_mqtt_connect/factories.rb', line 307
def build_thing_product_offline_map_get_requests_reply_message
request_message = build_thing_product_offline_map_get_requests_message
Thing::Product::OfflineMapGetRequestsReplyMessage.build_for(
request_message,
result: 0
)
end
|
#build_thing_product_offline_map_get_v2_requests_message ⇒ Object
#build_thing_product_offline_map_get_v2_requests_reply_message ⇒ Object
334
335
336
337
338
339
340
341
|
# File 'lib/dji_mqtt_connect/factories.rb', line 334
def build_thing_product_offline_map_get_v2_requests_reply_message
request_message = build_thing_product_offline_map_get_v2_requests_message
Thing::Product::OfflineMapGetV2RequestsReplyMessage.build_for(
request_message,
result: 0
)
end
|
#build_thing_product_return_home_cancel_services_reply_message ⇒ Object
#build_thing_product_return_home_services_reply_message ⇒ Object
#build_thing_product_storage_config_get_requests_message ⇒ Object
#build_thing_product_storage_config_get_requests_reply_message ⇒ Object
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
# File 'lib/dji_mqtt_connect/factories.rb', line 360
def build_thing_product_storage_config_get_requests_reply_message
storage_config_get_request = build_thing_product_storage_config_get_requests_message
Thing::Product::StorageConfigGetRequestsReplyMessage.build_for(
storage_config_get_request,
result: 0,
output: {
bucket: "bucket_name",
credentials: {
access_key_id: "access_key_id",
access_key_secret: "access_key_secret",
expire: 3600,
security_token: "security_token"
},
endpoint: "https://oss-cn-hangzhou.aliyuncs.com",
object_key_prefix: "b4cfaae6-bd9d-4cd0-8472-63b608c3c581",
provider: "ali",
region: "hz"
}
)
end
|
#build_thing_product_update_topo_message_with_online_device ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/dji_mqtt_connect/factories.rb', line 19
def build_thing_product_update_topo_message_with_online_device
message_data = {
type: 98,
sub_type: 0,
device_secret: "secret",
nonce: "nonce",
version: 1,
sub_devices: [
{
sn: "SUBDEVICESN",
type: 116,
sub_type: 0,
index: "A",
device_secret: "secret",
nonce: "nonce",
version: 1
}
]
}
Sys::Product::UpdateTopoStatusMessage.new(
_method: "update_topo",
tid: Message.generate_tid,
bid: Message.generate_bid,
timestamp: Message.current_timestamp,
data: message_data,
_data: message_data.deep_stringify_keys
)
end
|
#build_thing_product_update_topo_status_reply_message ⇒ Object