dji_mqtt_connect 0.1.33.2 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dji_mqtt_connect/factories/events/ota_progress.rb +27 -0
- data/lib/dji_mqtt_connect/factories/osd/dock.rb +161 -0
- data/lib/dji_mqtt_connect/factories/osd/drone.rb +71 -0
- data/lib/dji_mqtt_connect/factories/osd/flight_hub_dock.rb +78 -0
- data/lib/dji_mqtt_connect/factories/osd/flight_hub_drone.rb +76 -0
- data/lib/dji_mqtt_connect/factories/osd_messages.rb +8 -0
- data/lib/dji_mqtt_connect/factories/services/ota_create.rb +48 -0
- data/lib/dji_mqtt_connect/factories.rb +2 -302
- data/lib/dji_mqtt_connect/messages/thing/product/events/ota_progress.rb +40 -0
- data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +4 -2
- data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +60 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/ota_create.rb +37 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/ota_create.rb +26 -0
- data/lib/dji_mqtt_connect/messages/thing/product/state_message.rb +10 -1
- data/lib/dji_mqtt_connect/mixins/dock_mode_code.rb +11 -0
- data/lib/dji_mqtt_connect/mixins/drone_mode_code_reason.rb +11 -0
- data/lib/dji_mqtt_connect/types.rb +28 -0
- data/lib/dji_mqtt_connect/version.rb +1 -1
- data/lib/dji_mqtt_connect.rb +4 -24
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1aea3da1b601924d1a7fe899cedbdbeb7bf0f969173345348bd2b455e2b129d7
|
|
4
|
+
data.tar.gz: ebcc8e6ed52d0dfafbe5d9588cf46a40349ed2b5798bef5c128831eb939a71a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c94d3325deaa697f911dc34a595099e050555a05cb19cc6f5c73a6404b05f37d51128eedbefcc28ca8188bd98aad43f785cb0813f4c61d6ad50650af2f414ad
|
|
7
|
+
data.tar.gz: db6864b8cec104cab315c479e02d29fb31d539d35e7d225969b44599b730b9360d42aae6d070bdcd57f1e8166f6c774b61299769bf2794829f4e617b93dd724a
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Factories::EventsMessages
|
|
5
|
+
def build_thing_product_ota_progress_events_message
|
|
6
|
+
message_data = {
|
|
7
|
+
result: 0,
|
|
8
|
+
output: {
|
|
9
|
+
progress: {
|
|
10
|
+
percent: 50,
|
|
11
|
+
current_step: "download_firmware"
|
|
12
|
+
},
|
|
13
|
+
status: "in_progress"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Thing::Product::OtaProgressEventsMessage.new(
|
|
18
|
+
bid: Message.generate_bid,
|
|
19
|
+
tid: Message.generate_tid,
|
|
20
|
+
timestamp: Message.current_timestamp,
|
|
21
|
+
_method: "ota_progress",
|
|
22
|
+
data: message_data,
|
|
23
|
+
_data: message_data
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Factories::OsdMessages
|
|
5
|
+
def build_thing_product_dock_osd_message_with_sub_device
|
|
6
|
+
message_data = {
|
|
7
|
+
network_state: {
|
|
8
|
+
type: 2,
|
|
9
|
+
quality: 0,
|
|
10
|
+
rate: 0.1459999978542328
|
|
11
|
+
},
|
|
12
|
+
drone_charge_state: {
|
|
13
|
+
state: 0,
|
|
14
|
+
capacity_percent: 0
|
|
15
|
+
},
|
|
16
|
+
drone_in_dock: 0,
|
|
17
|
+
rainfall: 1,
|
|
18
|
+
wind_speed: 0,
|
|
19
|
+
environment_temperature: 18.8,
|
|
20
|
+
temperature: 19.6,
|
|
21
|
+
humidity: 58,
|
|
22
|
+
latitude: 0,
|
|
23
|
+
longitude: 0,
|
|
24
|
+
height: 0,
|
|
25
|
+
alternate_land_point: {
|
|
26
|
+
latitude: "-33.865143",
|
|
27
|
+
longitude: "151.209900",
|
|
28
|
+
height: 0,
|
|
29
|
+
safe_land_height: 30,
|
|
30
|
+
is_configured: 0
|
|
31
|
+
},
|
|
32
|
+
first_power_on: 1631945855969,
|
|
33
|
+
position_state: {
|
|
34
|
+
is_calibration: 1,
|
|
35
|
+
is_fixed: 1,
|
|
36
|
+
quality: 1,
|
|
37
|
+
gps_number: 0,
|
|
38
|
+
rtk_number: 0
|
|
39
|
+
},
|
|
40
|
+
storage: {
|
|
41
|
+
total: 82045336,
|
|
42
|
+
used: 56385704
|
|
43
|
+
},
|
|
44
|
+
mode_code: 1,
|
|
45
|
+
cover_state: 1,
|
|
46
|
+
supplement_light_state: 0,
|
|
47
|
+
emergency_stop_state: 0,
|
|
48
|
+
air_conditioner: {
|
|
49
|
+
air_conditioner_state: 32767,
|
|
50
|
+
switch_time: 32767
|
|
51
|
+
},
|
|
52
|
+
battery_store_mode: 2,
|
|
53
|
+
alarm_state: 0,
|
|
54
|
+
putter_state: 1,
|
|
55
|
+
sub_device: {
|
|
56
|
+
device_sn: "M30DRONE01",
|
|
57
|
+
device_model_key: "0-67-0",
|
|
58
|
+
device_online_status: 0,
|
|
59
|
+
device_paired: 0
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Thing::Product::DockOsdMessage.new(
|
|
64
|
+
tid: Message.generate_tid,
|
|
65
|
+
bid: Message.generate_bid,
|
|
66
|
+
timestamp: Message.current_timestamp,
|
|
67
|
+
gateway: "GATEWAYSN",
|
|
68
|
+
data: message_data,
|
|
69
|
+
_data: message_data
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def build_thing_product_dock_osd_message_with_maintenance_status
|
|
74
|
+
message_data = {
|
|
75
|
+
job_number: 52,
|
|
76
|
+
acc_time: 146930,
|
|
77
|
+
activation_time: 1682969151,
|
|
78
|
+
maintain_status: {
|
|
79
|
+
maintain_status_array: [
|
|
80
|
+
{
|
|
81
|
+
state: 0,
|
|
82
|
+
last_maintain_type: 17,
|
|
83
|
+
last_maintain_time: 0,
|
|
84
|
+
last_maintain_work_sorties: 0
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
electric_supply_voltage: 0,
|
|
89
|
+
working_voltage: 0,
|
|
90
|
+
working_current: 0,
|
|
91
|
+
backup_battery: {
|
|
92
|
+
voltage: 24365,
|
|
93
|
+
temperature: 32767,
|
|
94
|
+
switch: 1
|
|
95
|
+
},
|
|
96
|
+
drone_battery_maintenance_info: {
|
|
97
|
+
batteries: [
|
|
98
|
+
{
|
|
99
|
+
index: 0,
|
|
100
|
+
capacity_percent: 32767,
|
|
101
|
+
voltage: 32767,
|
|
102
|
+
temperature: 32767
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
index: 1,
|
|
106
|
+
capacity_percent: 32767,
|
|
107
|
+
voltage: 32767,
|
|
108
|
+
temperature: 32767
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
Thing::Product::DockOsdMessage.new(
|
|
115
|
+
tid: Message.generate_tid,
|
|
116
|
+
bid: Message.generate_bid,
|
|
117
|
+
timestamp: Message.current_timestamp,
|
|
118
|
+
gateway: "GATEWAYSN",
|
|
119
|
+
data: message_data,
|
|
120
|
+
_data: message_data
|
|
121
|
+
)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def build_thing_product_dock_osd_message_with_link_status
|
|
125
|
+
message_data = {
|
|
126
|
+
drc_state: 0,
|
|
127
|
+
flighttask_prepare_capacity: 1,
|
|
128
|
+
flighttask_step_code: 255,
|
|
129
|
+
media_file_detail: {
|
|
130
|
+
remain_upload: 140
|
|
131
|
+
},
|
|
132
|
+
sdr: {
|
|
133
|
+
down_quality: 0,
|
|
134
|
+
frequency_band: 5.8,
|
|
135
|
+
up_quality: 0
|
|
136
|
+
},
|
|
137
|
+
wireless_link: {
|
|
138
|
+
_4g_freq_band: 2.4,
|
|
139
|
+
_4g_gnd_quality: 0,
|
|
140
|
+
_4g_link_state: 0,
|
|
141
|
+
_4g_quality: 0,
|
|
142
|
+
_4g_uav_quality: 0,
|
|
143
|
+
dongle_number: 0,
|
|
144
|
+
link_workmode: 0,
|
|
145
|
+
sdr_freq_band: 2.4,
|
|
146
|
+
sdr_link_state: 0,
|
|
147
|
+
sdr_quality: 0
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
Thing::Product::DockOsdMessage.new(
|
|
152
|
+
tid: Message.generate_tid,
|
|
153
|
+
bid: Message.generate_bid,
|
|
154
|
+
timestamp: Message.current_timestamp,
|
|
155
|
+
gateway: "GATEWAYSN",
|
|
156
|
+
data: message_data,
|
|
157
|
+
_data: message_data
|
|
158
|
+
)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Factories::OsdMessages
|
|
5
|
+
def build_thing_product_drone_osd_message
|
|
6
|
+
message_data = {
|
|
7
|
+
attitude_head: 121,
|
|
8
|
+
attitude_pitch: -6.9,
|
|
9
|
+
attitude_roll: 29.7,
|
|
10
|
+
battery: {
|
|
11
|
+
batteries: [
|
|
12
|
+
{
|
|
13
|
+
capacity_percent: 99,
|
|
14
|
+
firmware_version: "08.75.02.17",
|
|
15
|
+
index: 0,
|
|
16
|
+
loop_times: 2,
|
|
17
|
+
sn: "BATTERYSERIAL",
|
|
18
|
+
sub_type: 0,
|
|
19
|
+
temperature: 26.4,
|
|
20
|
+
type: 0,
|
|
21
|
+
voltage: 17260
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
capacity_percent: 99,
|
|
25
|
+
landing_power: 0,
|
|
26
|
+
remain_flight_time: 0,
|
|
27
|
+
return_home_power: 0
|
|
28
|
+
},
|
|
29
|
+
distance_limit_status: {
|
|
30
|
+
distance_limit: 480,
|
|
31
|
+
state: 1
|
|
32
|
+
},
|
|
33
|
+
elevation: 0,
|
|
34
|
+
firmware_version: "05.00.0206",
|
|
35
|
+
gear: 1,
|
|
36
|
+
height: 123.424911,
|
|
37
|
+
height_limit: 0,
|
|
38
|
+
home_distance: 0,
|
|
39
|
+
horizontal_speed: 0,
|
|
40
|
+
latitude: 0,
|
|
41
|
+
longitude: 0,
|
|
42
|
+
mode_code: 0,
|
|
43
|
+
position_state: {
|
|
44
|
+
gps_number: 0,
|
|
45
|
+
is_fixed: 0,
|
|
46
|
+
quality: 0,
|
|
47
|
+
rtk_number: 0
|
|
48
|
+
},
|
|
49
|
+
storage: {
|
|
50
|
+
total: 60097000,
|
|
51
|
+
used: 15189000
|
|
52
|
+
},
|
|
53
|
+
total_flight_distance: 0,
|
|
54
|
+
total_flight_time: 0,
|
|
55
|
+
track_id: "",
|
|
56
|
+
vertical_speed: 0,
|
|
57
|
+
wind_direction: 0,
|
|
58
|
+
wind_speed: 0
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Thing::Product::DroneOsdMessage.new(
|
|
62
|
+
tid: Message.generate_tid,
|
|
63
|
+
bid: Message.generate_bid,
|
|
64
|
+
timestamp: Message.current_timestamp,
|
|
65
|
+
gateway: "GATEWAYSN",
|
|
66
|
+
data: message_data,
|
|
67
|
+
_data: message_data
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Factories::OsdMessages
|
|
5
|
+
def build_thing_product_flight_hub_dock_osd_message
|
|
6
|
+
message_data = {
|
|
7
|
+
host: {
|
|
8
|
+
air_conditioner: {
|
|
9
|
+
air_conditioner_state: 0,
|
|
10
|
+
switch_time: 0
|
|
11
|
+
},
|
|
12
|
+
alarm_state: 0,
|
|
13
|
+
alternate_land_point: {
|
|
14
|
+
height: 0,
|
|
15
|
+
is_configured: 1,
|
|
16
|
+
latitude: -33.76867482124178,
|
|
17
|
+
longitude: 150.94983762222526,
|
|
18
|
+
safe_land_height: 30
|
|
19
|
+
},
|
|
20
|
+
battery_store_mode: 2,
|
|
21
|
+
cover_state: 0,
|
|
22
|
+
drone_charge_state: {
|
|
23
|
+
capacity_percent: 95,
|
|
24
|
+
state: 0
|
|
25
|
+
},
|
|
26
|
+
drone_in_dock: 1,
|
|
27
|
+
emergency_stop_state: 0,
|
|
28
|
+
environment_temperature: 24.8,
|
|
29
|
+
first_power_on: 1631945855969,
|
|
30
|
+
heading: 164.2085418701172,
|
|
31
|
+
height: 62.20537567138672,
|
|
32
|
+
home_position_is_valid: 2,
|
|
33
|
+
humidity: 47,
|
|
34
|
+
latitude: -33.768706649492614,
|
|
35
|
+
longitude: 150.9497880000493,
|
|
36
|
+
mode_code: 0,
|
|
37
|
+
network_state: {
|
|
38
|
+
quality: 0,
|
|
39
|
+
rate: 3,
|
|
40
|
+
type: 2
|
|
41
|
+
},
|
|
42
|
+
position_state: {
|
|
43
|
+
gps_number: 6,
|
|
44
|
+
is_calibration: 1,
|
|
45
|
+
is_fixed: 3,
|
|
46
|
+
quality: 5,
|
|
47
|
+
rtk_number: 30
|
|
48
|
+
},
|
|
49
|
+
putter_state: 0,
|
|
50
|
+
rainfall: 0,
|
|
51
|
+
silent_mode: 0,
|
|
52
|
+
storage: {
|
|
53
|
+
total: 53082240,
|
|
54
|
+
used: 14370264
|
|
55
|
+
},
|
|
56
|
+
sub_device: {
|
|
57
|
+
device_online_status: 0,
|
|
58
|
+
device_paired: 1,
|
|
59
|
+
device_sn: "SN000002"
|
|
60
|
+
},
|
|
61
|
+
supplement_light_state: 0,
|
|
62
|
+
temperature: 33.1,
|
|
63
|
+
wind_speed: 0.8
|
|
64
|
+
},
|
|
65
|
+
sn: "SN00001"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Thing::Product::FlightHubDockOsdMessage.new(
|
|
69
|
+
OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
|
|
70
|
+
biz_code: "device_osd",
|
|
71
|
+
version: "1.0",
|
|
72
|
+
timestamp: Message.current_timestamp,
|
|
73
|
+
data: message_data,
|
|
74
|
+
_data: message_data
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Factories::OsdMessages
|
|
5
|
+
def build_thing_product_flight_hub_drone_osd_message
|
|
6
|
+
message_data = {
|
|
7
|
+
host: {
|
|
8
|
+
activation_time: 1682969151,
|
|
9
|
+
attitude_head: 164.2085418701172,
|
|
10
|
+
attitude_pitch: -2.0999999046325684,
|
|
11
|
+
attitude_roll: 0.30000001192092896,
|
|
12
|
+
battery: {
|
|
13
|
+
batteries: [
|
|
14
|
+
{
|
|
15
|
+
capacity_percent: 95,
|
|
16
|
+
firmware_version: "01.00.0600",
|
|
17
|
+
index: 0,
|
|
18
|
+
loop_times: 27,
|
|
19
|
+
sn: "BATTERY01",
|
|
20
|
+
sub_type: 67,
|
|
21
|
+
temperature: 38,
|
|
22
|
+
type: 2,
|
|
23
|
+
voltage: 24200
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
capacity_percent: 95,
|
|
27
|
+
landing_power: 20,
|
|
28
|
+
remain_flight_time: 19,
|
|
29
|
+
return_home_power: 25
|
|
30
|
+
},
|
|
31
|
+
distance_limit_status: {
|
|
32
|
+
distance_limit: 500,
|
|
33
|
+
is_near_distance_limit: 0,
|
|
34
|
+
state: 1
|
|
35
|
+
},
|
|
36
|
+
elevation: 62.20537567138672,
|
|
37
|
+
firmware_version: "01.00.0600",
|
|
38
|
+
gear: 0,
|
|
39
|
+
height: 62.20537567138672,
|
|
40
|
+
height_limit: 500,
|
|
41
|
+
home_distance: 23.390625,
|
|
42
|
+
horizontal_speed: 0.10000000149011612,
|
|
43
|
+
latitude: -33.768706649492614,
|
|
44
|
+
longitude: 150.9497880000493,
|
|
45
|
+
mode_code: 0,
|
|
46
|
+
position_state: {
|
|
47
|
+
gps_number: 6,
|
|
48
|
+
is_fixed: 3,
|
|
49
|
+
quality: 5,
|
|
50
|
+
rtk_number: 30
|
|
51
|
+
},
|
|
52
|
+
storage: {
|
|
53
|
+
total: 53082240,
|
|
54
|
+
used: 14370264
|
|
55
|
+
},
|
|
56
|
+
total_flight_distance: 1234.5,
|
|
57
|
+
total_flight_time: 146930,
|
|
58
|
+
track_id: nil,
|
|
59
|
+
vertical_speed: -0.30000001192092896,
|
|
60
|
+
wind_direction: 180,
|
|
61
|
+
wind_speed: 0.800000011920929
|
|
62
|
+
},
|
|
63
|
+
sn: "DRONE01"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Thing::Product::FlightHubDroneOsdMessage.new(
|
|
67
|
+
OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
|
|
68
|
+
biz_code: "device_osd",
|
|
69
|
+
version: "1.0",
|
|
70
|
+
timestamp: Message.current_timestamp,
|
|
71
|
+
data: message_data,
|
|
72
|
+
_data: message_data
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Factories::ServicesMessages
|
|
5
|
+
def build_thing_product_ota_create_services_message(data: build_thing_product_ota_create_services_message_data)
|
|
6
|
+
Thing::Product::OtaCreateServicesMessage.build(
|
|
7
|
+
data: data
|
|
8
|
+
)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def build_thing_product_ota_create_services_message_data
|
|
12
|
+
{
|
|
13
|
+
devices: [
|
|
14
|
+
{
|
|
15
|
+
file_name: "wm245_1.00.223.zip",
|
|
16
|
+
file_size: 653467234,
|
|
17
|
+
file_url: "https://s3.com/xxx.zip",
|
|
18
|
+
firmware_upgrade_type: 2,
|
|
19
|
+
md5: "abcdefabcdefabcdef",
|
|
20
|
+
product_version: "1.00.223",
|
|
21
|
+
sn: "DRONESN"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
firmware_upgrade_type: 3,
|
|
25
|
+
product_version: "1.00.223",
|
|
26
|
+
sn: "DOCKSN"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def build_thing_product_ota_create_services_reply_message(status: "ok", result: 0)
|
|
33
|
+
message_data = {
|
|
34
|
+
status: status,
|
|
35
|
+
result: result
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Thing::Product::OtaCreateServicesReplyMessage.new(
|
|
39
|
+
bid: SecureRandom.uuid,
|
|
40
|
+
tid: SecureRandom.uuid,
|
|
41
|
+
timestamp: Message.current_timestamp,
|
|
42
|
+
_method: "ota_create",
|
|
43
|
+
_data: message_data,
|
|
44
|
+
data: message_data
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -5,315 +5,15 @@ module DjiMqttConnect
|
|
|
5
5
|
# Do not include this in your production code
|
|
6
6
|
module Factories
|
|
7
7
|
autoload :EventsMessages, "dji_mqtt_connect/factories/events_messages"
|
|
8
|
+
autoload :OsdMessages, "dji_mqtt_connect/factories/osd_messages"
|
|
8
9
|
autoload :ServicesMessages, "dji_mqtt_connect/factories/services_messages"
|
|
9
10
|
autoload :StateMessages, "dji_mqtt_connect/factories/state_messages"
|
|
10
11
|
|
|
11
12
|
include EventsMessages
|
|
13
|
+
include OsdMessages
|
|
12
14
|
include ServicesMessages
|
|
13
15
|
include StateMessages
|
|
14
16
|
|
|
15
|
-
# OSD
|
|
16
|
-
|
|
17
|
-
def build_thing_product_dock_osd_message_with_sub_device
|
|
18
|
-
message_data = {
|
|
19
|
-
network_state: {
|
|
20
|
-
type: 2,
|
|
21
|
-
quality: 0,
|
|
22
|
-
rate: 0.1459999978542328
|
|
23
|
-
},
|
|
24
|
-
drone_charge_state: {
|
|
25
|
-
state: 0,
|
|
26
|
-
capacity_percent: 0
|
|
27
|
-
},
|
|
28
|
-
drone_in_dock: 0,
|
|
29
|
-
rainfall: 1,
|
|
30
|
-
wind_speed: 0,
|
|
31
|
-
environment_temperature: 18.8,
|
|
32
|
-
temperature: 19.6,
|
|
33
|
-
humidity: 58,
|
|
34
|
-
latitude: 0,
|
|
35
|
-
longitude: 0,
|
|
36
|
-
height: 0,
|
|
37
|
-
alternate_land_point: {
|
|
38
|
-
latitude: "-33.865143",
|
|
39
|
-
longitude: "151.209900",
|
|
40
|
-
height: 0,
|
|
41
|
-
safe_land_height: 30,
|
|
42
|
-
is_configured: 0
|
|
43
|
-
},
|
|
44
|
-
first_power_on: 1631945855969,
|
|
45
|
-
position_state: {
|
|
46
|
-
is_calibration: 1,
|
|
47
|
-
is_fixed: 1,
|
|
48
|
-
quality: 1,
|
|
49
|
-
gps_number: 0,
|
|
50
|
-
rtk_number: 0
|
|
51
|
-
},
|
|
52
|
-
storage: {
|
|
53
|
-
total: 82045336,
|
|
54
|
-
used: 56385704
|
|
55
|
-
},
|
|
56
|
-
mode_code: 1,
|
|
57
|
-
cover_state: 1,
|
|
58
|
-
supplement_light_state: 0,
|
|
59
|
-
emergency_stop_state: 0,
|
|
60
|
-
air_conditioner: {
|
|
61
|
-
air_conditioner_state: 32767,
|
|
62
|
-
switch_time: 32767
|
|
63
|
-
},
|
|
64
|
-
battery_store_mode: 2,
|
|
65
|
-
alarm_state: 0,
|
|
66
|
-
putter_state: 1,
|
|
67
|
-
sub_device: {
|
|
68
|
-
device_sn: "M30DRONE01",
|
|
69
|
-
device_model_key: "0-67-0",
|
|
70
|
-
device_online_status: 0,
|
|
71
|
-
device_paired: 0
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Thing::Product::DockOsdMessage.new(
|
|
76
|
-
tid: Message.generate_tid,
|
|
77
|
-
bid: Message.generate_bid,
|
|
78
|
-
timestamp: Message.current_timestamp,
|
|
79
|
-
gateway: "GATEWAYSN",
|
|
80
|
-
data: message_data,
|
|
81
|
-
_data: message_data
|
|
82
|
-
)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def build_thing_product_dock_osd_message_with_maintenance_status
|
|
86
|
-
message_data = {
|
|
87
|
-
job_number: 52,
|
|
88
|
-
acc_time: 146930,
|
|
89
|
-
activation_time: 1682969151,
|
|
90
|
-
maintain_status: {
|
|
91
|
-
maintain_status_array: [
|
|
92
|
-
{
|
|
93
|
-
state: 0,
|
|
94
|
-
last_maintain_type: 17,
|
|
95
|
-
last_maintain_time: 0,
|
|
96
|
-
last_maintain_work_sorties: 0
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
},
|
|
100
|
-
electric_supply_voltage: 0,
|
|
101
|
-
working_voltage: 0,
|
|
102
|
-
working_current: 0,
|
|
103
|
-
backup_battery: {
|
|
104
|
-
voltage: 24365,
|
|
105
|
-
temperature: 32767,
|
|
106
|
-
switch: 1
|
|
107
|
-
},
|
|
108
|
-
drone_battery_maintenance_info: {
|
|
109
|
-
batteries: [
|
|
110
|
-
{
|
|
111
|
-
index: 0,
|
|
112
|
-
capacity_percent: 32767,
|
|
113
|
-
voltage: 32767,
|
|
114
|
-
temperature: 32767
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
index: 1,
|
|
118
|
-
capacity_percent: 32767,
|
|
119
|
-
voltage: 32767,
|
|
120
|
-
temperature: 32767
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
Thing::Product::DockOsdMessage.new(
|
|
127
|
-
tid: Message.generate_tid,
|
|
128
|
-
bid: Message.generate_bid,
|
|
129
|
-
timestamp: Message.current_timestamp,
|
|
130
|
-
gateway: "GATEWAYSN",
|
|
131
|
-
data: message_data,
|
|
132
|
-
_data: message_data
|
|
133
|
-
)
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
def build_thing_product_dock_osd_message_with_link_status
|
|
137
|
-
message_data = {
|
|
138
|
-
drc_state: 0,
|
|
139
|
-
flighttask_prepare_capacity: 1,
|
|
140
|
-
flighttask_step_code: 255,
|
|
141
|
-
media_file_detail: {
|
|
142
|
-
remain_upload: 140
|
|
143
|
-
},
|
|
144
|
-
sdr: {
|
|
145
|
-
down_quality: 0,
|
|
146
|
-
frequency_band: 5.8,
|
|
147
|
-
up_quality: 0
|
|
148
|
-
},
|
|
149
|
-
wireless_link: {
|
|
150
|
-
_4g_freq_band: 2.4,
|
|
151
|
-
_4g_gnd_quality: 0,
|
|
152
|
-
_4g_link_state: 0,
|
|
153
|
-
_4g_quality: 0,
|
|
154
|
-
_4g_uav_quality: 0,
|
|
155
|
-
dongle_number: 0,
|
|
156
|
-
link_workmode: 0,
|
|
157
|
-
sdr_freq_band: 2.4,
|
|
158
|
-
sdr_link_state: 0,
|
|
159
|
-
sdr_quality: 0
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
Thing::Product::DockOsdMessage.new(
|
|
164
|
-
tid: Message.generate_tid,
|
|
165
|
-
bid: Message.generate_bid,
|
|
166
|
-
timestamp: Message.current_timestamp,
|
|
167
|
-
gateway: "GATEWAYSN",
|
|
168
|
-
data: message_data,
|
|
169
|
-
_data: message_data
|
|
170
|
-
)
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
def build_thing_product_flight_hub_dock_osd_message
|
|
174
|
-
message_data = {
|
|
175
|
-
host: {
|
|
176
|
-
air_conditioner: {
|
|
177
|
-
air_conditioner_state: 0,
|
|
178
|
-
switch_time: 0
|
|
179
|
-
},
|
|
180
|
-
alarm_state: 0,
|
|
181
|
-
alternate_land_point: {
|
|
182
|
-
height: 0,
|
|
183
|
-
is_configured: 1,
|
|
184
|
-
latitude: -33.76867482124178,
|
|
185
|
-
longitude: 150.94983762222526,
|
|
186
|
-
safe_land_height: 30
|
|
187
|
-
},
|
|
188
|
-
battery_store_mode: 2,
|
|
189
|
-
cover_state: 0,
|
|
190
|
-
drone_charge_state: {
|
|
191
|
-
capacity_percent: 95,
|
|
192
|
-
state: 0
|
|
193
|
-
},
|
|
194
|
-
drone_in_dock: 1,
|
|
195
|
-
emergency_stop_state: 0,
|
|
196
|
-
environment_temperature: 24.8,
|
|
197
|
-
first_power_on: 1631945855969,
|
|
198
|
-
heading: 164.2085418701172,
|
|
199
|
-
height: 62.20537567138672,
|
|
200
|
-
home_position_is_valid: 2,
|
|
201
|
-
humidity: 47,
|
|
202
|
-
latitude: -33.768706649492614,
|
|
203
|
-
longitude: 150.9497880000493,
|
|
204
|
-
mode_code: 0,
|
|
205
|
-
network_state: {
|
|
206
|
-
quality: 0,
|
|
207
|
-
rate: 3,
|
|
208
|
-
type: 2
|
|
209
|
-
},
|
|
210
|
-
position_state: {
|
|
211
|
-
gps_number: 6,
|
|
212
|
-
is_calibration: 1,
|
|
213
|
-
is_fixed: 3,
|
|
214
|
-
quality: 5,
|
|
215
|
-
rtk_number: 30
|
|
216
|
-
},
|
|
217
|
-
putter_state: 0,
|
|
218
|
-
rainfall: 0,
|
|
219
|
-
silent_mode: 0,
|
|
220
|
-
storage: {
|
|
221
|
-
total: 53082240,
|
|
222
|
-
used: 14370264
|
|
223
|
-
},
|
|
224
|
-
sub_device: {
|
|
225
|
-
device_online_status: 0,
|
|
226
|
-
device_paired: 1,
|
|
227
|
-
device_sn: "SN000002"
|
|
228
|
-
},
|
|
229
|
-
supplement_light_state: 0,
|
|
230
|
-
temperature: 33.1,
|
|
231
|
-
wind_speed: 0.8
|
|
232
|
-
},
|
|
233
|
-
sn: "SN00001"
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
Thing::Product::FlightHubDockOsdMessage.new(
|
|
237
|
-
OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
|
|
238
|
-
biz_code: "device_osd",
|
|
239
|
-
version: "1.0",
|
|
240
|
-
timestamp: Message.current_timestamp,
|
|
241
|
-
data: message_data,
|
|
242
|
-
_data: message_data
|
|
243
|
-
)
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
def build_thing_product_flight_hub_drone_osd_message
|
|
247
|
-
message_data = {
|
|
248
|
-
host: {
|
|
249
|
-
activation_time: 1682969151,
|
|
250
|
-
attitude_head: 164.2085418701172,
|
|
251
|
-
attitude_pitch: -2.0999999046325684,
|
|
252
|
-
attitude_roll: 0.30000001192092896,
|
|
253
|
-
battery: {
|
|
254
|
-
batteries: [
|
|
255
|
-
{
|
|
256
|
-
capacity_percent: 95,
|
|
257
|
-
firmware_version: "01.00.0600",
|
|
258
|
-
index: 0,
|
|
259
|
-
loop_times: 27,
|
|
260
|
-
sn: "BATTERY01",
|
|
261
|
-
sub_type: 67,
|
|
262
|
-
temperature: 38,
|
|
263
|
-
type: 2,
|
|
264
|
-
voltage: 24200
|
|
265
|
-
}
|
|
266
|
-
],
|
|
267
|
-
capacity_percent: 95,
|
|
268
|
-
landing_power: 20,
|
|
269
|
-
remain_flight_time: 19,
|
|
270
|
-
return_home_power: 25
|
|
271
|
-
},
|
|
272
|
-
distance_limit_status: {
|
|
273
|
-
distance_limit: 500,
|
|
274
|
-
is_near_distance_limit: 0,
|
|
275
|
-
state: 1
|
|
276
|
-
},
|
|
277
|
-
elevation: 62.20537567138672,
|
|
278
|
-
firmware_version: "01.00.0600",
|
|
279
|
-
gear: 0,
|
|
280
|
-
height: 62.20537567138672,
|
|
281
|
-
height_limit: 500,
|
|
282
|
-
home_distance: 23.390625,
|
|
283
|
-
horizontal_speed: 0.10000000149011612,
|
|
284
|
-
latitude: -33.768706649492614,
|
|
285
|
-
longitude: 150.9497880000493,
|
|
286
|
-
mode_code: 0,
|
|
287
|
-
position_state: {
|
|
288
|
-
gps_number: 6,
|
|
289
|
-
is_fixed: 3,
|
|
290
|
-
quality: 5,
|
|
291
|
-
rtk_number: 30
|
|
292
|
-
},
|
|
293
|
-
storage: {
|
|
294
|
-
total: 53082240,
|
|
295
|
-
used: 14370264
|
|
296
|
-
},
|
|
297
|
-
total_flight_distance: 1234.5,
|
|
298
|
-
total_flight_time: 146930,
|
|
299
|
-
track_id: nil,
|
|
300
|
-
vertical_speed: -0.30000001192092896,
|
|
301
|
-
wind_direction: 180,
|
|
302
|
-
wind_speed: 0.800000011920929
|
|
303
|
-
},
|
|
304
|
-
sn: "DRONE01"
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
Thing::Product::FlightHubDroneOsdMessage.new(
|
|
308
|
-
OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
|
|
309
|
-
biz_code: "device_osd",
|
|
310
|
-
version: "1.0",
|
|
311
|
-
timestamp: Message.current_timestamp,
|
|
312
|
-
data: message_data,
|
|
313
|
-
_data: message_data
|
|
314
|
-
)
|
|
315
|
-
end
|
|
316
|
-
|
|
317
17
|
# Status
|
|
318
18
|
|
|
319
19
|
def build_thing_product_update_topo_message_with_online_device
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Thing::Product
|
|
5
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock3/firmware.html#firmware-update-progress
|
|
6
|
+
class OtaProgressEventsMessage < EventsMessage
|
|
7
|
+
attribute :_method, Types::String.enum("ota_progress")
|
|
8
|
+
|
|
9
|
+
attribute :data do
|
|
10
|
+
attribute :output do
|
|
11
|
+
attribute :progress do
|
|
12
|
+
# {"max":"100","min":"0","step":"1","unit_name":"Percentage / %"}
|
|
13
|
+
attribute :percent, Types::Integer
|
|
14
|
+
|
|
15
|
+
# {"download_firmware":"Download firmware","upgrade_firmware":"Update firmware"}
|
|
16
|
+
attribute :current_step, Types::String.enum(
|
|
17
|
+
"download_firmware",
|
|
18
|
+
"upgrade_firmware"
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# {"canceled":"Cancelled or terminated","failed":"Failed","in_progress":"Executing","ok":"Executed successfully","paused":"Paused","rejected":"Rejected","sent":"Issued","timeout":"Timeout"}
|
|
23
|
+
attribute :status, Types::String.enum(
|
|
24
|
+
"canceled",
|
|
25
|
+
"failed",
|
|
26
|
+
"in_progress",
|
|
27
|
+
"ok",
|
|
28
|
+
"paused",
|
|
29
|
+
"rejected",
|
|
30
|
+
"sent",
|
|
31
|
+
"timeout"
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
attribute :result, Types::ResultCode
|
|
36
|
+
include Mixins::ResultCode
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -102,6 +102,10 @@ module DjiMqttConnect
|
|
|
102
102
|
attribute :remain_upload, Types::Integer
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
+
# {"0":"Idle","1":"On-site debugging","2":"Remote debugging","3":"Firmware update in progress","4":"Task in progress","5":"To be calibrated"}
|
|
106
|
+
attribute? :mode_code, Types::DockModeCode
|
|
107
|
+
include Mixins::DockModeCode
|
|
108
|
+
|
|
105
109
|
attribute? :network_state do
|
|
106
110
|
attribute :type, Types::NetworkStateType
|
|
107
111
|
include Mixins::NetworkStateType
|
|
@@ -188,8 +192,6 @@ module DjiMqttConnect
|
|
|
188
192
|
attribute :used, Types::Integer
|
|
189
193
|
end
|
|
190
194
|
|
|
191
|
-
attribute? :mode_code, Types::DockModeCode
|
|
192
|
-
|
|
193
195
|
attribute? :air_conditioner do
|
|
194
196
|
attribute :air_conditioner_state, Types::AirConditionerState | Types::Integer
|
|
195
197
|
include Mixins::AirConditionerState
|
|
@@ -77,6 +77,10 @@ module DjiMqttConnect
|
|
|
77
77
|
# {"0":"Standby","1":"Takeoff preparation","2":"Takeoff preparation completed","3":"Manual flight","4":"Automatic takeoff","5":"Wayline flight","6":"Panoramic photography","7":"Intelligent tracking","8":"ADS-B avoidance","9":"Auto returning to home","10":"Automatic landing","11":"Forced landing","12":"Three-blade landing","13":"Upgrading","14":"Not connected","15":"APAS","16":"Virtual stick state","17":"Live Flight Controls","18":"Airborne RTK fixing mode","19":"Dock address selecting","20":"POI"}
|
|
78
78
|
attribute :mode_code, Types::DroneModeCode
|
|
79
79
|
|
|
80
|
+
# {"0":"No meaning","1":"Insufficient battery power (return, landing)","2":"Insufficient battery voltage (return, landing)","3":"Severely low voltage (return, landing)","4":"Requested by remote controller buttons (takeoff, return, landing)","5":"Requested by App (takeoff, return, landing)","6":"Loss of remote controller signal (return, landing, hover)","7":"Triggered by external devices such as navigation, SDK, etc. (takeoff, return, landing)","8":"Entered the dock GEO Zone (landing)","9":"Although a return was triggered, it was too close to the Home point (landing)","10":"Although a return was triggered, it was too far from the Home point (landing)","11":"Requested when executing waypoint missions (takeoff)","12":"Requested after reaching above the Home point in the return phase (landing)","13":"Continued descent after the aircraft's height dropped to 0.7m from the ground (second-stage descent limit) leading to (landing)","14":"Forced breakthrough of low altitude protection by devices like App, SDK (landing)","15":"Requested due to passing flights in the vicinity (returning, landing)","16":"Requested due to height control failure (return, landing)","17":"Entered after intelligent low battery return (landing)","18":"AP controls the flight mode (manual flight)","19":"Hardware abnormally (return, landing)","20":"End of anti-collision protection (landing)","21":"Return canceled (hover)","22":"Encountered obstacles during the return (landing)","23":"Triggered by strong winds in the dock scene (return)"}
|
|
81
|
+
attribute? :mode_code_reason, Types::DroneModeCodeReason
|
|
82
|
+
include Mixins::DroneModeCodeReason
|
|
83
|
+
|
|
80
84
|
attribute :position_state do
|
|
81
85
|
attribute :gps_number, Types::Integer
|
|
82
86
|
attribute :is_fixed, Types::Integer
|
|
@@ -108,6 +112,36 @@ module DjiMqttConnect
|
|
|
108
112
|
camera_mode && Types::CameraMode.valid?(camera_mode)
|
|
109
113
|
end
|
|
110
114
|
|
|
115
|
+
attribute? :ir_metering_mode, Types::Integer
|
|
116
|
+
|
|
117
|
+
attribute? :ir_metering_area do
|
|
118
|
+
attribute :x, Types::JSON::Decimal
|
|
119
|
+
attribute :y, Types::JSON::Decimal
|
|
120
|
+
attribute :width, Types::JSON::Decimal
|
|
121
|
+
attribute :height, Types::JSON::Decimal
|
|
122
|
+
|
|
123
|
+
attribute :aver_temperature, Types::JSON::Decimal
|
|
124
|
+
attribute :max_temperature_point do
|
|
125
|
+
attribute :x, Types::JSON::Decimal
|
|
126
|
+
attribute :y, Types::JSON::Decimal
|
|
127
|
+
|
|
128
|
+
attribute :temperature, Types::JSON::Decimal
|
|
129
|
+
end
|
|
130
|
+
attribute :min_temperature_point do
|
|
131
|
+
attribute :x, Types::JSON::Decimal
|
|
132
|
+
attribute :y, Types::JSON::Decimal
|
|
133
|
+
|
|
134
|
+
attribute :temperature, Types::JSON::Decimal
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
attribute? :ir_metering_point do
|
|
139
|
+
attribute :x, Types::JSON::Decimal
|
|
140
|
+
attribute :y, Types::JSON::Decimal
|
|
141
|
+
|
|
142
|
+
attribute :temperature, Types::JSON::Decimal
|
|
143
|
+
end
|
|
144
|
+
|
|
111
145
|
# {"min":2,"max":20}
|
|
112
146
|
attribute? :ir_zoom_factor, Types::JSON::Decimal
|
|
113
147
|
|
|
@@ -132,6 +166,32 @@ module DjiMqttConnect
|
|
|
132
166
|
# {"unit":"s"}
|
|
133
167
|
attribute? :remain_record_duration, Types::Integer
|
|
134
168
|
|
|
169
|
+
attribute? :screen_split_enable, Types::Bool
|
|
170
|
+
|
|
171
|
+
attribute? :wide_calibrate_farthest_focus_value, Types::Integer
|
|
172
|
+
attribute? :wide_calibrate_nearest_focus_value, Types::Integer
|
|
173
|
+
attribute? :wide_exposure_mode, Types::Integer
|
|
174
|
+
attribute? :wide_exposure_value, Types::Integer
|
|
175
|
+
attribute? :wide_focus_mode, Types::Integer
|
|
176
|
+
attribute? :wide_focus_state, Types::Integer
|
|
177
|
+
attribute? :wide_focus_value, Types::Integer
|
|
178
|
+
attribute? :wide_iso, Types::Integer
|
|
179
|
+
attribute? :wide_max_focus_value, Types::Integer
|
|
180
|
+
attribute? :wide_min_focus_value, Types::Integer
|
|
181
|
+
attribute? :wide_shutter_speed, Types::Integer
|
|
182
|
+
|
|
183
|
+
attribute? :zoom_calibrate_farthest_focus_value, Types::Integer
|
|
184
|
+
attribute? :zoom_calibrate_nearest_focus_value, Types::Integer
|
|
185
|
+
attribute? :zoom_exposure_mode, Types::Integer
|
|
186
|
+
attribute? :zoom_exposure_value, Types::Integer
|
|
187
|
+
attribute? :zoom_focus_mode, Types::Integer
|
|
188
|
+
attribute? :zoom_focus_state, Types::Integer
|
|
189
|
+
attribute? :zoom_focus_value, Types::Integer
|
|
190
|
+
attribute? :zoom_iso, Types::Integer
|
|
191
|
+
attribute? :zoom_max_focus_value, Types::Integer
|
|
192
|
+
attribute? :zoom_min_focus_value, Types::Integer
|
|
193
|
+
attribute? :zoom_shutter_speed, Types::Integer
|
|
194
|
+
|
|
135
195
|
# {"min":2,"max":200}
|
|
136
196
|
attribute? :zoom_factor, Types::JSON::Decimal
|
|
137
197
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Thing::Product
|
|
5
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock3/firmware.html#firmware-update
|
|
6
|
+
class OtaCreateServicesMessage < ServicesMessage
|
|
7
|
+
def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
|
8
|
+
new(
|
|
9
|
+
bid: bid,
|
|
10
|
+
tid: tid,
|
|
11
|
+
timestamp: timestamp,
|
|
12
|
+
_method: "ota_create",
|
|
13
|
+
data: data
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
attribute :_method, Types::String.enum("ota_create")
|
|
18
|
+
|
|
19
|
+
attribute :data do
|
|
20
|
+
attribute :devices, Types::Array do
|
|
21
|
+
# {"2":"Consistency update","3":"Standard update", "4":"psdk update"}
|
|
22
|
+
attribute :firmware_upgrade_type, Types::Integer.enum(2, 3, 4)
|
|
23
|
+
|
|
24
|
+
attribute :product_version, Types::String
|
|
25
|
+
|
|
26
|
+
attribute :sn, Types::SerialNumber
|
|
27
|
+
|
|
28
|
+
attribute? :file_name, Types::String
|
|
29
|
+
attribute? :file_url, Types::String
|
|
30
|
+
attribute? :file_size, Types::Integer
|
|
31
|
+
|
|
32
|
+
attribute? :md5, Types::String
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DjiMqttConnect
|
|
4
|
+
module Thing::Product
|
|
5
|
+
class OtaCreateServicesReplyMessage < ServicesReplyMessage
|
|
6
|
+
attribute :_method, Types::String.enum("ota_create")
|
|
7
|
+
|
|
8
|
+
attribute :data do
|
|
9
|
+
# {"canceled":"Cancelled or terminated","failed":"Failed","in_progress":"Executing","ok":"Executed successfully","paused":"Paused","rejected":"Rejected","sent":"Issued","timeout":"Timeout"}
|
|
10
|
+
attribute :status, Types::String.enum(
|
|
11
|
+
"canceled",
|
|
12
|
+
"failed",
|
|
13
|
+
"in_progress",
|
|
14
|
+
"ok",
|
|
15
|
+
"paused",
|
|
16
|
+
"rejected",
|
|
17
|
+
"sent",
|
|
18
|
+
"timeout"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
attribute :result, Types::ResultCode
|
|
22
|
+
include Mixins::ResultCode
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -256,7 +256,16 @@ module DjiMqttConnect
|
|
|
256
256
|
attribute? :home_latitude, Types::JSON::Decimal # These values are not standard lat/long coordinates
|
|
257
257
|
attribute? :home_longitude, Types::JSON::Decimal # These values are not standard lat/long coordinates
|
|
258
258
|
attribute? :locked, Types::Bool
|
|
259
|
-
|
|
259
|
+
|
|
260
|
+
attribute? :mode_code, Types::DroneModeCode | Types::DockModeCode | Types::Integer
|
|
261
|
+
|
|
262
|
+
def mode_code?
|
|
263
|
+
Types::DroneModeCode.valid?(mode_code) || Types::DockModeCode.valid?(mode_code)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
attribute? :mode_code_reason, Types::DroneModeCodeReason | Types::Integer
|
|
267
|
+
include Mixins::DroneModeCodeReason
|
|
268
|
+
|
|
260
269
|
attribute? :offline_map_enable, Types::Bool
|
|
261
270
|
attribute? :rth_mode, Types::Integer
|
|
262
271
|
attribute? :uom_real_name_state, Types::Integer
|
|
@@ -113,6 +113,34 @@ module DjiMqttConnect
|
|
|
113
113
|
DRONE_MODE_FAILED = 65535
|
|
114
114
|
)
|
|
115
115
|
|
|
116
|
+
# {"0":"No meaning","1":"Insufficient battery power (return, landing)","2":"Insufficient battery voltage (return, landing)","3":"Severely low voltage (return, landing)","4":"Requested by remote controller buttons (takeoff, return, landing)","5":"Requested by App (takeoff, return, landing)","6":"Loss of remote controller signal (return, landing, hover)","7":"Triggered by external devices such as navigation, SDK, etc. (takeoff, return, landing)","8":"Entered the dock GEO Zone (landing)","9":"Although a return was triggered, it was too close to the Home point (landing)","10":"Although a return was triggered, it was too far from the Home point (landing)","11":"Requested when executing waypoint missions (takeoff)","12":"Requested after reaching above the Home point in the return phase (landing)","13":"Continued descent after the aircraft's height dropped to 0.7m from the ground (second-stage descent limit) leading to (landing)","14":"Forced breakthrough of low altitude protection by devices like App, SDK (landing)","15":"Requested due to passing flights in the vicinity (returning, landing)","16":"Requested due to height control failure (return, landing)","17":"Entered after intelligent low battery return (landing)","18":"AP controls the flight mode (manual flight)","19":"Hardware abnormally (return, landing)","20":"End of anti-collision protection (landing)","21":"Return canceled (hover)","22":"Encountered obstacles during the return (landing)","23":"Triggered by strong winds in the dock scene (return)"}
|
|
117
|
+
DroneModeCodeReason = Types::Integer.enum(
|
|
118
|
+
DRONE_MODE_CODE_REASON_NO_MEANING = 0,
|
|
119
|
+
DRONE_MODE_CODE_REASON_INSUFFICIENT_BATTERY_POWER = 1,
|
|
120
|
+
DRONE_MODE_CODE_REASON_INSUFFICIENT_BATTERY_VOLTAGE = 2,
|
|
121
|
+
DRONE_MODE_CODE_REASON_SEVERELY_LOW_VOLTAGE = 3,
|
|
122
|
+
DRONE_MODE_CODE_REASON_REQUESTED_BY_REMOTE_CONTROLLER_BUTTONS = 4,
|
|
123
|
+
DRONE_MODE_CODE_REASON_REQUESTED_BY_APP = 5,
|
|
124
|
+
DRONE_MODE_CODE_REASON_LOSS_OF_REMOTE_CONTROLLER_SIGNAL = 6,
|
|
125
|
+
DRONE_MODE_CODE_REASON_TRIGGERED_BY_EXTERNAL_DEVICES = 7,
|
|
126
|
+
DRONE_MODE_CODE_REASON_ENTERED_DOCK_GEO_ZONE = 8,
|
|
127
|
+
DRONE_MODE_CODE_REASON_RETURN_TOO_CLOSE_TO_HOME_POINT = 9,
|
|
128
|
+
DRONE_MODE_CODE_REASON_RETURN_TOO_FAR_FROM_HOME_POINT = 10,
|
|
129
|
+
DRONE_MODE_CODE_REASON_REQUESTED_WHEN_EXECUTING_WAYPOINT_MISSIONS = 11,
|
|
130
|
+
DRONE_MODE_CODE_REASON_REQUESTED_AFTER_REACHING_ABOVE_HOME_POINT_IN_RETURN_PHASE = 12,
|
|
131
|
+
DRONE_MODE_CODE_REASON_CONTINUED_DESCENT_AFTER_HEIGHT_DROPPED_TO_0_7M_FROM_GROUND = 13,
|
|
132
|
+
DRONE_MODE_CODE_REASON_FORCED_BREAKTHROUGH_OF_LOW_ALTITUDE_PROTECTION = 14,
|
|
133
|
+
DRONE_MODE_CODE_REASON_REQUESTED_DUE_TO_PASSING_FLIGHTS_IN_VICINITY = 15,
|
|
134
|
+
DRONE_MODE_CODE_REASON_REQUESTED_DUE_TO_HEIGHT_CONTROL_FAILURE = 16,
|
|
135
|
+
DRONE_MODE_CODE_REASON_ENTERED_AFTER_INTELLIGENT_LOW_BATTERY_RETURN = 17,
|
|
136
|
+
DRONE_MODE_CODE_REASON_AP_CONTROLS_FLIGHT_MODE = 18,
|
|
137
|
+
DRONE_MODE_CODE_REASON_HARDWARE_ABNORMALLY = 19,
|
|
138
|
+
DRONE_MODE_CODE_REASON_END_OF_ANTI_COLLISION_PROTECTION = 20,
|
|
139
|
+
DRONE_MODE_CODE_REASON_RETURN_CANCELED = 21,
|
|
140
|
+
DRONE_MODE_CODE_REASON_ENCOUNTERED_OBSTACLES_DURING_RETURN = 22,
|
|
141
|
+
DRONE_MODE_CODE_REASON_TRIGGERED_BY_STRONG_WINDS = 23
|
|
142
|
+
)
|
|
143
|
+
|
|
116
144
|
# {"0":"not charging","1":"charging"}
|
|
117
145
|
DroneChargeState = Types::Integer.enum(
|
|
118
146
|
DRONE_CHARGE_STATE_NOT_CHARGING = 0,
|
data/lib/dji_mqtt_connect.rb
CHANGED
|
@@ -18,30 +18,10 @@ module DjiMqttConnect
|
|
|
18
18
|
|
|
19
19
|
# Mixinx
|
|
20
20
|
module Mixins
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
autoload :CapacityPercent, "dji_mqtt_connect/mixins/capacity_percent"
|
|
26
|
-
autoload :DroneChargeState, "dji_mqtt_connect/mixins/drone_charge_state"
|
|
27
|
-
autoload :DroneInDock, "dji_mqtt_connect/mixins/drone_in_dock"
|
|
28
|
-
autoload :EmergencyStopState, "dji_mqtt_connect/mixins/emergency_stop_state"
|
|
29
|
-
autoload :EnvironmentTemperature, "dji_mqtt_connect/mixins/environment_temperature"
|
|
30
|
-
autoload :EventsProgressStepKey, "dji_mqtt_connect/mixins/events_progress_step_key"
|
|
31
|
-
autoload :FlighttaskProgressCurrentStep, "dji_mqtt_connect/mixins/flighttask_progress_current_step"
|
|
32
|
-
autoload :Latitude, "dji_mqtt_connect/mixins/latitude"
|
|
33
|
-
autoload :Longitude, "dji_mqtt_connect/mixins/longitude"
|
|
34
|
-
autoload :NetworkStateType, "dji_mqtt_connect/mixins/network_state_type"
|
|
35
|
-
autoload :NetworkStateQuality, "dji_mqtt_connect/mixins/network_state_quality"
|
|
36
|
-
autoload :PositionStateQuality, "dji_mqtt_connect/mixins/position_state_quality"
|
|
37
|
-
autoload :PutterState, "dji_mqtt_connect/mixins/putter_state"
|
|
38
|
-
autoload :Rainfall, "dji_mqtt_connect/mixins/rainfall"
|
|
39
|
-
autoload :ServicesOutputStatus, "dji_mqtt_connect/mixins/services_output_status"
|
|
40
|
-
autoload :SupplementLightState, "dji_mqtt_connect/mixins/supplement_light_state"
|
|
41
|
-
autoload :ResultCode, "dji_mqtt_connect/mixins/result_code"
|
|
42
|
-
autoload :Temperature, "dji_mqtt_connect/mixins/temperature"
|
|
43
|
-
autoload :VideoType, "dji_mqtt_connect/mixins/video_type"
|
|
44
|
-
autoload :VideoQuality, "dji_mqtt_connect/mixins/video_quality"
|
|
21
|
+
Dir[File.join(__dir__, "dji_mqtt_connect", "mixins", "*.rb")].each do |file|
|
|
22
|
+
basename = File.basename(file, ".rb")
|
|
23
|
+
autoload :"#{basename.camelize}", "dji_mqtt_connect/mixins/#{basename}"
|
|
24
|
+
end
|
|
45
25
|
end
|
|
46
26
|
|
|
47
27
|
# Utils
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dji_mqtt_connect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.34
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sphere Drones
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -144,7 +144,13 @@ files:
|
|
|
144
144
|
- lib/dji_mqtt_connect/factories/events/cover_close.rb
|
|
145
145
|
- lib/dji_mqtt_connect/factories/events/cover_force_close.rb
|
|
146
146
|
- lib/dji_mqtt_connect/factories/events/cover_open.rb
|
|
147
|
+
- lib/dji_mqtt_connect/factories/events/ota_progress.rb
|
|
147
148
|
- lib/dji_mqtt_connect/factories/events_messages.rb
|
|
149
|
+
- lib/dji_mqtt_connect/factories/osd/dock.rb
|
|
150
|
+
- lib/dji_mqtt_connect/factories/osd/drone.rb
|
|
151
|
+
- lib/dji_mqtt_connect/factories/osd/flight_hub_dock.rb
|
|
152
|
+
- lib/dji_mqtt_connect/factories/osd/flight_hub_drone.rb
|
|
153
|
+
- lib/dji_mqtt_connect/factories/osd_messages.rb
|
|
148
154
|
- lib/dji_mqtt_connect/factories/services/camera_aim.rb
|
|
149
155
|
- lib/dji_mqtt_connect/factories/services/camera_exposure_mode_set.rb
|
|
150
156
|
- lib/dji_mqtt_connect/factories/services/camera_exposure_set.rb
|
|
@@ -168,6 +174,7 @@ files:
|
|
|
168
174
|
- lib/dji_mqtt_connect/factories/services/ir_metering_mode_set.rb
|
|
169
175
|
- lib/dji_mqtt_connect/factories/services/ir_metering_point_set.rb
|
|
170
176
|
- lib/dji_mqtt_connect/factories/services/live_control.rb
|
|
177
|
+
- lib/dji_mqtt_connect/factories/services/ota_create.rb
|
|
171
178
|
- lib/dji_mqtt_connect/factories/services/photo_storage_set.rb
|
|
172
179
|
- lib/dji_mqtt_connect/factories/services/video_storage_set.rb
|
|
173
180
|
- lib/dji_mqtt_connect/factories/services_messages.rb
|
|
@@ -210,6 +217,7 @@ files:
|
|
|
210
217
|
- lib/dji_mqtt_connect/messages/thing/product/events/highest_priority_upload_flighttask_media.rb
|
|
211
218
|
- lib/dji_mqtt_connect/messages/thing/product/events/hms.rb
|
|
212
219
|
- lib/dji_mqtt_connect/messages/thing/product/events/offline_map_sync_progress.rb
|
|
220
|
+
- lib/dji_mqtt_connect/messages/thing/product/events/ota_progress.rb
|
|
213
221
|
- lib/dji_mqtt_connect/messages/thing/product/events/release_terminal_control_area.rb
|
|
214
222
|
- lib/dji_mqtt_connect/messages/thing/product/events/return_home_info.rb
|
|
215
223
|
- lib/dji_mqtt_connect/messages/thing/product/events/status_code.rb
|
|
@@ -291,6 +299,7 @@ files:
|
|
|
291
299
|
- lib/dji_mqtt_connect/messages/thing/product/services/live_set_quality.rb
|
|
292
300
|
- lib/dji_mqtt_connect/messages/thing/product/services/live_start_push.rb
|
|
293
301
|
- lib/dji_mqtt_connect/messages/thing/product/services/live_stop_push.rb
|
|
302
|
+
- lib/dji_mqtt_connect/messages/thing/product/services/ota_create.rb
|
|
294
303
|
- lib/dji_mqtt_connect/messages/thing/product/services/payload_authority_grab.rb
|
|
295
304
|
- lib/dji_mqtt_connect/messages/thing/product/services/photo_storage_set.rb
|
|
296
305
|
- lib/dji_mqtt_connect/messages/thing/product/services/return_home.rb
|
|
@@ -344,6 +353,7 @@ files:
|
|
|
344
353
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply/live_set_quality.rb
|
|
345
354
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply/live_start_push.rb
|
|
346
355
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply/live_stop_push.rb
|
|
356
|
+
- lib/dji_mqtt_connect/messages/thing/product/services_reply/ota_create.rb
|
|
347
357
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply/payload_authority_grab.rb
|
|
348
358
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply/photo_storage_set.rb
|
|
349
359
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home.rb
|
|
@@ -359,8 +369,10 @@ files:
|
|
|
359
369
|
- lib/dji_mqtt_connect/mixins/camera_index.rb
|
|
360
370
|
- lib/dji_mqtt_connect/mixins/capacity_percent.rb
|
|
361
371
|
- lib/dji_mqtt_connect/mixins/cover_state.rb
|
|
372
|
+
- lib/dji_mqtt_connect/mixins/dock_mode_code.rb
|
|
362
373
|
- lib/dji_mqtt_connect/mixins/drone_charge_state.rb
|
|
363
374
|
- lib/dji_mqtt_connect/mixins/drone_in_dock.rb
|
|
375
|
+
- lib/dji_mqtt_connect/mixins/drone_mode_code_reason.rb
|
|
364
376
|
- lib/dji_mqtt_connect/mixins/emergency_stop_state.rb
|
|
365
377
|
- lib/dji_mqtt_connect/mixins/environment_temperature.rb
|
|
366
378
|
- lib/dji_mqtt_connect/mixins/events_progress_step_key.rb
|