meshtastic 0.0.130 → 0.0.132

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cf2cb6f126a32d2086f64ce38a54f82c522c3579c46d0019f81e900cfde974b
4
- data.tar.gz: 3d7bf68962db9ed2979bd5828181a0dd5d801347d75e3598da164821e5c45351
3
+ metadata.gz: 55a43435391e779611e5b054b48922b801ede63b8e2a1475ca6231bee6fea0dc
4
+ data.tar.gz: a174043a34c15e67ac5d3633b2f3e7cb4e8043103f1ec772511dfe07ab4e25e1
5
5
  SHA512:
6
- metadata.gz: 2107b10a0ee3ef8a61f419e8131a68062b27ea946f1002b8a7bbdc19d35806ec5951ef914ec36f2cedc1c790085cc1a596729a9d080b179c0a5a737abee280b6
7
- data.tar.gz: 16eed63585b23209490820f0c98564dfcef159e729d4bd285bcf15e1933057f66e632d1bcd1c16ff2b5784bb9b56f55fe5d52ff171546e791127671e35159d57
6
+ metadata.gz: 56e964f576c853715ba6991d86e4136f40e2c7aca7a33ab51cc0d395c826738bcc97556b05d3556a611b131520d714a016a9a8fe49235dc8dff0c63cdf3cff16
7
+ data.tar.gz: 9ceb1c0ba1b34b56d44cfdc9c382c2cbee879607555f61671ed4d1d21961ccdb2057b1ce702c74223712191b76382414375ff1a54a63688ff54ba2e6af7fe631
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-02-16 22:35:06 UTC using RuboCop version 1.72.1.
3
+ # on 2025-10-22 13:51:38 UTC using RuboCop version 1.81.6.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,34 +8,63 @@
8
8
 
9
9
  # Offense count: 1
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
13
12
  Bundler/OrderedGems:
14
13
  Exclude:
15
14
  - 'Gemfile'
16
15
 
17
- # Offense count: 49
16
+ # Offense count: 1
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ Layout/EmptyLineAfterGuardClause:
19
+ Exclude:
20
+ - 'lib/meshtastic/stream_interface.rb'
21
+
22
+ # Offense count: 24
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ Layout/EmptyLineAfterMagicComment:
25
+ Enabled: false
26
+
27
+ # Offense count: 24
28
+ # This cop supports safe autocorrection (--autocorrect).
29
+ Layout/EmptyLines:
30
+ Enabled: false
31
+
32
+ # Offense count: 23
33
+ # This cop supports safe autocorrection (--autocorrect).
34
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
35
+ # URISchemes: http, https
36
+ Layout/LineLength:
37
+ Enabled: false
38
+
39
+ # Offense count: 1
40
+ # This cop supports safe autocorrection (--autocorrect).
41
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
42
+ # SupportedStyles: space, no_space
43
+ # SupportedStylesForEmptyBraces: space, no_space
44
+ Layout/SpaceBeforeBlockBraces:
45
+ Exclude:
46
+ - 'lib/meshtastic/serial_interface.rb'
47
+
48
+ # Offense count: 48
18
49
  # Configuration parameters: AllowComments, AllowEmptyLambdas.
19
50
  Lint/EmptyBlock:
20
51
  Enabled: false
21
52
 
22
- # Offense count: 4
53
+ # Offense count: 1
23
54
  # This cop supports safe autocorrection (--autocorrect).
24
- # Configuration parameters: AutoCorrect.
25
- Lint/UselessAssignment:
55
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
56
+ # NotImplementedExceptions: NotImplementedError
57
+ Lint/UnusedMethodArgument:
26
58
  Exclude:
27
- - 'lib/meshtastic/serial.rb'
28
- - 'meshtastic.gemspec'
59
+ - 'lib/meshtastic/stream_interface.rb'
29
60
 
30
- # Offense count: 6
31
- # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
32
- # AllowedMethods: refine
33
- Metrics/BlockLength:
61
+ # Offense count: 8
62
+ # This cop supports safe autocorrection (--autocorrect).
63
+ Lint/UselessAssignment:
34
64
  Exclude:
35
- - '**/*.gemspec'
36
- - 'lib/meshtastic/config_pb.rb'
37
- - 'lib/meshtastic/mesh_pb.rb'
38
- - 'lib/meshtastic/module_config_pb.rb'
65
+ - 'lib/meshtastic/serial_interface.rb'
66
+ - 'lib/meshtastic/stream_interface.rb'
67
+ - 'meshtastic.gemspec'
39
68
 
40
69
  # Offense count: 1
41
70
  # Configuration parameters: CountComments, Max, CountAsOne.
