Class: Twib::Interface
- Inherits:
-
Object
- Object
- Twib::Interface
- Defined in:
- lib/twib/interface.rb
Overview
Base class for Ruby bindings to a remote interface. An instance of this class represents a remote bridge object.
This class and any subclasses should not typically be instantiated directly. Rather, instances should be returned from either TwibConnection#open_device or a remote command binding.
Direct Known Subclasses
Twib::Interfaces::ITwibDebugger, Twib::Interfaces::ITwibDeviceInterface, Twib::Interfaces::ITwibMetaInterface
Instance Method Summary collapse
-
#initialize(connection, device_id, object_id) ⇒ Interface
constructor
A new instance of Interface.
-
#send(command_id, payload = String.new) {|rs| ... } ⇒ ActiveRequest
Sends a request to the remote object this instance is bound to.
Constructor Details
#initialize(connection, device_id, object_id) ⇒ Interface
Returns a new instance of Interface.
13 14 15 16 17 |
# File 'lib/twib/interface.rb', line 13 def initialize(connection, device_id, object_id) @connection = connection @device_id = device_id @object_id = object_id end |
Instance Method Details
#send(command_id, payload = String.new) {|rs| ... } ⇒ ActiveRequest
Sends a request to the remote object this instance is bound to.
object.send(10, [1234].pack("L<")) do |rs|
puts "got back: " + rs.assert_ok.payload
end
object.send(10, [1234].pack("L<")).wait_ok
# => #<Twib::TwibConnection::Response>
33 34 35 |
# File 'lib/twib/interface.rb', line 33 def send(command_id, payload=String.new, &block) @connection.send(@device_id, @object_id, command_id, payload, &block) end |