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    * After a SET {Type ResponseCamera} command, follwing response message will be
7    * issued
8    *
9    * @author vejmanm
10   */
11  public class ResponseCamera extends SuperResponse
12  {
13      public static final ResponseType type = ResponseType.CAMERA;
14  
15      /**
16       * Ctor. Response type describes particular subject about which we want to
17       * know about. It is used to distinguish incoming message from the server.
18       */
19      public ResponseCamera()
20      {
21          super(type);
22      }
23  
24      /**
25       * Name of the camera that will be described by the next two parameters: FOV
26       * and Status.
27       *
28       * @param index
29       * @return Returns name of camera at given index.
30       */
31      public String getNameAt(int index)
32      {
33          if(index < getSize())
34          {
35              return lastMessage.getNames().get(index);
36          }
37          return null;
38      }
39  
40      /**
41       * Each value is the current field of view of the camera being described, in
42       * radians. The current field of view is the field of view after a SET {Type
43       * Camera} has been issued.
44       *
45       * @param index
46       * @return Returns field of view of camera at given index.
47       */
48      public String getFOVAt(int index)
49      {
50          //TODO - is it necessary to get it as a string?!
51          if(index < getSize())
52          {
53              return lastMessage.getFOVs().get(index);
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       * @param index
72       * @return Returns status result at given index.
73       */
74      public String getStatusAt(int index)
75      {
76          if(index < getSize())
77          {
78              return lastMessage.getStatuses().get(index);
79          }
80          return null;
81      }
82  
83      /**
84       * Returns size of names list - size of FOVs and Statuses should be the
85       * same.
86       *
87       * @return Returns size of names list.
88       */
89      public int getSize()
90      {
91          return lastMessage.getNames().size();
92      }
93  }