meshtastic 0.0.134 → 0.0.136
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 +11 -18
 - 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: 9a2f0696ed43ca59156381462124f7b718e3274c660f9137ec58825fddccdb51
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b4fc01faf3182e9aaef0bfab5b01d71a3a2e1bedea06fb284b2fb6eeecc1906b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: dbb40e6e0003f999ce026d4b590e27e62f2b5420089437fc2006f87cc1ac979c2c07ff5ae793d62d2cc006881100dd8e8d5a8936248d7c8549fdafb766fa374f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1e1cdf5c925e617e2245983082ce2c467830bca7c56b97853db3d95993bfc1f61493423ad87520d67bce1f4572e88e0984b1c1fab9ce909f8f64be88d8914f05
         
     | 
    
        data/lib/meshtastic/mqtt.rb
    CHANGED
    
    | 
         @@ -278,29 +278,22 @@ module Meshtastic 
     | 
|
| 
       278 
278 
     | 
    
         
             
                  opts[:via] = :mqtt
         
     | 
| 
       279 
279 
     | 
    
         | 
| 
       280 
280 
     | 
    
         
             
                  # TODO: Implement chunked message to deal with large messages
         
     | 
| 
       281 
     | 
    
         
            -
                   
     | 
| 
      
 281 
     | 
    
         
            +
                  text = opts[:text].to_s
         
     | 
| 
       282 
282 
     | 
    
         
             
                  max_bytes = 232
         
     | 
| 
       283 
283 
     | 
    
         
             
                  mui = Meshtastic::MeshInterface.new
         
     | 
| 
       284 
284 
     | 
    
         | 
| 
       285 
     | 
    
         
            -
                  if  
     | 
| 
       286 
     | 
    
         
            -
                     
     | 
| 
       287 
     | 
    
         
            -
                     
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
                       
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
                       
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
     | 
    
         
            -
                      end
         
     | 
| 
       295 
     | 
    
         
            -
                    end
         
     | 
| 
       296 
     | 
    
         
            -
                    chunks.push(current_chunk) unless current_chunk.empty?
         
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
                    total_chunks = chunks.length
         
     | 
| 
       299 
     | 
    
         
            -
                    chunks.each_with_index do |chunk, index|
         
     | 
| 
      
 285 
     | 
    
         
            +
                  if text.bytesize > max_bytes
         
     | 
| 
      
 286 
     | 
    
         
            +
                    total_chunks = (text.bytesize.to_f / max_bytes).ceil
         
     | 
| 
      
 287 
     | 
    
         
            +
                    total_chunks.times do |i|
         
     | 
| 
      
 288 
     | 
    
         
            +
                      chunk_num = i + 1
         
     | 
| 
      
 289 
     | 
    
         
            +
                      chunk_prefix = "(#{chunk_num} of #{total_chunks})"
         
     | 
| 
      
 290 
     | 
    
         
            +
                      chunk_prefix_len = chunk_prefix.bytesize
         
     | 
| 
      
 291 
     | 
    
         
            +
                      start_index = i * (max_bytes - chunk_prefix_len)
         
     | 
| 
      
 292 
     | 
    
         
            +
                      end_index = (start_index + (max_bytes - chunk_prefix_len)) - 1
         
     | 
| 
      
 293 
     | 
    
         
            +
                      chunk = "#{chunk_prefix} #{text.byteslice(start_index..end_index)}"
         
     | 
| 
       300 
294 
     | 
    
         
             
                      opts[:text] = chunk
         
     | 
| 
       301 
     | 
    
         
            -
                      opts[:text] = "[#{index + 1}/#{total_chunks}] #{chunk}"
         
     | 
| 
       302 
295 
     | 
    
         
             
                      protobuf_chunk = mui.send_text(opts)
         
     | 
| 
       303 
     | 
    
         
            -
                       
     | 
| 
      
 296 
     | 
    
         
            +
                      mqtt_obj.publish(absolute_topic, protobuf_chunk)
         
     | 
| 
       304 
297 
     | 
    
         
             
                    end
         
     | 
| 
       305 
298 
     | 
    
         
             
                  else
         
     | 
| 
       306 
299 
     | 
    
         
             
                    protobuf_text = mui.send_text(opts)
         
     | 
    
        data/lib/meshtastic/version.rb
    CHANGED