dji_mqtt_connect 0.1.28 → 0.1.29.1

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dji_mqtt_connect/messages/sys/product/status_reply_message.rb +1 -2
  3. data/lib/dji_mqtt_connect/messages/thing/product/events/airsense_warning.rb +2 -0
  4. data/lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb +3 -5
  5. data/lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb +3 -6
  6. data/lib/dji_mqtt_connect/messages/thing/product/events/device_reboot.rb +3 -6
  7. data/lib/dji_mqtt_connect/messages/thing/product/events/drone_close.rb +3 -6
  8. data/lib/dji_mqtt_connect/messages/thing/product/events/drone_open.rb +2 -4
  9. data/lib/dji_mqtt_connect/messages/thing/product/events/file_upload_callback.rb +4 -5
  10. data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_progress.rb +2 -6
  11. data/lib/dji_mqtt_connect/messages/thing/product/events/return_home_info.rb +4 -0
  12. data/lib/dji_mqtt_connect/messages/thing/product/events/takeoff_to_point_progress.rb +1 -2
  13. data/lib/dji_mqtt_connect/messages/thing/product/events/uom_fly_data_info.rb +4 -2
  14. data/lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb +1 -2
  15. data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +32 -141
  16. data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +7 -5
  17. data/lib/dji_mqtt_connect/messages/thing/product/osd/flight_hub_dock.rb +41 -39
  18. data/lib/dji_mqtt_connect/messages/thing/product/osd/remote.rb +3 -3
  19. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_bind_status.rb +1 -2
  20. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_bind.rb +1 -2
  21. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_get.rb +1 -2
  22. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flight_areas_get.rb +1 -2
  23. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flighttask_resource_get.rb +1 -2
  24. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get.rb +1 -2
  25. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get_v2.rb +1 -2
  26. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/storage_config_get.rb +1 -2
  27. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_execute.rb +3 -0
  28. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_prepare.rb +3 -0
  29. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/alarm_state_switch.rb +2 -4
  30. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/cover_close.rb +2 -4
  31. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/cover_open.rb +2 -4
  32. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_close.rb +2 -4
  33. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_open.rb +2 -4
  34. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/drone_close.rb +2 -4
  35. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/drone_open.rb +2 -4
  36. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_progress_get.rb +2 -6
  37. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home.rb +2 -4
  38. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_specific_home.rb +2 -4
  39. data/lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb +1 -2
  40. data/lib/dji_mqtt_connect/messages/thing/product/state_message.rb +1 -2
  41. data/lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb +1 -2
  42. data/lib/dji_mqtt_connect/mixins/air_conditioner_state.rb +11 -0
  43. data/lib/dji_mqtt_connect/mixins/alarm_state.rb +20 -0
  44. data/lib/dji_mqtt_connect/mixins/{humanized_camera_index.rb → camera_index.rb} +6 -2
  45. data/lib/dji_mqtt_connect/mixins/cover_state.rb +24 -0
  46. data/lib/dji_mqtt_connect/mixins/drone_in_dock.rb +11 -0
  47. data/lib/dji_mqtt_connect/mixins/emergency_stop_state.rb +20 -0
  48. data/lib/dji_mqtt_connect/mixins/environment_temperature.rb +11 -0
  49. data/lib/dji_mqtt_connect/mixins/{events_progress_checks.rb → events_progress_step_key.rb} +1 -1
  50. data/lib/dji_mqtt_connect/mixins/flighttask_progress_current_step.rb +11 -0
  51. data/lib/dji_mqtt_connect/mixins/{latitude_conditional.rb → latitude.rb} +1 -1
  52. data/lib/dji_mqtt_connect/mixins/{longitude_conditional.rb → longitude.rb} +1 -1
  53. data/lib/dji_mqtt_connect/mixins/putter_state.rb +24 -0
  54. data/lib/dji_mqtt_connect/mixins/rainfall.rb +24 -0
  55. data/lib/dji_mqtt_connect/mixins/{result_message.rb → result_code.rb} +1 -1
  56. data/lib/dji_mqtt_connect/mixins/{services_output_status_checks.rb → services_output_status.rb} +1 -1
  57. data/lib/dji_mqtt_connect/mixins/supplement_light_state.rb +20 -0
  58. data/lib/dji_mqtt_connect/mixins/{temperature_conditional.rb → temperature.rb} +1 -1
  59. data/lib/dji_mqtt_connect/types.rb +46 -0
  60. data/lib/dji_mqtt_connect/version.rb +1 -1
  61. data/lib/dji_mqtt_connect.rb +17 -7
  62. metadata +19 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a3cb4405a25a3c1b68d7e59f9ca08d8b89ba847807614c8b37127cbf59e31f1
