class MetaBridge::Device
Constants
- DEFAULT_IP
- DEFAULT_MAC
- ONLINE_STATE
Attributes
bridge[R]
ip[R]
mac[R]
port[R]
Public Class Methods
all(opts = {})
click to toggle source
# File lib/meta_bridge/device.rb, line 16 def all(opts = {}) proxy = opts.delete(:proxy) || MetaBridge::ARP.new devices = proxy.connections.map do |con| MetaBridge::Device.new(con.merge(opts)) end devices.select { |d| d.online? } end
new(hsh = {})
click to toggle source
# File lib/meta_bridge/device.rb, line 27 def initialize(hsh = {}) @ip = hsh[:ip] || MetaBridge::Device::DEFAULT_IP @mac = hsh[:mac] || MetaBridge::Device::DEFAULT_MAC @port = hsh[:port] || MetaBridge::DEFAULT_PORT @bridge = hsh[:bridge] || MetaBridge::Bridge.new @bridge.device_id = "#{ip}:#{port}" end
Public Instance Methods
log()
click to toggle source
# File lib/meta_bridge/device.rb, line 40 def log bridge.logcat end
online?()
click to toggle source
# File lib/meta_bridge/device.rb, line 36 def online? bridge.get_state == ONLINE_STATE end