View Javadoc

1   package cz.cuni.amis.pogamut.usar2004.agent.module.response;
2   
3   import cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.ResponseType;
4   
5   /**
6    * response message recieved after SET {Type Viewports} command
7    *
8    * @author vejmanm
9    */
10  public class Viewport extends SuperResponse
11  {
12      public static final ResponseType type = ResponseType.VIEWPORT;
13  
14      /**
15       * Ctor. Response type describes particular subject about which we want to
16       * know about. It is used to distinguish incoming message from the server.
17       */
18      public Viewport()
19      {
20          super(type);
21      }
22  
23      /**
24       * Describes the current viewport configuration. This parameter will be
25       * either “SingleView” or “QuadView”
26       *
27       * @return Returns configuration of current viewport.
28       */
29      public String getConfig()
30      {
31          return lastMessage.getConfig();
32      }
33  
34      /**
35       * Status of the viewport configuration after the SET command has been
36       * issued. The status will be “OK” when the viewport configuration was
37       * successfully changed. Otherwise, the status will be “Failed”.
38       *
39       * List of statuses is also used when setting cameras. Each value is then
40       * the status for the camera’s field of view after the SET command has been
41       * issued. The status will be “OK” when the camera’s field of view was
42       * successfully changed. Otherwise, the status will be “Failed”.
43       *
44       * When responsing to SET command for sensor or effecter, single value
45       * describing the status of the transaction will be present in the list.
46       *
47       * @return Returns first status.
48       */
49      public String getStatusOne()
50      {
51          if(getStatusSize() > 0)
52          {
53              return lastMessage.getStatuses().get(0);
54          }
55          return null;
56      }
57  
58      /**
59       * Status of the viewport configuration after the SET command has been
60       * issued. The status will be “OK” when the viewport configuration was
61       * successfully changed. Otherwise, the status will be “Failed”.
62       *
63       * List of statuses is also used when setting cameras. Each value is then
64       * the status for the camera’s field of view after the SET command has been
65       * issued. The status will be “OK” when the camera’s field of view was
66       * successfully changed. Otherwise, the status will be “Failed”.
67       *
68       * When responsing to SET command for sensor or effecter, single value
69       * describing the status of the transaction will be present in the list.
70       *
71       * @return Returns second status.
72       */
73      public String getStatusTwo()
74      {
75          if(getStatusSize() > 1)
76          {
77              return lastMessage.getStatuses().get(1);
78          }
79          return null;
80      }
81  
82      /**
83       * Status of the viewport configuration after the SET command has been
84       * issued. The status will be “OK” when the viewport configuration was
85       * successfully changed. Otherwise, the status will be “Failed”.
86       *
87       * List of statuses is also used when setting cameras. Each value is then
88       * the status for the camera’s field of view after the SET command has been
89       * issued. The status will be “OK” when the camera’s field of view was
90       * successfully changed. Otherwise, the status will be “Failed”.
91       *
92       * When responsing to SET command for sensor or effecter, single value
93       * describing the status of the transaction will be present in the list.
94       *
95       * @return Returns third status.
96       */
97      public String getStatusThree()
98      {
99          if(getStatusSize() > 2)
100         {
101             return lastMessage.getStatuses().get(2);
102         }
103         return null;
104     }
105 
106     /**
107      * Status of the viewport configuration after the SET command has been
108      * issued. The status will be “OK” when the viewport configuration was
109      * successfully changed. Otherwise, the status will be “Failed”.
110      *
111      * List of statuses is also used when setting cameras. Each value is then
112      * the status for the camera’s field of view after the SET command has been
113      * issued. The status will be “OK” when the camera’s field of view was
114      * successfully changed. Otherwise, the status will be “Failed”.
115      *
116      * When responsing to SET command for sensor or effecter, single value
117      * describing the status of the transaction will be present in the list.
118      *
119      * @return Returns fourth status.
120      */
121     public String getStatusFour()
122     {
123         if(getStatusSize() > 3)
124         {
125             return lastMessage.getStatuses().get(3);
126         }
127         return null;
128     }
129 
130     /**
131      * Each value is the name of the camera currently attached to viewportN,
132      * where N is 1..4. If viewportN has been disabled, this parameter will be
133      * “Disabled”. If viewportN has been attached to a non- existent camera,
134      * this parameter will be “None”.
135      *
136      * @return Returns first viewport.
137      */
138     public String getViewportOne()
139     {
140         if(getViewportSize() > 0)
141         {
142             return lastMessage.getViewports().get(0);
143         }
144         return null;
145     }
146 
147     /**
148      * Each value is the name of the camera currently attached to viewportN,
149      * where N is 1..4. If viewportN has been disabled, this parameter will be
150      * “Disabled”. If viewportN has been attached to a non- existent camera,
151      * this parameter will be “None”.
152      *
153      * @return Returns second viewport.
154      */
155     public String getViewportTwo()
156     {
157         if(getViewportSize() > 1)
158         {
159             return lastMessage.getViewports().get(1);
160         }
161         return null;
162     }
163 
164     /**
165      * Each value is the name of the camera currently attached to viewportN,
166      * where N is 1..4. If viewportN has been disabled, this parameter will be
167      * “Disabled”. If viewportN has been attached to a non- existent camera,
168      * this parameter will be “None”.
169      *
170      * @return Returns third viewport.
171      */
172     public String getViewportThree()
173     {
174         if(getViewportSize() > 2)
175         {
176             return lastMessage.getViewports().get(2);
177         }
178         return null;
179     }
180 
181     /**
182      * Each value is the name of the camera currently attached to viewportN,
183      * where N is 1..4. If viewportN has been disabled, this parameter will be
184      * “Disabled”. If viewportN has been attached to a non- existent camera,
185      * this parameter will be “None”.
186      *
187      * @return Returns fourth viewport.
188      */
189     public String getViewportFour()
190     {
191         if(getViewportSize() > 3)
192         {
193             return lastMessage.getViewports().get(3);
194         }
195         return null;
196     }
197 
198     /**
199      * Returns the viewport data length.
200      *
201      * @return Returns the viewport data length.
202      */
203     private int getViewportSize()
204     {
205         return lastMessage.getViewports().size();
206     }
207 
208     /**
209      * Returns the viewport status length.
210      *
211      * @return Returns the viewport status length.
212      */
213     private int getStatusSize()
214     {
215         return lastMessage.getStatuses().size();
216     }
217 }