4
- data.tar.gz: bb6b789291fd1563dc244e80b9a9a3f0eb58f508d1072a841e7796fb46bd9aa6
3
+ metadata.gz: ad6c951a41f2f540dfbd4ec551ed9b74f0f84675c07496b6119387232e39d2c0
4
+ data.tar.gz: 18044b1fe94f1276c6d920794a0f1261bd446455ed261f0704236dbc0e925162
5
5
  SHA512:
6
- metadata.gz: 90cf0d255e1f891ceb3a2a2034fa9e665bf88d9e53ff39a48635b0f5a49197a1b90144bb9bb7fd30e4b3c51f2f0fd2fe10b700f21336b93704678399eb28c841
7
- data.tar.gz: b42b2addd144c918e861c1e704e57c385279e0efae12d7dbbb73eb0203c40d9592723928b115051961a51f3a03f63ae8489aa915c204cdb2d9ab2c544a1cf9db
6
+ metadata.gz: 0df22624ae36218051c85386369975633f07c42d1020f5682807f3cbe28ec57a1b731ac03710ff07db33f81ce9de71d1a7a4517d3e252dcd2fe7fe881c4daa3a
7
+ data.tar.gz: d5ca85ce8795e967c8274438ddb7f845ce8bacbc1bc65be863c1fa626544b3c60ce763f2fa1d9c06cfd47924195cd921e5ac914aed64e35fff6fb37abac905b0
@@ -13,9 +13,8 @@ module DjiMqttConnect
13
13
  attribute :_method, Types::String
14
14
 
15
15
  attribute :data do
16
- include Mixins::ResultMessage
17
-
18
16
  attribute :result, Types::ResultCode
17
+ include Mixins::ResultCode
19
18
  end
20
19
  end
21
20
  end
@@ -13,8 +13,10 @@ module DjiMqttConnect
13
13
  attribute :warning_level, Types::Integer.enum(0, 1, 2, 3, 4)
14
14
 
15
15
  attribute :latitude, Types::Latitude
16
+ include Mixins::Latitude
16
17
 
17
18
  attribute :longitude, Types::Longitude
19
+ include Mixins::Longitude
18
20
 
19
21
  attribute :altitude, Types::Integer
20
22
 
@@ -6,15 +6,13 @@ module DjiMqttConnect
6
6
  attribute :_method, Types::String.enum("cover_close")
7
7
 
8
8
  attribute :data do
9
- include Mixins::ResultMessage
10
-
11
9
  attribute :result, Types::ResultCode
10
+ include Mixins::ResultCode
12
11
 
13
12
  attribute :output do
14
- include Mixins::ServicesOutputStatusChecks
15
-
16
13
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
17
14
  attribute :status, Types::ServicesOutputStatus
15
+ include Mixins::ServicesOutputStatus
18
16
 
19
17
  attribute :progress do
20
18
  # {"min":"0","max":"100","step":"1"}
@@ -26,7 +24,7 @@ module DjiMqttConnect
26
24
 
27
25
  # {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
28
26
  attribute? :step_key, Types::EventsProgressStepKey
29
- include Mixins::EventsProgressChecks
27
+ include Mixins::EventsProgressStepKey
30
28
 
31
29
  attribute? :step_result, Types::Integer
32
30
  end
@@ -6,19 +6,15 @@ module DjiMqttConnect
6
6
  attribute :_method, Types::String.enum("cover_open")
7
7
 
8
8
  attribute :data do
9
- include Mixins::ResultMessage
10
-
11
9
  attribute :result, Types::ResultCode
10
+ include Mixins::ResultCode
12
11
 
13
12
  attribute :output do
14
- include Mixins::ServicesOutputStatusChecks
15
-
16
13
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
17
14
  attribute :status, Types::ServicesOutputStatus
15
+ include Mixins::ServicesOutputStatus
18
16
 
19
17
  attribute :progress do
20
- include Mixins::EventsProgressChecks
21
-
22
18
  # {"min":"0","max":"100","step":"1"}
