My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
control.h
1 #ifndef control_h
2 #define control_h
3 
4 #include "gcp/control/code/unix/libunix_src/common/netobj.h"
5 #include "gcp/util/common/Ports.h"
6 
7 namespace gcp {
8  namespace control {
9 
10  /*-----------------------------------------------------------------------
11  * Define the ids of client -> control-program commands along with
12  * the corresponding local command containers.
13  */
14  typedef enum {
15  CC_INPUT_CMD /* A command line typed by the user */
16  } CcNetCmdId;
17 
18  /*
19  * The CC_TEXT_LINE command conveys a single text command line to the
20  * control program.
21  */
22 
23  enum {CC_CMD_MAX=255}; /* The max size of a command string (excluding '\0') */
24 
25  typedef struct {
26  char cmd[CC_CMD_MAX+1]; /* The ascii command string (including '\0') */
27  } CcInputCmd;
28 
29  /*
30  * Create a union of the above message containers.
31  */
32  typedef union {
33  CcInputCmd input; /* A command line to be compiled and executed */
34  } CcNetCmd;
35  }
36 }
37 /*
38  * The following network-object description table, defined in control.c,
39  * describes the above commands.
40  */
41 extern const NetObjTable cc_cmd_table;
42 
43 namespace gcp {
44  namespace control {
45 
46 
47  typedef enum {
48  UPRIGHT, // A positive increment on the image is a positive
49  // increment on the sky
50  INVERTED // A positivce increment on the image is a
51  // negative increment on the sky
52  } ImDir;
53 
54  typedef enum {
55  CW, // Angle increases in the clockwise direction
56  CCW // Angle increases in the counter-clockwise direction
57  } RotationSense;
58 
59 
60  /*-----------------------------------------------------------------------
61  * Define the types of messages that are sent to control clients by the
62  * control program.
63  */
64  typedef enum {
65  CC_LOG_MSG, /* A log message to be displayed */
66  CC_REPLY_MSG, /* A reply to a CC_INPUT_CMD command line */
67  CC_SCHED_MSG, /* A message regarding the state of the scheduler */
68  CC_ARC_MSG, /* A message regarding the state of the archiver */
69  CC_PAGE_MSG, /* A message regarding the pager status */
70  CC_ANT_MSG, /* A message regarding the state of the default
71  antenna selection */
72  CC_GRABBER_MSG, /* A message regarding the grabber status */
73  CC_PAGECOND_MSG, /* A message regarding the pager status */
74  CC_CMD_TIMEOUT_MSG
75  } CcNetMsgId;
76 
77  /*
78  * The following interface is for use in sending and receiving messages
79  * sent from the control program to control clients.
80  */
81  enum {CC_MSG_MAX=131}; /* The max length of a message string (excluding '\0') */
82 
83  /*
84  * Define a log message object.
85  */
86  typedef struct {
87  unsigned seq;
88  NetBool end;
89  NetBool error; /* True if the text is an error message */
90  NetBool interactive; /* True if the text was the result of an interactive message */
91  char text[CC_MSG_MAX+1]; /* The ascii message string (including '\0') */
92  } CcLogMsg;
93 
94  /*
95  * Define a reply message object.
96  */
97  typedef struct {
98  NetBool error; /* True if the text is an error message */
99  char text[CC_MSG_MAX+1]; /* The ascii message string (including '\0') */
100  } CcReplyMsg;
101 
102  /*
103  * Define a message for reporting changes in the state of the
104  * schedule queue.
105  */
106  typedef struct {
107  char text[CC_MSG_MAX+1]; /* The status message */
108  } CcSchedMsg;
109 
110  /*
111  * Define a message for reporting changes in the state of the
112  * archiver.
113  */
114  typedef struct {
115  char text[CC_MSG_MAX+1]; /* The status message */
116  } CcArcMsg;
117 
118  enum {
119  PAGE_ENABLE = 0x1, // Set if this is an ordinary page
120  // enable/disable message
121  PAGE_REG = 0x2, // Set if this is page enable/disable message
122  // was sent because the pager was activated
123  PAGE_MSG = 0x4, // Set if this is page enable/disable message
124  // was sent because of some other reason
125  };
126 
127  /*
128  * Define a message for reporting changes in the state of the
129  * pager
130  */
131  typedef struct {
132  char text[CC_MSG_MAX+1]; /* The status message */
133  NetEnum mask;
134  NetBool allow;
135  } CcPageMsg;
136 
137  /*
138  * Define a message for reporting changes in the state of the
139  * default antenna selection
140  */
141  typedef struct {
142  char text[CC_MSG_MAX+1]; /* The status message */
143  } CcAntMsg;
144 
148  typedef enum {
149  CFG_NONE = 0x0,
150  CFG_CHANNEL = 0x1,
151  CFG_COMBINE = 0x2,
152  CFG_FLATFIELD = 0x4,
153  CFG_FOV = 0x8,
154  CFG_ASPECT = 0x10,
155  CFG_COLLIMATION = 0x20,
156  CFG_XIMDIR = 0x40,
157  CFG_YIMDIR = 0x80,
158  CFG_DKROTSENSE = 0x100,
159  CFG_PEAK_OFFSETS = 0x200,
160  CFG_CHAN_ASSIGN = 0x400,
161  CFG_ADD_SEARCH_BOX = 0x800,
162  CFG_REM_SEARCH_BOX = 0x1000,
163  CFG_REM_ALL_SEARCH_BOX = 0x2000,
164 
165  CFG_ALL = CFG_CHANNEL | CFG_COMBINE | CFG_FLATFIELD | CFG_FOV | CFG_ASPECT | CFG_COLLIMATION | CFG_XIMDIR | CFG_YIMDIR | CFG_DKROTSENSE | CFG_PEAK_OFFSETS | CFG_CHAN_ASSIGN | CFG_ADD_SEARCH_BOX
166  } CcFrameGrabberOpt;
167 
168  typedef struct {
169  NetEnum mask; // The mask of parameters to configure
170  unsigned channelMask; // The channel number to selec
171  unsigned nCombine; // The number of frames to combine
172  unsigned flatfield; // The current flatfield option
173  double fov; // The current field of view
174  double aspect; // The current aspect ratio
175  double collimation; // The current aspect ratio
176  ImDir ximdir; // The orientation of the x-axis
177  ImDir yimdir; // The orientation of the y-axis
178  RotationSense dkRotSense; // The sense of the deck rotation
179  unsigned ipeak;
180  unsigned jpeak;
181  unsigned ptelMask;
182  unsigned ixmin;
183  unsigned ixmax;
184  unsigned iymin;
185  unsigned iymax;
186  bool inc;
188 
189  /*
190  * Define a message for reporting changes in the state of the
191  * archiver.
192  */
193  typedef struct {
194  unsigned mode;
195  double min;
196  double max;
197  bool isDelta;
198  bool isOutOfRange;
199  unsigned nFrame;
200  char text[CC_MSG_MAX+1]; /* The status message */
201  } CcPageCondMsg;
202 
203  enum PageCondMode {
204  PAGECOND_ADD,
205  PAGECOND_REMOVE,
206  PAGECOND_CLEAR,
207  PAGECOND_UPDATE,
208  };
209 
210  /*
211  * Define a message for reporting changes in the state of the
212  * timeout pager
213  */
214  typedef struct {
215  unsigned mode;
216  unsigned seconds;
217  bool active;
218  } CcCmdTimeoutMsg;
219 
220  enum CmdTimeoutMode {
221  CT_CMD_ACTIVE,
222  CT_CMD_TIMEOUT,
223  CT_DATA_ACTIVE,
224  CT_DATA_TIMEOUT,
225  };
226 
227  /*
228  * Define a union of all control-program -> control-client message types.
229  */
230  typedef union {
231  CcLogMsg log; /* A CC_LOG_MSG message */
232  CcReplyMsg reply; /* A CC_REPLY_MSG message */
233  CcSchedMsg sched; /* A CC_SCHED_MSG message */
234  CcArcMsg arc; /* A CC_ARC_MSG message */
235  CcPageMsg page; /* A CC_PAGE_MSG message */
236  CcAntMsg ant; /* A CC_ANT_MSG message */
237  CcFrameGrabberMsg grabber;/* A CC_GRABBER_MSG message */
238  CcPageCondMsg pageCond; /* A CC_PAGECOND_MSG message */
239  CcCmdTimeoutMsg cmdTimeout; // A command timeout message
240  } CcNetMsg;
241  }
242 }
243 /*
244  * The following network-object description table, defined in control.c,
245  * describes the messages that are sent from the control program to
246  * control clients.
247  */
248 extern const NetObjTable cc_msg_table;
249 
250 #endif
Definition: control.h:230
Definition: control.h:114
Definition: control.h:193
Definition: control.h:214
Definition: control.h:141
Definition: netobj.h:69
Definition: control.h:131
Definition: control.h:106
Definition: control.h:32
Definition: control.h:97
Definition: control.h:86
Definition: control.h:25
Definition: control.h:168