meshtastic 0.0.130 → 0.0.131

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: 7d5c8125b93a40c6bf9c026e9772c358780efccd8c726429374f236dde76ee3e
4
+ data.tar.gz: dddc89b1ff453d5f1d632c08b829c423ae37d4da2eefbe73e486404abc7ba1bb
5
5
  SHA512:
6
- metadata.gz: 2107b10a0ee3ef8a61f419e8131a68062b27ea946f1002b8a7bbdc19d35806ec5951ef914ec36f2cedc1c790085cc1a596729a9d080b179c0a5a737abee280b6
7
- data.tar.gz: 16eed63585b23209490820f0c98564dfcef159e729d4bd285bcf15e1933057f66e632d1bcd1c16ff2b5784bb9b56f55fe5d52ff171546e791127671e35159d57
6
+ metadata.gz: e5c6a5f73853b09707850e2d3f33bfd9cd93f35dc5db352589f384d5c246640b6bdd377ff054096bd94d5c5896953a47a2fa05ec03e10057ad075cd051d675ce
7
+ data.tar.gz: 186455cdf4cefe78b9d4711515675ee06f8664e4cb431e0865103a1ad6a6663484e754aa1358dd8442239e3ce74b9d57e7385b152ed6ef65d15518cd01a2b9ce
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
@@ -44,7 +44,7 @@ mqtt_obj = Meshastic::MQTT.connect
44
44
  Meshtastic::MQTT.subscribe(
45
45
  mqtt_obj: mqtt_obj,
46
46
  region: 'US',
47
- channel_topic: '2/e/LongFast/#',
47
+ topic: '2/e/LongFast/#',
48
48
  psks: { LongFast: 'AQ==' }
49
49
  ) do |message|
50
50
  puts message.inspect
@@ -76,7 +76,7 @@ mqtt_obj = Meshastic::MQTT.connect
76
76
  Meshtastic::MQTT.subscribe(
77
77
  mqtt_obj: mqtt_obj,
78
78
  region: 'US',
79
- channel_topic: '2/e/LongFast/#',
79
+ topic: '2/e/LongFast/#',
80
80
  psks: { LongFast: 'AQ==' },
81
81
  include: '!YOUR_CLIENT_ID'
82
82
  ) 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,20 @@ 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[:channel] ||= 6
275
+ absolute_topic = "#{opts[:root_topic]}/#{opts[:region]}/#{opts[:topic]}/#{opts[:from]}"
270
276
  opts[:via] = :mqtt
271
277
 
272
278
  # TODO: Implement chunked message to deal with large messages
273
279
  mui = Meshtastic::MeshInterface.new
274
280
  protobuf_text = mui.send_text(opts)
275
281
 
276
- mqtt_obj.publish(topic, protobuf_text)
282
+ mqtt_obj.publish(absolute_topic, protobuf_text)
277
283
  rescue StandardError => e
278
284
  raise e
279
285
  end
@@ -331,7 +337,9 @@ module Meshtastic
331
337
  mqtt_obj: 'required - mqtt_obj returned from #connect method',
332
338
  from: 'required - From ID (String or Integer) (Default: \"!00000b0b\")',
333
339
  to: 'optional - Destination ID (Default: \"!ffffffff\")',
334
- topic: 'optional - topic to publish to (default: 'msh/US/2/e/LongFast/1')',
340
+ root_topic: 'optional - root topic (default: msh)',
341
+ region: 'optional - region e.g. 'US/VA', etc (default: US)',
342
+ topic: 'optional - topic to publish to (default: '2/e/LongFast')',
335
343
  channel: 'optional - channel (Default: 6)',
336
344
  text: 'optional - Text Message (Default: SYN)',
337
345
  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.131'
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.131
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.