23
19
  attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
24
20
 
@@ -28,6 +24,7 @@ module DjiMqttConnect
28
24
 
29
25
  # {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
30
26
  attribute? :step_key, Types::EventsProgressStepKey
27
+ include Mixins::EventsProgressStepKey
31
28
 
32
29
  attribute? :step_result, Types::Integer
33
30
  end
@@ -6,19 +6,15 @@ module DjiMqttConnect
6
6
  attribute :_method, Types::String.enum("device_reboot")
7
7
 
8
8
  attribute :data do
9
- include Mixins::ResultMessage
10
-
11
9
  attribute :result, Types::ResultCode
10
+ include Mixins::ResultCode
12
11
 
13
12
  attribute :output do
14
- include Mixins::ServicesOutputStatusChecks
15
-
16
13
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
17
14
  attribute :status, Types::ServicesOutputStatus
15
+ include Mixins::ServicesOutputStatus
18
16
 
19
17
  attribute :progress do
20
- include Mixins::EventsProgressChecks
21
-
22
18
  # {"min":"0","max":"100","step":"1"}
23
19
  attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
24
20
 
@@ -28,6 +24,7 @@ module DjiMqttConnect
28
24
 
29
25
  # {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
30
26
  attribute? :step_key, Types::EventsProgressStepKey
27
+ include Mixins::EventsProgressStepKey
31
28
 
32
29
  attribute? :step_result, Types::Integer
33
30
  end
@@ -7,24 +7,21 @@ module DjiMqttConnect
7
7
  attribute :_method, Types::String.enum("drone_close")
8
8
 
9
9
  attribute :data do
10
- include Mixins::ResultMessage
11
-
12
10
  attribute :result, Types::ResultCode
11
+ include Mixins::ResultCode
13
12
 
14
13
  attribute :output do
15
- include Mixins::ServicesOutputStatusChecks
16
-
17
14
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
18
15
  attribute :status, Types::ServicesOutputStatus
16
+ include Mixins::ServicesOutputStatus
19
17
 
20
18
  attribute :progress do
21
- include Mixins::EventsProgressChecks
22
-
23
19
  # {"min":"0","max":"100","step":"1"}
24
20
  attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
25
21
 
26
22
  # {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
27
23
  attribute? :step_key, Types::EventsProgressStepKey
24
+ include Mixins::EventsProgressStepKey
28
25
  end
29
26
  end
30
27
  end
@@ -7,15 +7,13 @@ module DjiMqttConnect
7
7
  attribute :_method, Types::String.enum("drone_open")
8
8
 
9
9
  attribute :data do
10
- include Mixins::ResultMessage
11
-
12
10
  attribute :result, Types::ResultCode
11
+ include Mixins::ResultCode
13
12
 
14
13
  attribute :output do
15
- include Mixins::ServicesOutputStatusChecks
16
-
17
14
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
18
15
  attribute :status, Types::ServicesOutputStatus
16
+ include Mixins::ServicesOutputStatus
19
17
  end
20
18
  end
21
19
 
@@ -6,9 +6,8 @@ module DjiMqttConnect
6
6
  attribute :_method, Types::String.enum("file_upload_callback")
7
7
 
8
8
  attribute :data do
9
- include Mixins::ResultMessage
10
-
11
9
  attribute :result, Types::ResultCode
10
+ include Mixins::ResultCode
12
11
 
13
12
  attribute :file do
14
13
  attribute :object_key, Types::String
@@ -38,14 +37,14 @@ module DjiMqttConnect
38
37
  attribute :created_time, Types::JSON::DateTime | Types::Nil
39
38
 
40
39
  attribute :shoot_position do
41
- include Mixins::LatitudeConditional
42
- include Mixins::LongitudeConditional
43
-
44
40
  attribute :lat, Types::Latitude
45
41
  attribute :lng, Types::Longitude
46
42
 
47
43
  alias_method :latitude, :lat
44
+ include Mixins::Latitude
45
+
48
46
  alias_method :longitude, :lng
47
+ include Mixins::Longitude
49
48
  end
50
49
  end
51
50
  end
@@ -9,9 +9,8 @@ module DjiMqttConnect
9
9
  attribute :_method, Types::String.enum("flighttask_progress")
10
10
 
11
11
  attribute :data do
12
- include Mixins::ResultMessage
13
-
14
12
  attribute :result, Types::ResultCode
