dji_mqtt_connect 0.1.15.1 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47088befabe8de8f2476d0cae32c0a7d6514bb4bb535a4fa9f9ca77d8487b012
4
- data.tar.gz: 794eaa0083251281365af9ac3eabdaa1d519c97ca306387384af51b8461211d9
3
+ metadata.gz: dc9663b6e47df7b5cb49186748af7973143782dcd7dfcb8c8fd64f4023857d78
4
+ data.tar.gz: e1e0849ffbbf5ed675792d80e453b1f36d1ff10e50e5f0f94381ecec04ca1e0f
5
5
  SHA512:
6
- metadata.gz: 54ecb1cfb6c7e1155a52c8cd1543c7b251e9ed573c34a9dcb6b563b15bc0374d685812735e867811ccbc7ab5f81004973ab2917d6f63e6954d10295720a9f9ce
7
- data.tar.gz: 8ebd5fd2616808530e7c7ea23cfbf52ef705314462baf408c886fd91c93afb17f051ae413492db65279ddd934988f90384bdb171aa3a1d4ac17217a257557bdc
6
+ metadata.gz: f88bcf6906c9d340447825dff46b410a6f6548448ea53c78183f20d24d7ee7626f9ef81994c353de6c7aff3b5c3a47790eb029bccd6ea47a02443089a1285a3b
7
+ data.tar.gz: d360b73a17536d58d2df09e8a2d9de7e13328f81e9acb65d33df69efbbbc8df6a4bfd52f973c336f25a35e1def4b9b468ca7941bcb98d0794b5b84bc5da28381
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dji_mqtt_connect (0.1.15.1)
4
+ dji_mqtt_connect (0.1.16)
5
5
  activesupport (>= 6.0, <= 8)
6
6
  dry-struct (~> 1.6)
7
7
  dry-transformer (~> 1.0)
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  :en:
3
3
  :dji_mqtt_connect:
4
- :cover_step_key:
4
+ :events_step_key:
5
5
  check_drone_sdr_connect_state: "Check Drone SDR Connect State"
6
6
  check_scram_state: "Check SCRAM State"
7
7
  core_mcu_reboot: "Core MCU Reboot"
@@ -24,6 +24,28 @@ module DjiMqttConnect
24
24
  )
25
25
  end
26
26
 
27
+ def build_thing_product_device_reboot_events_message
28
+ message_data = {
29
+ result: 0,
30
+ output: {
31
+ status: "ok",
32
+ progress: {
33
+ percent: 100
34
+ }
35
+ }
36
+ }
37
+
38
+ Thing::Product::DeviceRebootEventsMessage.new(
39
+ bid: Message.generate_bid,
40
+ tid: Message.generate_tid,
41
+ timestamp: Message.current_timestamp,
42
+ _method: "device_reboot",
43
+ need_reply: 1,
44
+ data: message_data,
45
+ _data: message_data
46
+ )
47
+ end
48
+
27
49
  def build_file_upload_callback_events_message
