Sha256: c97eb904a2caa595427a9430d1e61bab39ccdb4b3584f4f4048784958b1a6c2d

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'applix'

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'e-meter-gom-daemon'

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

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 e-meter GOM daemon: #{Time.now}"

  #daemon = EmeterGomDaemon::Daemon.new sensor_url, options
  #daemon.run
  
  Gom::Remote::Daemon.new(sensor_url, options) do |daemon, path|
    sensor = EmeterGomDaemon::Node.new path, options
    daemon.sensor_loop(sensor.interval) { |daemon| (sensor.tic daemon) }
  end

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

main ARGV
# vim: syntax=ruby

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
e-meter-gom-daemon-0.2.2 bin/e-meter-gom-daemon
e-meter-gom-daemon-0.2.1 bin/e-meter-gom-daemon