13
+ include Mixins::ResultCode
15
14
 
16
15
  attribute :output do
17
16
  attribute :ext do
@@ -81,10 +80,7 @@ module DjiMqttConnect
81
80
  attribute :progress do
82
81
  # {"0":"Initial state","1":"Pre-flight check, whether the aircraft is executing a wayline","2":"Pre-flight check, whether the dock has exited working mode","3":"Pre-flight check, wayline execution in progress","4":"Pre-return-to-home check, in the process of returning to home","5":"Wayline execution enters the preparation state, waiting for the mission to be issued","6":"Dock enters working state","7":"Enter the startup check and cover preparation work","8":"Remote image transmission frequency Pairing","9":"Waiting for the flight system to be ready, push connection established","10":"Waiting for RTK source to listen for reported values","11":"Check if the RTK source is from the dock, if not, reset it","12":"Waiting for flight control notification","13":"The dock has no control and seizes the control of the aircraft","14":"Consistency check of custom flight area","15":"Consistency check of offline maps","16":"Get the latest KMZ URL","17":"Download KMZ","18":"KMZ uploading","19":"Coloring configuration","20":"Aircraft takeoff parameter setting, alternate landing point setting, takeoff altitude setting, coloring setting","21":"Aircraft flyto takeoff parameter setting","22":"Takeoff dock checks the landing dock preparation status","23":"Home point setting","24":"Trigger wayline execution","25":"Wayline executing","26":"Enter pre-return-to-home check","27":"Aircraft landing at the dock","28":"Close the cover after landing","29":"Dock exits working mode","30":"Dock abnormal recovery","31":"Dock uploads flight system logs","32":"Check camera recording state","33":"Get the number of media files","34":"Abnormal recovery after dock takeoff cover","35":"Notify mission result","36":"Log list retrieval - Aircraft list","37":"Log list retrieval - Retrieve the list of docks","38":"Log list retrieval - Upload log list result","39":"Log retrieval - Retrieve aircraft logs","40":"Log retrieval - Retrieve dock logs","41":"Log retrieval - Compress aircraft logs","42":"Log retrieval - Compress dock logs","43":"Log retrieval - Upload aircraft logs","44":"Log retrieval - Upload dock logs","45":"Log retrieval - Notify the result","46":"Custom flight area file update preparation","47":"Custom flight area updating","48":"Offline map update preparation","49":"Offline map updating","65533":"Wait for service response after completion","65534":"No specific state","65535":"UNKNOWN"}
83
82
  attribute :current_step, Types::Integer
84
-
85
- def humanized_current_step
86
- I18n.t(current_step, scope: "dji_mqtt_connect.flighttask_progress.current_step", default: current_step.to_s)
87
- end
83
+ include Mixins::FlighttaskProgressCurrentStep
88
84
 
89
85
  # {"min":"0","max":"100","step":"1"}
90
86
  attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
@@ -27,7 +27,11 @@ module DjiMqttConnect
27
27
 
28
28
  attribute :planned_path_points, Types::Array.default([].freeze) do
29
29
  attribute :latitude, Types::Latitude
30
+ include Mixins::Latitude
31
+
30
32
  attribute :longitude, Types::Longitude
33
+ include Mixins::Longitude
34
+
31
35
  attribute :height, Types::JSON::Decimal
32
36
  end
33
37
 
@@ -6,9 +6,8 @@ module DjiMqttConnect
6
6
  attribute :_method, Types::String.enum("takeoff_to_point_progress")
7
7
 
8
8
  attribute :data do
9
- include Mixins::ResultMessage
10
-
11
9
  attribute :result, Types::ResultCode
10
+ include Mixins::ResultCode
12
11
 
13
12
  attribute :flight_id, Types::FlightID
14
13
 
@@ -7,12 +7,12 @@ module DjiMqttConnect
7
7
 
8
8
  attribute :data do
9
9
  attribute :result, Types::ResultCode
10
- include Mixins::ResultMessage
10
+ include Mixins::ResultCode
11
11
 
12
12
  attribute? :output do
13
13
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
14
14
  attribute? :status, Types::ServicesOutputStatus
15
- include Mixins::ServicesOutputStatusChecks
15
+ include Mixins::ServicesOutputStatus
16
16
 
17
17
  attribute? :progress do
18
18
  attribute? :current_step, Types::Integer
@@ -43,8 +43,10 @@ module DjiMqttConnect
43
43
 
44
44
  attribute? :is_simulator_open, Types::Bool
45
45
 
46
+ # NOTE: Not a real latitude type, just a decimal
46
47
  attribute? :latitude, Types::JSON::Decimal
47
48
 
49
+ # NOTE: Not a real longitude type, just a decimal
48
50
  attribute? :longitude, Types::JSON::Decimal
49
51
 
50
52
  attribute? :manufacture_id, Types::String
@@ -27,9 +27,8 @@ module DjiMqttConnect
27
27
  attribute :_method, Types::String
28
28
 
29
29
  attribute :data do
30
- include Mixins::ResultMessage
31
-
32
30
  attribute :result, Types::ResultCode
31
+ include Mixins::ResultCode
33
32
  end
34
33
 
35
34
  def humanized_summary
@@ -10,19 +10,16 @@ module DjiMqttConnect
10
10
  ]
11
11
 
12
12
  attribute :data do
13
- include Mixins::LatitudeConditional
14
- include Mixins::LongitudeConditional
15
- include Mixins::TemperatureConditional
16
-
17
13
  attribute? :acc_time, Types::Integer
18
14
  attribute? :activation_time, Types::Integer
19
15
 
20
16
  attribute? :backup_battery do
21
- include Mixins::TemperatureConditional
22
-
23
17
  attribute :switch, Types::Integer.enum(0, 1)
18
+
24
19
  attribute :voltage, Types::Integer
20
+
25
21
  attribute :temperature, Types::Temperature
22
+ include Mixins::Temperature
26
23
  end
27
24
 
28
25
  # {"0":"Disconnected","1":"Connecting","2":"Connected"}
@@ -30,15 +27,15 @@ module DjiMqttConnect
30
27
 
31
28
  attribute? :drone_battery_maintenance_info do
32
29
  attribute :batteries, Types::Array do
33
- include Mixins::TemperatureConditional
34
-
35
30
  attribute :index, Types::Integer
36
31
 
37
32
  attribute :capacity_percent, Types::Integer
38
33
  include Mixins::CapacityPercent
39
34
 
40
35
  attribute :voltage, Types::Integer
36
+
41
37
  attribute :temperature, Types::Temperature
38
+ include Mixins::Temperature
42
39
  end
43
40
 
44
41
  # {"0":"Battery is not in heating or insulation","1":"Battery is in heating","2":"Battery is in insulation"}
@@ -59,7 +56,8 @@ module DjiMqttConnect
59
56
  include Mixins::CapacityPercent
60
57
  end
61
58
 
62
- attribute? :drone_in_dock, Types::Integer.enum(0, 1)
59
+ attribute? :drone_in_dock, Types::DroneInDock
60
+ include Mixins::DroneInDock
63
61
 
64
62
  attribute? :electric_supply_voltage, Types::Integer
65
63
 
@@ -70,7 +68,10 @@ module DjiMqttConnect
70
68
  attribute? :job_number, Types::Integer
71
69
 
72
70
  attribute? :latitude, Types::Latitude
71
+ include Mixins::Latitude
72
+
73
73
  attribute? :longitude, Types::Longitude
74
+ include Mixins::Longitude
74
75
 
75
76
  attribute? :maintain_status do
76
77
  attribute :maintain_status_array, Types::Array do
@@ -127,37 +128,24 @@ module DjiMqttConnect
127
128
  attribute? :humidity, Types::Integer
128
129
 
129
130
  attribute? :temperature, Types::Temperature
131
+ include Mixins::Temperature
132
+
130
133
  attribute? :wind_speed, Types::JSON::Decimal
134
+
131
135
  attribute? :environment_temperature, Types::Temperature
136
+ include Mixins::EnvironmentTemperature
132
137
 
133
138
  # {"0":"No rain","1":"Light rain","2":"Moderate rain","3":"Heavy rain"}
