module Syskit::ComBus
Module that represents the communication busses in the task models. It defines the methods that are available on task instances. For methods that are added to the task models, see ComBus::ClassExtension
Public Instance Methods
Attaches the given task to the communication bus
# File lib/syskit/data_service.rb, line 185 def attach(task) model.each_com_bus_driver_service do |combus_srv| combus_m = combus_srv.model # Do we have a device for this bus ? next if !(combus = find_device_attached_to(combus_srv)) task.each_master_device do |dev| next if !dev.attached_to?(combus) client_in_srv = dev.combus_client_in_srv client_out_srv = dev.combus_client_out_srv if !combus_m.lazy_dispatch? if !(bus_srv = find_data_service(dev.name)) raise ArgumentError, "combus task #{self} was expected to have a service named #{dev.name} to connect to the device of the same name, but has none" end else bus_srv = combus.require_dynamic_service_for_device(self, dev) end if dev.client_to_bus? client_out_srv.bind(task).connect_to bus_srv end if dev.bus_to_client? bus_srv.connect_to client_in_srv.bind(task) end end end end
Enumerates all the devices that are attached to this communication bus for which a corresponding {Syskit::Component} instance has been attached to self using {attach}
@yieldparam device [DeviceInstance] a device that is using self as
a communication bus
@see #each_declared_attached_device
# File lib/syskit/data_service.rb, line 175 def each_attached_device return enum_for(:each_attached_device) if !block_given? each_declared_attached_device do |dev| if find_data_service(dev.name) yield(dev) end end end
Enumerates the communication busses this task is a driver for
@yieldparam [Robot::ComBus] the communication bus device @yieldreturn [void] @return [void]
# File lib/syskit/data_service.rb, line 144 def each_com_bus_device return enum_for(:each_com_bus_device) if !block_given? each_master_device do |device| yield(device) if device.kind_of?(Robot::ComBus) end end
Enumerates all the devices that are attached to the underlying communication busses, regardless of whether a corresponding {Syskit::Component} instance has been associated with self using {attach}
@yieldparam device [DeviceInstance] a device that is using self as
a communication bus
# File lib/syskit/data_service.rb, line 159 def each_declared_attached_device return enum_for(:each_declared_attached_device) if !block_given? each_com_bus_device do |combus| combus.each_attached_device do |dev| yield(dev) end end end