dji_mqtt_connect 0.1.19.2 → 0.1.20
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df34f882455e0115d20170670c3cfeff6d52af9184be36f221b22b092bf696a6
|
4
|
+
data.tar.gz: c0df3c4b7415e9ebee4e8b232268add1a475e92c6add94ed90eee4f3f4b2d855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4c8ab91a478f5bb8e1b70071b1ba0999277cacae5fe36f9195a69f035bc292f2175734fb9a701e5fb6c3fc0ed3a255c0d57cfe2d3337ce66d583094186b97c0
|
7
|
+
data.tar.gz: 4bf14e95502fd070111c3928b06488457a44edb1943a6db563339fb106b0f48c7f2fc174c6ba94f66dcd58e94a8432a37056dfcd4b7226016dd778b77046e090
|
data/Gemfile.lock
CHANGED
@@ -20,7 +20,7 @@ module DjiMqttConnect
|
|
20
20
|
copy_keys "data" => "_data"
|
21
21
|
|
22
22
|
# Fix the legacy hms message
|
23
|
-
guard ->(message) { message.dig("data", "method") == "hms" } do
|
23
|
+
guard ->(message) { message["method"].blank? && message.dig("data", "method") == "hms" } do
|
24
24
|
map_value "data" do
|
25
25
|
reject_keys ["event"]
|
26
26
|
|
@@ -47,7 +47,7 @@ module DjiMqttConnect
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Fix the legacy status code message
|
50
|
-
guard ->(message) { message.dig("data", "method") == "status_code" } do
|
50
|
+
guard ->(message) { message["method"].blank? && message.dig("data", "method") == "status_code" } do
|
51
51
|
map_value "data" do
|
52
52
|
unwrap "output", ["codes"]
|
53
53
|
end
|
@@ -75,9 +75,6 @@ module DjiMqttConnect
|
|
75
75
|
raise ParseError.new(e, "Unable to parse message as JSON")
|
76
76
|
rescue Dry::Struct::Error => e
|
77
77
|
raise ParseError.new(e, "Unexpected #{message_class} payload")
|
78
|
-
rescue TypeError => e
|
79
|
-
# FIXME: airsense messages have data as an array, this breaks a lot of code...
|
80
|
-
raise ParseError.new(e, "Unable to parse message")
|
81
78
|
end
|
82
79
|
|
83
80
|
private
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class AirsenseWarningEventsMessage < EventsMessage
|
6
|
+
attribute :_method, Types::String.enum("airsense_warning")
|
7
|
+
attribute :_data, Types::Array
|
8
|
+
|
9
|
+
attribute :data, Types::Array do
|
10
|
+
attribute :icao, Types::String
|
11
|
+
|
12
|
+
# {"0":"No danger","1":"Level one","2":"Level two","3":"Level three","4":"Level four"}
|
13
|
+
attribute :warning_level, Types::Integer.enum(0, 1, 2, 3, 4)
|
14
|
+
|
15
|
+
attribute :latitude, Types::Latitude
|
16
|
+
|
17
|
+
attribute :longitude, Types::Longitude
|
18
|
+
|
19
|
+
attribute :altitude, Types::Integer
|
20
|
+
|
21
|
+
# {"0":"Ellipsoid height","1":"altitude"}
|
22
|
+
attribute :altitude_type, Types::Integer.enum(0, 1)
|
23
|
+
|
24
|
+
attribute :distance, Types::Integer
|
25
|
+
|
26
|
+
attribute :heading, Types::JSON::Decimal
|
27
|
+
|
28
|
+
attribute :relative_altitude, Types::Integer
|
29
|
+
|
30
|
+
# {"0":"Relative height unchanged","1":"Relative height increase","2":"Relative height decrease"}
|
31
|
+
attribute :vert_trend, Types::Integer.enum(0, 1, 2)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/dji_mqtt_connect.rb
CHANGED
@@ -34,6 +34,7 @@ module DjiMqttConnect
|
|
34
34
|
module Thing
|
35
35
|
module Product
|
36
36
|
# Messages
|
37
|
+
autoload :AirsenseWarningEventsMessage, "dji_mqtt_connect/messages/thing/product/events/airsense_warning"
|
37
38
|
autoload :CoverCloseEventsMessage, "dji_mqtt_connect/messages/thing/product/events/cover_close"
|
38
39
|
autoload :CoverOpenEventsMessage, "dji_mqtt_connect/messages/thing/product/events/cover_open"
|
39
40
|
autoload :DeviceLogEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_log"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sphere Drones
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/dji_mqtt_connect/messages/sys/product/status/update_topo.rb
|
128
128
|
- lib/dji_mqtt_connect/messages/sys/product/status_message.rb
|
129
129
|
- lib/dji_mqtt_connect/messages/sys/product/status_reply/update_topo.rb
|
130
|
+
- lib/dji_mqtt_connect/messages/thing/product/events/airsense_warning.rb
|
130
131
|
- lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb
|
131
132
|
- lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb
|
132
133
|
- lib/dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify.rb
|