134
- attribute? :rainfall, Types::Integer.enum(
135
- RAINFALL_NONE = 0,
136
- RAINFALL_LIGHT = 1,
137
- RAINFALL_MODERATE = 2,
138
- RAINFALL_HEAVY = 3
139
- )
140
-
141
- def humanized_rainfall
142
- return unless rainfall
143
-
144
- rainfall_key = case rainfall
145
- when RAINFALL_NONE
146
- "None"
147
- when RAINFALL_LIGHT
148
- "Light"
149
- when RAINFALL_MODERATE
150
- "Moderate"
151
- when RAINFALL_HEAVY
152
- "Heavy"
153
- end
154
-
155
- I18n.t(rainfall_key.downcase, scope: "dji_mqtt_connect.rainfall", default: rainfall_key)
156
- end
139
+ attribute? :rainfall, Types::Rainfall
140
+ include Mixins::Rainfall
157
141
 
158
142
  attribute? :alternate_land_point do
159
143
  attribute :latitude, Types::Latitude
144
+ include Mixins::Latitude
145
+
160
146
  attribute :longitude, Types::Longitude
147
+ include Mixins::Longitude
148
+
161
149
  attribute :height, Types::JSON::Decimal
162
150
  attribute :safe_land_height, Types::JSON::Decimal
163
151
  attribute :is_configured, Types::Integer.enum(0, 1)
@@ -188,122 +176,33 @@ module DjiMqttConnect
188
176
 
189
177
  attribute? :air_conditioner do
190
178
  attribute :air_conditioner_state, Types::AirConditionerState | Types::Integer
191
- attribute :switch_time, Types::Integer
179
+ include Mixins::AirConditionerState
192
180
 
193
- def air_conditioner_state?
194
- Types::AirConditionerState.valid?(air_conditioner_state)
195
- end
181
+ attribute :switch_time, Types::Integer
196
182
  end
197
183
 
198
184
  # {"0":"Closed","1":"Opened"}
199
- attribute? :alarm_state, Types::Integer.enum(
200
- ALARM_STATE_CLOSED = 0,
201
- ALARM_STATE_OPEN = 1
202
- )
203
-
204
- def humanized_alarm_state
205
- return unless alarm_state
206
-
207
- state_key = case alarm_state
208
- when ALARM_STATE_CLOSED
209
- "Closed"
210
- when ALARM_STATE_OPEN
211
- "Open"
212
- end
213
-
214
- I18n.t(state_key.downcase, scope: "dji_mqtt_connect.dock_alarm_state", default: state_key)
215
- end
185
+ attribute? :alarm_state, Types::AlarmState
186
+ include Mixins::AlarmState
216
187
 
217
188
  # {"1":"Planned storage strategy of battery","2":"Emergency storage strategy of battery"}
218
189
  attribute? :battery_store_mode, Types::Integer.enum(1, 2)
219
190
 
220
191
  # {"0":"Closed","1":"Opened","2":"Half-open","3":"Cover state is abnormal"}
221
- attribute? :cover_state, Types::Integer.enum(
222
- COVER_STATE_CLOSED = 0,
223
- COVER_STATE_OPEN = 1,
224
- COVER_STATE_HALF_OPEN = 2,
225
- COVER_STATE_ABNORMAL = 3
226
- )
227
-
228
- def humanized_cover_state
229
- return unless cover_state
230
-
231
- state_key = case cover_state
232
- when COVER_STATE_CLOSED
233
- "Closed"
234
- when COVER_STATE_OPEN
235
- "Open"
236
- when COVER_STATE_HALF_OPEN
237
- "Half-open"
238
- when COVER_STATE_ABNORMAL
239
- "Abnormal"
240
- end
241
-
242
- I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_cover_state", default: state_key)
243
- end
192
+ attribute? :cover_state, Types::CoverState
193
+ include Mixins::CoverState
244
194
 
245
195
  # {"0":"Closed","1":"Opened"}
246
- attribute? :emergency_stop_state, Types::Integer.enum(
247
- EMERGENCY_STOP_STATE_CLOSED = 0,
248
- EMERGENCY_STOP_STATE_OPEN = 1
249
- )
250
-
251
- def humanized_emergency_stop_state
252
- return unless emergency_stop_state
253
-
254
- state_key = case emergency_stop_state
255
- when EMERGENCY_STOP_STATE_CLOSED
256
- "Closed"
257
- when EMERGENCY_STOP_STATE_OPEN
258
- "Open"
259
- end
260
-
261
- I18n.t(state_key.downcase, scope: "dji_mqtt_connect.dock_emergency_stop_state", default: state_key)
262
- end
196
+ attribute? :emergency_stop_state, Types::EmergencyStopState
197
+ include Mixins::EmergencyStopState
263
198
 
