meshtastic 0.0.101 → 0.0.103
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/meshtastic/mqtt.rb +11 -3
- data/lib/meshtastic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bee9cdd789db9736c39108372ccef8f145d05b158560f22d6b9a2be2c7d7f8a
|
4
|
+
data.tar.gz: 6ae5f47da17ce5ebf673e3bd3da68e98ddd07230be5032e0c9625e21b8c9183b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b08f69b99a6f7dbf03b5b845f36dbf101ea9514271ab58b2184c7a3ee5ff5ff3580c78c3b86980002ee008bb6d9f50880b6baf217f0eb927b257ccf572c5262
|
7
|
+
data.tar.gz: cab99baff19c1c1210c0c69be2d908be2b9af36100c78a354f38d3294aabe2bddfb8cd56c62989e81c84a6b3dd36ef40e418b378699a001e73c8e40bcc8d1403
|
data/lib/meshtastic/mqtt.rb
CHANGED
@@ -21,7 +21,8 @@ module Meshtastic
|
|
21
21
|
# username: 'optional - mqtt username (default: meshdev)',
|
22
22
|
# password: 'optional - (default: large4cats)',
|
23
23
|
# client_id: 'optional - client ID (default: random 4-byte hex string)',
|
24
|
-
# keep_alive: 'optional - keep alive interval (default:
|
24
|
+
# keep_alive: 'optional - keep alive interval (default: 0)',
|
25
|
+
# ack_timeout: 'optional - acknowledgement timeout (default: 30)'
|
25
26
|
# )
|
26
27
|
|
27
28
|
public_class_method def self.connect(opts = {})
|
@@ -33,7 +34,8 @@ module Meshtastic
|
|
33
34
|
client_id = opts[:client_id] ||= SecureRandom.random_bytes(4).unpack1('H*').to_s
|
34
35
|
client_id = format("%0.8x", client_id) if client_id.is_a?(Integer)
|
35
36
|
client_id = client_id.delete('!') if client_id.include?('!')
|
36
|
-
keep_alive = opts[:keep_alive] ||=
|
37
|
+
keep_alive = opts[:keep_alive] ||= 0
|
38
|
+
ack_timeout = opts[:ack_timeout] ||= 30
|
37
39
|
|
38
40
|
mqtt_obj = MQTTClient.connect(
|
39
41
|
host: host,
|
@@ -42,7 +44,12 @@ module Meshtastic
|
|
42
44
|
password: password,
|
43
45
|
client_id: client_id
|
44
46
|
)
|
47
|
+
|
45
48
|
mqtt_obj.keep_alive = keep_alive
|
49
|
+
mqtt_obj.ack_timeout = ack_timeout
|
50
|
+
# Not setters, only getters
|
51
|
+
# mqtt_obj.last_ping_request = 0
|
52
|
+
# mqtt_obj.last_ping_response = 0
|
46
53
|
|
47
54
|
mqtt_obj
|
48
55
|
rescue StandardError => e
|
@@ -278,7 +285,8 @@ module Meshtastic
|
|
278
285
|
username: 'optional - mqtt username (default: meshdev)',
|
279
286
|
password: 'optional - (default: large4cats)',
|
280
287
|
client_id: 'optional - client ID (default: random 4-byte hex string)',
|
281
|
-
keep_alive: 'optional - keep alive interval (default:
|
288
|
+
keep_alive: 'optional - keep alive interval (default: 0)',
|
289
|
+
ack_timeout: 'optional - acknowledgement timeout (default: 30)'
|
282
290
|
)
|
283
291
|
|
284
292
|
#{self}.subscribe(
|
data/lib/meshtastic/version.rb
CHANGED