Class: LibComponent::Output

Inherits:
Object
  • Object
show all
Includes:
Pin
Defined in:
lib/openplacos/libcomponent.rb

Defined Under Namespace

Modules: Read, Write

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Pin

#buffer=, #introspect, #set_component

Constructor Details

#initialize(pin_name_, iface_name_, meth_ = "rw") ⇒ Output

Returns a new instance of Output.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/openplacos/libcomponent.rb', line 171

def initialize(pin_name_,iface_name_,meth_ = "rw")
  @name = pin_name_
  @interface = iface_name_ 
  @meth = meth_
  @proxy = nil
  
  # introspect is defined according to read and write methods
  if @meth.include?("r")
    instance_eval { self.extend(Read) }
  end
  if @meth.include?("w")
    instance_eval { self.extend(Write) }
  end
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



170
171
172
# File 'lib/openplacos/libcomponent.rb', line 170

def interface
  @interface
end

#nameObject (readonly)

Returns the value of attribute name.



170
171
172
# File 'lib/openplacos/libcomponent.rb', line 170

def name
  @name
end

Instance Method Details

#connect(proxy_) ⇒ Object



217
218
219
220
221
222
# File 'lib/openplacos/libcomponent.rb', line 217

def connect(proxy_)
  @proxy = proxy_["org.openplacos.#{@interface}"]
  if @proxy.nil?
    LibError.quit_server(255, "The interface org.openplacos.#{@interface} is not available for pin #{self.name}")
  end
end