264
199
  # {"0":"Closed","1":"Opened","2":"Half-open","3":"Putter state is abnormal"}
265
- attribute? :putter_state, Types::Integer.enum(
266
- PUTTER_STATE_CLOSED = 0,
267
- PUTTER_STATE_OPEN = 1,
268
- PUTTER_STATE_HALF_OPEN = 2,
269
- PUTTER_STATE_ABNORMAL = 3
270
- )
271
-
272
- def humanized_putter_state
273
- return unless putter_state
274
-
275
- state_key = case putter_state
276
- when PUTTER_STATE_CLOSED
277
- "Closed"
278
- when PUTTER_STATE_OPEN
279
- "Open"
280
- when PUTTER_STATE_HALF_OPEN
281
- "Half-open"
282
- when PUTTER_STATE_ABNORMAL
283
- "Abnormal"
284
- end
285
-
286
- I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_putter_state", default: state_key)
287
- end
200
+ attribute? :putter_state, Types::PutterState
201
+ include Mixins::PutterState
288
202
 
289
203
  # {"0":"Closed","1":"Opened"}
290
- attribute? :supplement_light_state, Types::Integer.enum(
291
- SUPPLEMENT_LIGHT_STATE_CLOSED = 0,
292
- SUPPLEMENT_LIGHT_STATE_OPEN = 1
293
- )
294
-
295
- def humanized_supplement_light_state
296
- return unless supplement_light_state
297
-
298
- state_key = case supplement_light_state
299
- when SUPPLEMENT_LIGHT_STATE_CLOSED
300
- "Closed"
301
- when SUPPLEMENT_LIGHT_STATE_OPEN
302
- "Open"
303
- end
304
-
305
- I18n.t(state_key.downcase, scope: "dji_mqtt_connect.dock_supplement_light_state", default: state_key)
306
- end
204
+ attribute? :supplement_light_state, Types::SupplementLightState
205
+ include Mixins::SupplementLightState
307
206
 
308
207
  attribute? :sub_device do
309
208
  attribute? :device_sn, Types::SerialNumber
@@ -315,14 +214,6 @@ module DjiMqttConnect
315
214
  # {"0":"Not paired","1":"Paired"}
316
215
  attribute :device_paired, Types::Integer.enum(0, 1)
317
216
  end
318
-
319
- def drone_in_dock?
320
- drone_in_dock == 1
321
- end
322
-
323
- def environment_temperature?
324
- environment_temperature && !Types::InvalidTemperature.valid?(environment_temperature)
325
- end
326
217
  end
327
218
 
328
219
  def humanized_summary
@@ -21,16 +21,11 @@ module DjiMqttConnect
21
21
  ]
22
22
 
23
23
  attribute :data do
24
- include Mixins::LatitudeConditional
25
- include Mixins::LongitudeConditional
26
-
27
24
  attribute :attitude_head, Types::JSON::Decimal
28
25
  attribute :attitude_pitch, Types::JSON::Decimal
29
26
  attribute :attitude_roll, Types::JSON::Decimal
30
27
  attribute :battery do
31
28
  attribute :batteries, Types::Array do
32
- include Mixins::TemperatureConditional
33
-
34
29
  attribute :capacity_percent, Types::Integer
35
30
  include Mixins::CapacityPercent
36
31
 
@@ -40,7 +35,10 @@ module DjiMqttConnect
40
35
  attribute :loop_times, Types::Integer
41
36
  attribute :sn, Types::SerialNumber | Types::Nil
42
37
  attribute :sub_type, Types::DeviceSubType
38
+
43
39
  attribute :temperature, Types::Temperature
40
+ include Mixins::Temperature
41
+
44
42
  attribute :type, Types::DeviceType
45
43
  attribute :voltage, Types::Integer
46
44
  end
@@ -69,8 +67,12 @@ module DjiMqttConnect
69
67
  attribute? :height_limit, Types::JSON::Decimal
70
68
  attribute :home_distance, Types::JSON::Decimal
71
69
  attribute :horizontal_speed, Types::JSON::Decimal
70
+
72
71
  attribute :latitude, Types::Latitude
72
+ include Mixins::Latitude
73
+
73
74
  attribute :longitude, Types::Longitude
75
+ include Mixins::Longitude
74
76
 
75
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"}
76
78
  attribute :mode_code, Types::DroneModeCode