meshtastic 0.0.55 → 0.0.56

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: 6e5fa2b876003694039c7b9e869e3ae165f4f9c89023ef9936e059d55fb88f77
4
- data.tar.gz: 7b7b7a348051bb55b232e0dc974d9dbb182a85a6680fa9575f19832dbc48685f
3
+ metadata.gz: 587ec9cf838d9bc00fb0881bfb06e5baaf32b76cf92be0f1687dee8397cc372e
4
+ data.tar.gz: 4bf94458eae35a86738318fff4931094f943bd3afcacb967e2022809c0e211ac
5
5
  SHA512:
6
- metadata.gz: 99bd471d591581d107dcb38ea258d48b468cc3c124b276d7d1b6e935b1a78d12d4e555d15f6e426a93f372f97576482a15fb2bcd39b05f5873c0958c51da5110
7
- data.tar.gz: 0a0e1c273cad423c52a1e4d00fab66e59936951e35d0be5cf37fd4677ea971d56ea57dfd9ab2c41d1c62e3393101730d86286443602c54728d101ef09849337b
6
+ metadata.gz: 1cb23efe67552373a15b746b6553951f6694fe64fd03a68f4db730b2c477a769999dba92146b8a40d85cd3c29ea71c931a5406b1d081367a3699eaf8358af8b2
7
+ data.tar.gz: 9c2733116cfaebcfa388a4211d519e0216ca1709d2752d197bc7175cb92e4a1246c4e5ff7baea6fcd5314ff69af458b90b24094eb5ff749861ad2d116aae1844
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.55'
4
+ VERSION = '0.0.56'
5
5
  end
data/lib/meshtastic.rb CHANGED
@@ -216,9 +216,15 @@ module Meshtastic
216
216
  mesh_packet.channel = channel
217
217
  mesh_packet.want_ack = want_ack
218
218
  mesh_packet.hop_limit = hop_limit
219
- mesh_packet.id = generate_packet_id if mesh_packet.id.zero?
220
- # mesh_packet.channel_id = psks.keys.first
221
- # mesh_packet.gateway_id = "!#{from.to_s(16).downcase}"
219
+
220
+ # TODO: Implement strategy for obtaining last packet id
221
+ packet_id = 0
222
+ if mesh_packet.id.zero?
223
+ packet_id = generate_packet_id(
224
+ last_packet_id: packet_id
225
+ )
226
+ end
227
+ mesh_packet.id = packet_id
222
228
 
223
229
  if psks
224
230
  nonce_packet_id = [mesh_packet.id].pack('V').ljust(8, "\x00")
@@ -267,7 +273,8 @@ module Meshtastic
267
273
  last_packet_id = opts[:last_packet_id] ||= 0
268
274
  last_packet_id = 0 if last_packet_id.negative?
269
275
 
270
- (last_packet_id + 1) & 0xffffffff
276
+ Random.rand(0xffffffff) if last_packet_id.zero?
277
+ (last_packet_id + 1) & 0xffffffff if last_packet_id.positive?
271
278
  end
272
279
 
273
280
  # Supported Method Parameters::
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.55
4
+ version: 0.0.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.