@@ -43,50 +72,61 @@ Metrics/ClassLength:
43
72
  Exclude:
44
73
  - 'lib/meshtastic/mesh_interface.rb'
45
74
 
46
- # Offense count: 52
47
- # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
48
- # SupportedStyles: snake_case, normalcase, non_integer
49
- # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
50
- Naming/VariableNumber:
75
+ # Offense count: 2
76
+ # This cop supports safe autocorrection (--autocorrect).
77
+ # Configuration parameters: Keywords, RequireColon.
78
+ # Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
79
+ Style/CommentAnnotation:
51
80
  Exclude:
52
- - 'lib/meshtastic/config_pb.rb'
53
- - 'lib/meshtastic/mesh_pb.rb'
54
- - 'lib/meshtastic/module_config_pb.rb'
55
- - 'lib/nanopb_pb.rb'
81
+ - 'lib/meshtastic/stream_interface.rb'
56
82
 
57
- # Offense count: 24
83
+ # Offense count: 25
58
84
  # Configuration parameters: AllowedConstants.
59
85
  Style/Documentation:
60
86
  Enabled: false
61
87
 
62
- # Offense count: 2
88
+ # Offense count: 1
63
89
  # This cop supports safe autocorrection (--autocorrect).
64
90
  Style/ExplicitBlockArgument:
65
91
  Exclude:
66
- - 'lib/meshtastic/serial.rb'
92
+ - 'lib/meshtastic/serial_interface.rb'
67
93
 
68
- # Offense count: 23
69
- # This cop supports unsafe autocorrection (--autocorrect-all).
70
- # Configuration parameters: EnforcedStyle.
71
- # SupportedStyles: always, always_true, never
72
- Style/FrozenStringLiteralComment:
73
- Enabled: false
94
+ # Offense count: 1
95
+ # This cop supports safe autocorrection (--autocorrect).
96
+ Style/IfUnlessModifier:
97
+ Exclude:
98
+ - 'lib/meshtastic/stream_interface.rb'
74
99
 
75
- # Offense count: 23
100
+ # Offense count: 29
76
101
  # This cop supports safe autocorrection (--autocorrect).
77
- # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
78
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
79
- # SupportedShorthandSyntax: always, never, either, consistent, either_consistent
80
- Style/HashSyntax:
102
+ Style/RedundantConstantBase:
81
103
  Enabled: false
82
104
 
83
- # Offense count: 5
105
+ # Offense count: 1
84
106
  # This cop supports safe autocorrection (--autocorrect).
85
- Style/RedundantConstantBase:
107
+ Style/RedundantSelf:
108
+ Exclude:
109
+ - 'lib/meshtastic/stream_interface.rb'
110
+
111
+ # Offense count: 12
112
+ # This cop supports safe autocorrection (--autocorrect).
113
+ Style/RedundantStringEscape:
114
+ Exclude:
115
+ - 'lib/meshtastic/admin_pb.rb'
116
+ - 'lib/meshtastic/deviceonly_pb.rb'
117
+ - 'lib/meshtastic/mesh_pb.rb'
118
+ - 'lib/meshtastic/module_config_pb.rb'
119
+ - 'lib/meshtastic/telemetry_pb.rb'
120
+
121
+ # Offense count: 3
122
+ # This cop supports unsafe autocorrection (--autocorrect-all).
123
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
124
+ # AllowedMethods: present?, blank?, presence, try, try!
125
+ Style/SafeNavigation:
86
126
  Exclude:
87
- - 'lib/nanopb_pb.rb'
127
+ - 'lib/meshtastic/stream_interface.rb'
88
128
 
89
- # Offense count: 522
129
+ # Offense count: 182
90
130
  # This cop supports safe autocorrection (--autocorrect).
91
131
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
92
132
  # SupportedStyles: single_quotes, double_quotes
data/README.md CHANGED
@@ -30,6 +30,7 @@ At the moment the only module available is `Meshtastic::MQTT`. To view MQTT mes
30
30
  require 'meshtastic'
31
31
  Meshtastic::MQTT.help
32
32
  mqtt_obj = Meshastic::MQTT.connect
33
+ puts mqtt_obj.inspect
33
34
  Meshtastic::MQTT.subscribe(
34
35
  mqtt_obj: mqtt_obj,
35
36
  include: '_APP, LongFast'
@@ -43,8 +44,9 @@ require 'meshtastic'
43
44
  mqtt_obj = Meshastic::MQTT.connect
44
45
  Meshtastic::MQTT.subscribe(
45
46
  mqtt_obj: mqtt_obj,
47
+ root_topic: 'msh',
46
48
  region: 'US',
47
- channel_topic: '2/e/LongFast/#',
49
+ topic: '2/e/LongFast/#',
48
50
  psks: { LongFast: 'AQ==' }
49
51
  ) do |message|
50
52
  puts message.inspect
@@ -61,7 +63,9 @@ Meshtastic::MQTT.send_text(
61
63
  mqtt_obj: mqtt_obj,
62
64
  from: client_id,
63
65
  to: '!ffffffff',
64
- topic: "msh/US/2/e/LongFast/#{client_id}",
66
+ root_topic: 'msh',
67
+ region: 'US',
68
+ topic: '2/e/LongFast/#',
65
69
  channel: 93,
66
70
  text: 'Hello, World!',
67
71
  psks: { LongFast: 'AQ==' }
@@ -75,8 +79,9 @@ require 'meshtastic'
75
79
  mqtt_obj = Meshastic::MQTT.connect
76
80
  Meshtastic::MQTT.subscribe(
77
81
  mqtt_obj: mqtt_obj,
82
+ root_topic: 'msh',
78
83
  region: 'US',
79
- channel_topic: '2/e/LongFast/#',
84
+ topic: '2/e/LongFast/#',
80
85
  psks: { LongFast: 'AQ==' },
81
86
  include: '!YOUR_CLIENT_ID'
82
87
  ) do |message|
@@ -253,7 +253,9 @@ module Meshtastic
253
253
  # mqtt_obj: 'required - mqtt_obj returned from #connect method',
254
254
  # from: 'required - From ID (String or Integer) (Default: "!00000b0b")',
255
255
  # to: 'optional - Destination ID (Default: "!ffffffff")',
256
- # topic: 'optional - topic to publish to (Default: "msh/US/2/e/LongFast/1")',
256
+ # root_topic: 'optional - root topic (default: msh)',
257
+ # region: 'optional - region e.g. "US/VA", etc (default: US)',
258
+ # topic: 'optional - topic to publish to (default: "2/e/LongFast/#")',
257
259
  # channel: 'optional - channel (Default: 6)',
258
260
  # text: 'optional - Text Message (Default: SYN)',
259
261
  # want_ack: 'optional - Want Acknowledgement (Default: false)',
@@ -264,16 +266,22 @@ module Meshtastic
264
266
  # )
265
267
  public_class_method def self.send_text(opts = {})
266
268
  mqtt_obj = opts[:mqtt_obj]
267
- from = opts[:from]
268
- topic = opts[:topic] ||= 'msh/US/2/e/LongFast/#'
269
- topic = "#{topic}/#{from}"
269
+ opts[:from] ||= mqtt_obj.client_id
270
+ opts[:to] ||= '!ffffffff'
271
+ opts[:root_topic] ||= 'msh'
272
+ opts[:region] ||= 'US'
273
+ opts[:topic] ||= '2/e/LongFast/#'
274
+ opts[:topic] = opts[:topic].to_s.gsub('/#', '')
275
+ opts[:channel] ||= 6
276
+ absolute_topic = "#{opts[:root_topic]}/#{opts[:region]}/#{opts[:topic]}/#{opts[:from]}"
277
+ opts[:topic] = absolute_topic
270
278
  opts[:via] = :mqtt
271
279
 
272
280
  # TODO: Implement chunked message to deal with large messages
273
281
  mui = Meshtastic::MeshInterface.new
274
282
  protobuf_text = mui.send_text(opts)
275
283
 
276
- mqtt_obj.publish(topic, protobuf_text)
284
+ mqtt_obj.publish(absolute_topic, protobuf_text)
277
285
  rescue StandardError => e
278
286
  raise e
279
287
  end
@@ -331,7 +339,9 @@ module Meshtastic
331
339
  mqtt_obj: 'required - mqtt_obj returned from #connect method',
332
340
  from: 'required - From ID (String or Integer) (Default: \"!00000b0b\")',
333
341
  to: 'optional - Destination ID (Default: \"!ffffffff\")',
334
- topic: 'optional - topic to publish to (default: 'msh/US/2/e/LongFast/1')',
342
+ root_topic: 'optional - root topic (default: msh)',
343
+ region: 'optional - region e.g. 'US/VA', etc (default: US)',
344
+ topic: 'optional - topic to publish to (default: '2/e/LongFast/#')',
335
345
  channel: 'optional - channel (Default: 6)',
336
346
  text: 'optional - Text Message (Default: SYN)',
337
347
  want_ack: 'optional - Want Acknowledgement (Default: false)',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.130'
4
+ VERSION = '0.0.132'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.130
4
+ version: 0.0.132
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.