# This module is used in TC_GenerationDeployment#test_data_driven_deployment in # test_deployment.rb. # # This module demonstrates the definition and deployment of port-driven tasks. name 'data'

# This consumer component will be driven by one of its input ports only. It # writes a file in which the data it received is written, using 'U' if it has # been triggered by an unknown port (i.e. not triggered by its 'input' port). task_context 'Consumer' do

input_port 'input', 'double'
input_port 'input2', 'int'

# Don't get triggered by 'Input2'
port_driven 'input'

end

# This producer component writes alternatively on both its ports, and exits # using exit(0) after 10 cycles. It is used in the following static deployment # to test the port-driven behaviour. task_context 'Producer' do

output_port 'output', 'double'
output_port 'output2', 'int'

end

deployment “data” do

enable_corba
consumer = task("consumer", 'Consumer').
    triggered.
    start
producer = task("producer", 'Producer').
    periodic(0.1).
    start

connect producer.output,  consumer.input, :type => :buffer, :size => 2
connect producer.output2, consumer.input2, :type => :buffer, :size => 2

end