Sha256: 72b70f60f7b701cf24ef89ed454c88d97c63be616490b0b6bdf5e49bacff7337

Contents?: true

Size: 599 Bytes

Versions: 7

Compression:

Stored size: 599 Bytes

Contents

require 'rubygems'
require 'serialport'
#require 'rest_fs/client'

sp=SerialPort.new "/dev/ttyUSB0", 9600
#r=RestFs::Client.new

info=[0x02, 0x01, 0x47, 0x46, 0x03]
info.each {|c| sp.putc c.to_i}
2.times {sp.getc}
print "Detected reader: "
37.times {putc(sp.getc)}
print "\n"
6.times {sp.getc}

continuous=[0x02, 0x01, 0x43, 0x04, 0x46, 0x03]
continuous.each {|c| sp.putc c.to_i}
6.times {sp.getc}

while true
  2.times {sp.getc}
  v=0
  0.upto(7) do |i|
    v+=sp.getc*2**((7-i)*8)
  end
  print "Detected tag: ", v, "\n"
  #r.create!("/sensors/rfid-readers/usb/tags/#{v}")
  3.times {sp.getc}
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rfid-usb-gom-sensor-0.1.6 lib/rfid_usb_reader.rb
rfid-usb-gom-sensor-0.1.5 lib/rfid_usb_reader.rb
rfid-usb-gom-sensor-0.1.4 lib/rfid_usb_reader.rb
rfid-usb-gom-sensor-0.1.3 lib/rfid_usb_reader.rb
rfid-usb-gom-sensor-0.1.2 lib/rfid_usb_reader.rb
rfid-usb-gom-sensor-0.1.1 lib/rfid_usb_reader.rb
rfid-usb-gom-sensor-0.1.0 lib/rfid_usb_reader.rb