Sha256: c03cd0645900c9e0a81300d28e350e0a5220e8f5b33c90f5eeb72d949d9cbc14

Contents?: true

Size: 961 Bytes

Versions: 4

Compression:

Stored size: 961 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'applix'

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'rfid-usb-gom-sensor'

Thread.abort_on_exception = true
$stderr.sync = true
$stdout.sync = true

class Usage < ArgumentError; end

def main argv
  options = Hash.from_argv argv
  args = (options.delete :args)
  #options[:callback_port] ||= 32119

  sensor_url = args.shift
  sensor_url or (raise Usage, "no <sensor_url>")
  puts " -- starting RFID sensor: #{Time.now}"

  daemon = Gom::Remote::Daemon.new(sensor_url, options) do |daemon, _| 
    daemon.check_in 
  end
  sensor = RfidUsbGomSensor::Node.new daemon.service_path, options
  sensor.preroll
  daemon.background_loop(1.1) { sensor.push_active_tags_to_gom }
  daemon.forever { sensor.detect }

rescue Usage => e
  puts <<-TXT

usage: #{__FILE__} <GOM Sensor URL>

 ## #{e}
  TXT
rescue => e
  puts " ## #{e}\n -> #{e.backtrace.join "\n    "}"
end

main ARGV
# vim: syntax=ruby

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rfid-usb-gom-sensor-0.1.5 bin/rfid-usb-gom-sensor
rfid-usb-gom-sensor-0.1.4 bin/rfid-usb-gom-sensor
rfid-usb-gom-sensor-0.1.3 bin/rfid-usb-gom-sensor
rfid-usb-gom-sensor-0.1.2 bin/rfid-usb-gom-sensor