28
50
  message_data = {
29
51
  file: {
@@ -30,6 +30,7 @@ module DjiMqttConnect
30
30
  nest "args", ["component_index", "sensor_index"]
31
31
 
32
32
  map_value "id", ->(id) { "0x#{id}" }
33
+ map_value "level", ->(level) { [level - 1, 0].max }
33
34
  rename_keys "id" => "code"
34
35
 
35
36
  deep_merge({"module" => 3}) # hardcoded to hms module
@@ -15,6 +15,8 @@ module DjiMqttConnect
15
15
  attribute :status, Types::ServicesOutputStatus
16
16
 
17
17
  attribute :progress do
18
+ include Mixins::EventsProgressChecks
19
+
18
20
  # {"min":"0","max":"100","step":"1"}
19
21
  attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
20
22
 
@@ -23,37 +25,7 @@ module DjiMqttConnect
23
25
  attribute? :total_steps, Types::Integer
24
26
 
25
27
  # {"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"}
26
- attribute? :step_key, Types::String.enum(
27
- "get_bid",
28
- "check_work_mode",
29
- "check_task_state",
30
- "land_mcu_reboot",
31
- "rain_mcu_reboot",
32
- "core_mcu_reboot",
33
- "sdr_reboot",
34
- "write_reboot_param_file",
35
- "get_drone_power_state",
36
- "close_putter",
37
- "check_wired_connect_state",
38
- "open_drone",
39
- "open_alarm",
40
- "check_scram_state",
41
- "open_cover",
42
- "check_drone_sdr_connect_state",
43
- "turn_on_drone",
44
- "drone_paddle_forward",
45
- "close_cover",
46
- "drone_paddle_reverse",
47
- "drone_paddle_stop",
48
- "free_putter",
49
- "stop_charge"
50
- )
51
-
52
- def humanized_step_key
53
- return unless step_key
54
-
55
- I18n.t(step_key, scope: "dji_mqtt_connect.cover_step_key", default: step_key.titleize)
56
- end
28
+ attribute? :step_key, Types::EventsProgressStepKey
57
29
 
58
30
  attribute? :step_result, Types::Integer
59
31
  end
@@ -15,6 +15,8 @@ module DjiMqttConnect
15
15
  attribute :status, Types::ServicesOutputStatus
16
16
 
17
17
  attribute :progress do
18
+ include Mixins::EventsProgressChecks
19
+
18
20
  # {"min":"0","max":"100","step":"1"}
19
21
  attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
20
22
 
@@ -23,37 +25,7 @@ module DjiMqttConnect
23
25
  attribute? :total_steps, Types::Integer
24
26
 
25
27
  # {"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"}
26
- attribute? :step_key, Types::String.enum(
27
- "get_bid",
28
- "check_work_mode",
29
- "check_task_state",
30
- "land_mcu_reboot",
31
- "rain_mcu_reboot",
32
- "core_mcu_reboot",
33
- "sdr_reboot",
34
- "write_reboot_param_file",
35
- "get_drone_power_state",
36
- "close_putter",
37
- "check_wired_connect_state",
38
- "open_drone",
39
- "open_alarm",
40
- "check_scram_state",
41
- "open_cover",
42
- "check_drone_sdr_connect_state",
43
- "turn_on_drone",
44
- "drone_paddle_forward",
45
- "close_cover",
46
- "drone_paddle_reverse",
47
- "drone_paddle_stop",
48
- "free_putter",
49
- "stop_charge"
50
- )
51
-
52
- def humanized_step_key
53
- return unless step_key
54
-
55
- I18n.t(step_key, scope: "dji_mqtt_connect.cover_step_key", default: step_key.titleize)
56
- end
28
+ attribute? :step_key, Types::EventsProgressStepKey
57
29
 
58
30
  attribute? :step_result, Types::Integer
59
31
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class DeviceRebootEventsMessage < EventsMessage
6
+ attribute :_method, Types::String.enum("device_reboot")
7
+
8
+ attribute :data do
9
+ attribute :result, Types::Integer
10
+
11
+ attribute :output do
12
+ include Mixins::ServicesOutputStatusChecks
13
+
14
+ # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
15
+ attribute :status, Types::ServicesOutputStatus
16
+
17
+ attribute :progress do
18
+ include Mixins::EventsProgressChecks
19
+
20
+ # {"min":"0","max":"100","step":"1"}
21
+ attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
22
+
23
+ attribute? :current_step, Types::Integer
24
+
25
+ attribute? :total_steps, Types::Integer
26
+
27
+ # {"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
+ attribute? :step_key, Types::EventsProgressStepKey
29
+
30
+ attribute? :step_result, Types::Integer
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Mixins
5
+ # Provides checks for the event progress object that contains a Types::EventsProgressStepKey step_key value
6
+ module EventsProgressChecks
7
+ # Provide accessors for each step key value
8
+ DjiMqttConnect::Types::EventsProgressStepKey.values.each do |step_key_value|
9
+ define_method(:"#{step_key_value}_step?") { step_key == step_key_value }
10
+ end
11
+
12
+ def humanized_step_key
13
+ return unless step_key
14
+
15
+ I18n.t(step_key, scope: "dji_mqtt_connect.events_step_key", default: step_key.titleize)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module DjiMqttConnect
4
- end
5
- # frozen_string_literal: true
6
-
7
3
  module DjiMqttConnect
8
4
  module Mixins
9
5
  # Provides checks for the output object that contains a Types::ServicesOutputStatus status value
@@ -35,6 +35,33 @@ module DjiMqttConnect
35
35
  InvalidTemperature = Types::Integer.constrained(gteq: 1300) # maximum temp of k-type thermocouple, errors are usually 30K+
36
36
  Temperature = InvalidTemperature | Types::JSON::Decimal
37
37
 
38
+ # {"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"}
39
+ EventsProgressStepKey = Types::String.enum(
40
+ "get_bid",
41
+ "check_work_mode",
42
+ "check_task_state",
43
+ "land_mcu_reboot",
44
+ "rain_mcu_reboot",
45
+ "core_mcu_reboot",
46
+ "sdr_reboot",
47
+ "write_reboot_param_file",
48
+ "get_drone_power_state",
49
+ "close_putter",
50
+ "check_wired_connect_state",
51
+ "open_drone",
52
+ "open_alarm",
53
+ "check_scram_state",
54
+ "open_cover",
55
+ "check_drone_sdr_connect_state",
56
+ "turn_on_drone",
57
+ "drone_paddle_forward",
58
+ "close_cover",
59
+ "drone_paddle_reverse",
60
+ "drone_paddle_stop",
61
+ "free_putter",
62
+ "stop_charge"
63
+ )
64
+
38
65
  # {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
39
66
  ServicesOutputStatus = Types::String.enum(
40
67
  SERVICE_OUTPUT_STATUS_SENT = "sent",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.15.1"
4
+ VERSION = "0.1.16"
5
5
  end
@@ -37,6 +37,7 @@ module DjiMqttConnect
37
37
  autoload :CoverCloseEventsMessage, "dji_mqtt_connect/messages/thing/product/events/cover_close"
38
38
  autoload :CoverOpenEventsMessage, "dji_mqtt_connect/messages/thing/product/events/cover_open"
39
39
  autoload :DeviceLogEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_log"
40
+ autoload :DeviceRebootEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_reboot"
40
41
  autoload :DeviceExitHomingNotifyEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify"
41
42
  autoload :FileUploadCallbackEventsMessage, "dji_mqtt_connect/messages/thing/product/events/file_upload_callback"
42
43
  autoload :FileuploadProgressEventsMessage, "dji_mqtt_connect/messages/thing/product/events/fileupload_progress"
@@ -124,6 +125,7 @@ module DjiMqttConnect
124
125
 
125
126
  # Mixinx
126
127
  module Mixins
128
+ autoload :EventsProgressChecks, "dji_mqtt_connect/mixins/events_progress_checks"
127
129
  autoload :LatitudeConditional, "dji_mqtt_connect/mixins/latitude_conditional"
128
130
  autoload :LongitudeConditional, "dji_mqtt_connect/mixins/longitude_conditional"
129
131
  autoload :ServicesOutputStatusChecks, "dji_mqtt_connect/mixins/services_output_status_checks"
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.15.1
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sphere Drones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
11
+ date: 2023-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -129,6 +129,7 @@ files:
129
129
  - lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb
130
130
  - lib/dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify.rb
131
131
  - lib/dji_mqtt_connect/messages/thing/product/events/device_log.rb
132
+ - lib/dji_mqtt_connect/messages/thing/product/events/device_reboot.rb
132
133
  - lib/dji_mqtt_connect/messages/thing/product/events/file_upload_callback.rb
133
134
  - lib/dji_mqtt_connect/messages/thing/product/events/fileupload_progress.rb
134
135
  - lib/dji_mqtt_connect/messages/thing/product/events/flighttask_progress.rb
@@ -183,6 +184,7 @@ files:
183
184
  - lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home.rb
184
185
  - lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home_cancel.rb
185
186
  - lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb
187
+ - lib/dji_mqtt_connect/mixins/events_progress_checks.rb
186
188
  - lib/dji_mqtt_connect/mixins/latitude_conditional.rb
187
189
  - lib/dji_mqtt_connect/mixins/longitude_conditional.rb
188
190
  - lib/dji_mqtt_connect/mixins/services_output_status_checks.rb