summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tutorials/Shapes/Tutorial/idl.html
blob: fbad4397a4670937295c673285fe2631b82b879c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!--//$Id$  -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>DDS4CCM Tutorial Shapes - IDL</title>
</head>

<body>
  <table width="100%" border="0">
    <tr>
      <td align="left"><a href="./general.html">Previous<a></td>
      <td align="center"><img width="4%" height="5%" src="./images/images.png"/></td>
      <td align="right"><a href="./executors.html">Next</a></td>
    </tr>
  </table>
  <hr />

  <h1>IDL files</h1>
  <p>
    The IDL files are generated by the modeling tools.<br/>
    To understand this shapes tutorial better, it'll give an overview of
    which IDL files are generated.
  </p>

  <h2>Common IDL files</h2>
  <p>
    Below an simplied represenation of the common IDL files. Use the links to view
    the file itself.<br/>
    The following IDL files can be found in Shapes_asm/ports:
    <ul>
      <li><a href="../Shapes_asm/ports/Shapes_defn.idl">Shapes_defn.idl<a><br/>
          <code><b>module</b> Shapes<br/>
            {<br/>
            &nbsp;&nbsp;<b>enum</b> ReturnStatus<br/>
            &nbsp;&nbsp;{<br/>
            &nbsp;&nbsp;&nbsp;&nbsp;RETURN_OK,<br/>
            &nbsp;&nbsp;&nbsp;&nbsp;RETURN_ERROR<br/>
            &nbsp;&nbsp;};<br/>};
          </code>
      </li>
      <li><a href="../Shapes_asm/ports/Shapes_conn.idl">Shapes_conn.idl<a><br/>
          <code><b>module</b> Shapes<br/>
            {<br/>
            &nbsp;&nbsp;<b>typedef</b> <b>sequence</b><ShapeType> ShapeTypeSeq;<br/>
            &nbsp;&nbsp;<b>module</b> ::CCM_DDS::Typed < ::ShapeType, ShapeTypeSeq>
            ShapesConnector;<br/>
            };<br/>
          </code>
          This IDL contains the declaration of the DDS4CCM connector. The used
          module is typed.
      </li>
      <li><a href="../Shapes_asm/ports/Shapes_msg.idl">Shapes_msg.idl<a><br/>
          <code><b>struct</b> ShapeType {<br/>
            &nbsp;&nbsp;<font color="red">string</font> color; <font color="grey">//@key</font><br/>
            &nbsp;&nbsp;<font color="red">long</font> x;<br/>
            &nbsp;&nbsp;<font color="red">long</font> y;<br/>
            &nbsp;&nbsp;<font color="red">long</font> shapesize;<br/>
            };<br/>
          </code>
          The ShapeType struct is the the data structure that is send from the
          sender to the receiver through DDS.<br/>
          This file is also used as input for the RTI DDS generator. Since we're
          using RTI DDS in this example, the key of this struct is defined with
          <code>//@key</code> as shown above.
      </li>
    </ul>
  </p>

  <h2>Controller IDL files</h2>
  <p>
    The controller is used to modify the location and the size of the registered
    shape. The controller invokes methods on the sender component to establish this.
    These methods are part of an interface which the sender should provide. The
    controller uses this interface.<br/>
    The interface declaration is in
    <a href="../Shapes_asm/Shapes_Control_comp/ports/Shapes_Control_obj.idl">
      Shapes_asm/Shapes_Control_comp/ports/Shapes_Control_obj.idl<a><br/>
    The IDL looks like this:
  </p>
  <p>
    <br/><code><b>module</b> Shapes<br/>
    {<br/>
    &nbsp;&nbsp;<b>interface</b> Control_obj<br/>
    &nbsp;&nbsp;{<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;ReturnStatus setSize (<b>in unsigned</b> <font color="red">short</font> size);<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;ReturnStatus setLocation (<b>in unsigned</b> <font color="red">short</font> x,<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>in unsigned</b> <font color="red">short</font> y);<br/>
    &nbsp;&nbsp;};<br/>
    };<br/>
    </code><br/>
    The controller component periodically calls the setSize and setLocation methods
    on the sender component.
  </p>
  <p>
    The component IDL file itself is located in
    <a href="../Shapes_asm/Shapes_Control_comp/src/Shapes_Control_comp.idl">
      Shapes_asm/Shapes_Control_comp/src/Shapes_Control_comp.idl<a><br/>
    and looks like this:
  </p>
  <p>
    <br/><code><b>module</b> Shapes<br/>
    {<br/>
    &nbsp;&nbsp;<b>component</b> Control_comp<br/>
    &nbsp;&nbsp;{<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>uses</b> Shapes::Control_obj control;<br/><br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>attribute unsigned</b> <font color="red">long</font> rate;<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>attribute unsigned</b> <font color="red">short</font> max_x;<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>attribute unsigned</b> <font color="red">short</font> max_y;<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>attribute unsigned</b> <font color="red">short</font> max_size;<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>attribute</b> <font color="red">boolean</font> resize_shape;<br/>
    &nbsp;&nbsp;};<br/>};<br/>
    </code>
  </p>
  <p>
    The controller uses the Control_obj interface.
  </p>
  <p>
    The following attributes are used:
    <ul>
      <li>rate&nbsp;&nbsp;: Controls the rate in which the controller component
          sends update to the sender.
      </li>
      <li>Since the shapes moves about in a rectangle shaped window, one should
        set the boundaries of this rectangle:
        <ul>
          <li>max_x&nbsp;&nbsp;: Sets the width of the rectangle shaped window.</li>
          <li>max_y&nbsp;&nbsp;: Sets the height of the rectangle shaped window.</li>
        </ul>
      </li>
      <li>max_size&nbsp;&nbsp;: Set the maximum size of the registered shape.
      </li>
      <li>resize_shape&nbsp;&nbsp;: Indicates wether the shape is resizeable.
      </li>
    </ul>
    The attributes are set by the deployment plan and cannot be changed throughout
    the lifecycle of the controller component.
  </p>

  <h2>Sender IDL file</h2>
  <p>
    The moment the controller invokes setSize or setLocation, the sender translates
    the received size and location into the ShapeType struct. After that, it'll
    present the updated struct to DDS, by calling write_one on the DDS_Write port.
    The IDL file of the Sender component looks like this:<br/>
    <br/><code><b>module</b> Shapes<br/>
    {<br/>
    &nbsp;&nbsp;<b>component</b> Sender_comp<br/>
    &nbsp;&nbsp;{<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>port</b> ShapesConnector::DDS_Write info_write;<br/>
    &nbsp;&nbsp;&nbsp;&nbsp;<b>provides</b> Shapes::Control_obj control;<br/>
    &nbsp;&nbsp;};<br/>};
    </code><br/><br/>
    The IDL file is located in
    <a href="../Shapes_asm/Shapes_Sender_comp/src/Shapes_Sender_comp.idl">
      Shapes_asm/Shapes_Sender_comp/src/Shapes_Sender_comp.idl<a><br/>
  </p>
  <p>
    The Sender uses the DDS_Write port of the DDS4CCM connector. This means that
    the Sender is able to write data to DDS.<br/>
    The Sender provides the Control_obj interface to the Controller component. This
    means that the sender component implements the Control_obj interface so that the
    controller is able to invoke the provided methods.
  </p>

  <h2>Receiver IDL file</h2>
  <p>
    The receiver is &quot;listening&quot; to DDS. Once the shape has been
    updated by the sender, DDS will invoke a callback method on the DDS4CCM connector
    which in turn calls the receiver component and will pass the updated data to
    the receiver.<br/>
    The receiver should provide the DDS4CCM connector with an interface which the
    DDS4CCM connector should invoke the moment he gets a callback from DDS.
    To establish this, the receiver component IDL should look like this:<br/>
    <br/>
    <code><b>module</b> Shapes<br/>
      {<br/>
      &nbsp;&nbsp;component Receiver_comp<br/>
      &nbsp;&nbsp;{<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;<b>port</b> ShapesConnector::DDS_Listen info_out;<br/>
      &nbsp;&nbsp;};<br/>};<br/>
    </code>
  </p>

  <hr />
  <table width="100%" border="0">
    <tr>
      <td align="left"><a href="./general.html">Previous<a></td>
      <td align="center"><img width="4%" height="5%" src="./images/images.png"/></td>
      <td align="right"><a href="./executors.html">Next</a></td>
    </tr>
  </table>
</body>