Sha256: f93ca40766b7d46aee92599ce673a9c02ad0a1437bba71cd0b2edfe68c8a041e

Contents?: true

Size: 961 Bytes

Versions: 1

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(0.7) { 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

1 entries across 1 versions & 1 rubygems

Version Path
rfid-usb-gom-sensor-0.1.6 bin/rfid-usb-gom-sensor