00001 // -*- C++ -*- 00010 #ifndef JOYSTICK_H 00011 #define JOYSTICK_H 00012 00013 #include <rtm/idl/BasicDataType.hh> 00014 #include <rtm/idl/ExtendedDataTypes.hh> 00015 #include <rtm/idl/InterfaceDataTypes.hh> 00016 #include <rtm/Manager.h> 00017 #include <rtm/DataFlowComponentBase.h> 00018 #include <rtm/CorbaPort.h> 00019 #include <rtm/DataInPort.h> 00020 #include <rtm/DataOutPort.h> 00021 #include <rtm/idl/BasicDataTypeSkel.h> 00022 #include <rtm/idl/ExtendedDataTypesSkel.h> 00023 #include <rtm/idl/InterfaceDataTypesSkel.h> 00024 00025 // Service implementation headers 00026 // <rtc-template block="service_impl_h"> 00027 00028 // </rtc-template> 00029 00030 // Service Consumer stub headers 00031 // <rtc-template block="consumer_stub_h"> 00032 00033 // </rtc-template> 00034 00035 class joystick; 00036 00037 using namespace RTC; 00038 00044 class Joystick 00045 : public RTC::DataFlowComponentBase 00046 { 00047 public: 00052 Joystick(RTC::Manager* manager); 00053 00057 virtual ~Joystick(); 00058 00059 // <rtc-template block="public_attribute"> 00060 00061 // </rtc-template> 00062 00063 // <rtc-template block="public_operation"> 00064 00065 // </rtc-template> 00066 00067 /*** 00068 * 00069 * The initialize action (on CREATED->ALIVE transition) 00070 * formaer rtc_init_entry() 00071 * 00072 * @return RTC::ReturnCode_t 00073 * 00074 * 00075 */ 00076 virtual RTC::ReturnCode_t onInitialize(); 00077 00078 /*** 00079 * 00080 * The finalize action (on ALIVE->END transition) 00081 * formaer rtc_exiting_entry() 00082 * 00083 * @return RTC::ReturnCode_t 00084 * 00085 * 00086 */ 00087 // virtual RTC::ReturnCode_t onFinalize(); 00088 00089 /*** 00090 * 00091 * The startup action when ExecutionContext startup 00092 * former rtc_starting_entry() 00093 * 00094 * @param ec_id target ExecutionContext Id 00095 * 00096 * @return RTC::ReturnCode_t 00097 * 00098 * 00099 */ 00100 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00101 00102 /*** 00103 * 00104 * The shutdown action when ExecutionContext stop 00105 * former rtc_stopping_entry() 00106 * 00107 * @param ec_id target ExecutionContext Id 00108 * 00109 * @return RTC::ReturnCode_t 00110 * 00111 * 00112 */ 00113 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00114 00115 /*** 00116 * 00117 * The activated action (Active state entry action) 00118 * former rtc_active_entry() 00119 * 00120 * @param ec_id target ExecutionContext Id 00121 * 00122 * @return RTC::ReturnCode_t 00123 * 00124 * 00125 */ 00126 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00127 00128 /*** 00129 * 00130 * The deactivated action (Active state exit action) 00131 * former rtc_active_exit() 00132 * 00133 * @param ec_id target ExecutionContext Id 00134 * 00135 * @return RTC::ReturnCode_t 00136 * 00137 * 00138 */ 00139 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00140 00141 /*** 00142 * 00143 * The execution action that is invoked periodically 00144 * former rtc_active_do() 00145 * 00146 * @param ec_id target ExecutionContext Id 00147 * 00148 * @return RTC::ReturnCode_t 00149 * 00150 * 00151 */ 00152 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00153 00154 /*** 00155 * 00156 * The aborting action when main logic error occurred. 00157 * former rtc_aborting_entry() 00158 * 00159 * @param ec_id target ExecutionContext Id 00160 * 00161 * @return RTC::ReturnCode_t 00162 * 00163 * 00164 */ 00165 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00166 00167 /*** 00168 * 00169 * The error action in ERROR state 00170 * former rtc_error_do() 00171 * 00172 * @param ec_id target ExecutionContext Id 00173 * 00174 * @return RTC::ReturnCode_t 00175 * 00176 * 00177 */ 00178 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00179 00180 /*** 00181 * 00182 * The reset action that is invoked resetting 00183 * This is same but different the former rtc_init_entry() 00184 * 00185 * @param ec_id target ExecutionContext Id 00186 * 00187 * @return RTC::ReturnCode_t 00188 * 00189 * 00190 */ 00191 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00192 00193 /*** 00194 * 00195 * The state update action that is invoked after onExecute() action 00196 * no corresponding operation exists in OpenRTm-aist-0.2.0 00197 * 00198 * @param ec_id target ExecutionContext Id 00199 * 00200 * @return RTC::ReturnCode_t 00201 * 00202 * 00203 */ 00204 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00205 00206 /*** 00207 * 00208 * The action that is invoked when execution context's rate is changed 00209 * no corresponding operation exists in OpenRTm-aist-0.2.0 00210 * 00211 * @param ec_id target ExecutionContext Id 00212 * 00213 * @return RTC::ReturnCode_t 00214 * 00215 * 00216 */ 00217 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00218 00219 00220 protected: 00221 // <rtc-template block="protected_attribute"> 00222 00223 // </rtc-template> 00224 00225 // <rtc-template block="protected_operation"> 00226 00227 // </rtc-template> 00228 00229 // DataInPort declaration 00230 // <rtc-template block="inport_declare"> 00231 00232 // </rtc-template> 00233 00234 00235 // DataOutPort declaration 00236 // <rtc-template block="outport_declare"> 00237 TimedFloatSeq m_axes; 00245 OutPort<TimedFloatSeq> m_axesOut; 00246 TimedBooleanSeq m_buttons; 00253 OutPort<TimedBooleanSeq> m_buttonsOut; 00254 00255 // </rtc-template> 00256 00257 // CORBA Port declaration 00258 // <rtc-template block="corbaport_declare"> 00259 00260 // </rtc-template> 00261 00262 // Service declaration 00263 // <rtc-template block="service_declare"> 00264 00265 // </rtc-template> 00266 00267 // Consumer declaration 00268 // <rtc-template block="consumer_declare"> 00269 00270 // </rtc-template> 00271 00272 private: 00273 // <rtc-template block="private_attribute"> 00274 00275 // </rtc-template> 00276 00277 // <rtc-template block="private_operation"> 00278 00279 // </rtc-template> 00280 00281 joystick *m_js; 00282 std::string m_device; 00283 unsigned int m_debugLevel; 00284 }; 00285 00286 00287 extern "C" 00288 { 00289 DLL_EXPORT void JoystickInit(RTC::Manager* manager); 00290 }; 00291 00292 #endif // JOYSTICK_H