meshtastic 0.0.60 → 0.0.61

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: eeece01e7acf9c7a1da3ce75b799d101ad6b4a543203e220c8d8ef67c66980ae
4
- data.tar.gz: 0ca6e337660d31a51421aab3f1fcf62fda73f8e9178b4b1bcb165c3d5eebce3c
3
+ metadata.gz: dceeac29deeac96282b54784e35f07c58b94eefa80d90e52c99fa13d34abe359
4
+ data.tar.gz: 8a30e46f08215d9c681506e9e138856b442f97af1f9bdcb28b3a2c3defd02a14
5
5
  SHA512:
6
- metadata.gz: 002f3c6cb87c0ae8174986a3b0b834c71e04b26d5ecc5553ea45a453b8ffb2e18fe0990819088153fdf72fae6638042696d8b4c95a3612c6070f15bf0b72dc9c
7
- data.tar.gz: 6015c2daf7cccdd2fc1d2e109de4d1379ba13916b3d9431d14d279499fea56e7dd861b9867ca87d1e02879511be2fc915399cdeefcbd2461fe2022eba8b079b0
6
+ metadata.gz: ac41b52aa5c8069b6da7b8ce6e27f09643604c0b2978230dde661612e50a1656e6740d7ede4f4c8bf27a0230b807e4b98f305897e293053f0450d5f8a793aa52
7
+ data.tar.gz: 760a90c99e4618a3b1448e13d5a2fd0434a5c169d7235629c8c18a128bc8761bd81135a131e6aa4cce84f823dd27eb15aa77a077a1b3ed4fd761e2cf3a54e6e8
@@ -167,7 +167,8 @@ module Meshtastic
167
167
  end
168
168
 
169
169
  payload
170
- rescue Google::Protobuf::ParseError
170
+ rescue Encoding::CompatibilityError,
171
+ Google::Protobuf::ParseError
171
172
  payload
172
173
  rescue StandardError => e
173
174
  raise e
@@ -342,6 +343,32 @@ module Meshtastic
342
343
  mqtt_obj.disconnect if mqtt_obj
343
344
  end
344
345
 
346
+ # Supported Method Parameters::
347
+ # Meshtastic.send_text(
348
+ # mqtt_obj: 'required - mqtt_obj returned from #connect method',
349
+ # from: ' required - From ID (String or Integer)',
350
+ # to: 'optional - Destination ID (Default: 0xFFFFFFFF)',
351
+ # topic: 'optional - topic to publish to (default: "msh/US/2/e/LongFast/1")',
352
+ # channel: 'optional - channel ID (Default: 6)',
353
+ # text: 'optional - Text Message (Default: SYN)',
354
+ # want_ack: 'optional - Want Acknowledgement (Default: false)',
355
+ # want_response: 'optional - Want Response (Default: false)',
356
+ # hop_limit: 'optional - Hop Limit (Default: 3)',
357
+ # on_response: 'optional - Callback on Response',
358
+ # psks: 'optional - hash of :channel => psk key value pairs (default: { LongFast: "AQ==" })'
359
+ # )
360
+ public_class_method def self.send_text(opts = {})
361
+ mqtt_obj = opts[:mqtt_obj]
362
+ topic = opts[:topic] ||= 'msh/US/2/e/LongFast/#'
363
+ opts[:via] = :mqtt
364
+
365
+ protobuf_text = Meshtastic.send_text(opts)
366
+
367
+ mqtt_obj.publish(topic, protobuf_text)
368
+ rescue StandardError => e
369
+ raise e
370
+ end
371
+
345
372
  # Supported Method Parameters::
346
373
  # mqtt_obj = Meshtastic.gps_search(
347
374
  # lat: 'required - latitude float (e.g. 37.7749)',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.60'
4
+ VERSION = '0.0.61'
5
5
  end
data/lib/meshtastic.rb CHANGED
@@ -55,7 +55,7 @@ module Meshtastic
55
55
  # to: 'optional - Destination ID (Default: 0xFFFFFFFF)',
56
56
  # last_packet_id: 'optional - Last Packet ID (Default: 0)',
57
57
  # via: 'optional - :radio || :mqtt (Default: :radio)',
58
- # channel: 'optional - Channel ID (Default: 0)',
58
+ # channel: 'optional - Channel ID (Default: 6)',
59
59
  # text: 'optional - Text Message (Default: SYN)',
60
60
  # want_ack: 'optional - Want Acknowledgement (Default: false)',
61
61
  # want_response: 'optional - Want Response (Default: false)',
@@ -76,7 +76,7 @@ module Meshtastic
76
76
 
77
77
  last_packet_id = opts[:last_packet_id] ||= 0
78
78
  via = opts[:via] ||= :radio
79
- channel = opts[:channel] ||= 0
79
+ channel = opts[:channel] ||= 6
80
80
  text = opts[:text] ||= 'SYN'
81
81
  want_ack = opts[:want_ack] ||= false
82
82
  want_response = opts[:want_response] ||= false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.60
4
+ version: 0.0.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-11 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler