meshtastic 0.0.101 → 0.0.102
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 +10 -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: 4c3b82fb9dc1953f506b3ef9cebbaa3d9c605d08c5e05d71f92bb8a19764d926
|
4
|
+
data.tar.gz: cb155d903eeed821718c2ac2efe7f2b823b86898d9cc1042fd7d15e10894faca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7ab96c2458e868b09b10030796a6211c0dc46c1cff2f36ed49bc70d0667b4001661a9d89050f247b8e266dd96ebd82ac48dfa4b64c8f38259ea41035746884e
|
7
|
+
data.tar.gz: dbf5a3ba45928cecc42cc408fb238bf159898dd9b34f3a4e242e25ee2cf576087fdc2dcd0bdeff2618df64b536cd58b5d6be74e5f0835238f88e93ce867a4e74
|
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,11 @@ 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
|
+
mqtt_obj.last_ping_request = 0
|
51
|
+
mqtt_obj.last_ping_response = 0
|
46
52
|
|
47
53
|
mqtt_obj
|
48
54
|
rescue StandardError => e
|
@@ -278,7 +284,8 @@ module Meshtastic
|
|
278
284
|
username: 'optional - mqtt username (default: meshdev)',
|
279
285
|
password: 'optional - (default: large4cats)',
|
280
286
|
client_id: 'optional - client ID (default: random 4-byte hex string)',
|
281
|
-
keep_alive: 'optional - keep alive interval (default:
|
287
|
+
keep_alive: 'optional - keep alive interval (default: 0)',
|
288
|
+
ack_timeout: 'optional - acknowledgement timeout (default: 30)'
|
282
289
|
)
|
283
290
|
|
284
291
|
#{self}.subscribe(
|
data/lib/meshtastic/version.rb
CHANGED