CARMA C++
AntennaControlMsg.h
Go to the documentation of this file.
1 #ifndef SZA_ANTENNA_ANTENNACONTROLMSG_H
2 #define SZA_ANTENNA_ANTENNACONTROLMSG_H
3 
13 #include "carma/szautil/NetMsg.h"
14 
15 namespace sza {
16  namespace antenna {
17  namespace control {
18 
19  class AntennaControlMsg :
21 
22  public:
23 
27  enum MsgType {
28  CONNECT, // Attempt to connect to the control host.
29  NETMSG, // A network message intended for the controller.
30  WRITE_CARMA_SEQ_NO, // Message to write a carma sequence number
31  WRITE_CARMA_MONITORS, // Message to write carma monitor points
32  };
33 
37  MsgType type;
38 
39  union {
40  sza::util::NetMsg networkMsg;
41 
42  struct {
43  unsigned long seq_;
44  CarmaSeqNoType type_;
45  bool success_;
46  } carmaSeqNo;
47 
48  } body;
49 
53  inline sza::util::NetMsg* getNetMsg()
54  {
56  sza::util::GenericTaskMsg::TASK_SPECIFIC;
57 
58  type = NETMSG;
59  return &body.networkMsg;
60  }
61 
62  //------------------------------------------------------------
63  // Methods for packing message to the communications task.
64  //
65  // We explicitly initialize genericMsgType_ in each method,
66  // since we cannot do this in a constructor, since objects
67  // with explicit constructors apparently can't be union
68  // members.
69  //------------------------------------------------------------
70 
74  inline void packConnectMsg() {
76  sza::util::GenericTaskMsg::TASK_SPECIFIC;
77 
78  type = CONNECT;
79  }
80 
81  inline void packCarmaSeqNoMsg(unsigned long seq,
82  CarmaSeqNoType carmaType, bool success) {
84  sza::util::GenericTaskMsg::TASK_SPECIFIC;
85 
86  body.carmaSeqNo.seq_ = seq;
87  body.carmaSeqNo.type_ = carmaType;
88  body.carmaSeqNo.success_ = success;
89 
90  type = WRITE_CARMA_SEQ_NO;
91  }
92 
93  inline void packWriteCarmaMonitorsMsg() {
95  sza::util::GenericTaskMsg::TASK_SPECIFIC;
96 
97  type = WRITE_CARMA_MONITORS;
98  }
99 
100  private:
101  }; // End class AntennaControlMsg
102 
103  }; // End namespace control
104  }; // End namespace antenna
105 }; // End namespace sza
106 
107 #endif // End #ifndef
108 
109 
Tagged: Mon Mar 15 15:29:07 UTC 2004.
Tagged: Fri Nov 14 12:39:34 UTC 2003.
GenericMsgType genericMsgType_
A type for this message.
A class to encapsulate message types for a generic task.
Tagged: Fri Nov 14 12:39:33 UTC 2003.