00001 // -*- C++ -*- 00010 #ifndef USBCAMERAMONITOR_H 00011 #define USBCAMERAMONITOR_H 00012 00013 #include <rtm/Manager.h> 00014 #include <rtm/DataFlowComponentBase.h> 00015 #include <rtm/CorbaPort.h> 00016 #include <rtm/DataInPort.h> 00017 #include <rtm/DataOutPort.h> 00018 #include <rtm/idl/BasicDataTypeSkel.h> 00019 #include <rtm/RingBuffer.h> 00020 /* RTM-Win-110 modify 20070315 SEC)T.Shimoji */ 00021 #include <rtm/RTC.h> 00022 00023 #include<cv.h> 00024 #include<cxcore.h> 00025 #include<highgui.h> 00026 00027 // Service implementation headers 00028 // <rtc-template block="service_impl_h"> 00029 00030 // </rtc-template> 00031 00032 // Service Consumer stub headers 00033 // <rtc-template block="consumer_stub_h"> 00034 00035 // </rtc-template> 00036 00037 using namespace RTC; 00038 00039 class USBCameraMonitor 00040 : public RTC::DataFlowComponentBase 00041 { 00042 public: 00043 USBCameraMonitor(RTC::Manager* manager); 00044 ~USBCameraMonitor(); 00045 00046 // The initialize action (on CREATED->ALIVE transition) 00047 // formaer rtc_init_entry() 00048 virtual RTC::ReturnCode_t onInitialize(); 00049 00050 // The finalize action (on ALIVE->END transition) 00051 // formaer rtc_exiting_entry() 00052 // virtual RTC::ReturnCode_t onFinalize(); 00053 00054 // The startup action when ExecutionContext startup 00055 // former rtc_starting_entry() 00056 // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id); 00057 00058 // The shutdown action when ExecutionContext stop 00059 // former rtc_stopping_entry() 00060 // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id); 00061 00062 // The activated action (Active state entry action) 00063 // former rtc_active_entry() 00064 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00065 00066 // The deactivated action (Active state exit action) 00067 // former rtc_active_exit() 00068 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00069 00070 // The execution action that is invoked periodically 00071 // former rtc_active_do() 00072 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00073 00074 // The aborting action when main logic error occurred. 00075 // former rtc_aborting_entry() 00076 // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id); 00077 00078 // The error action in ERROR state 00079 // former rtc_error_do() 00080 // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id); 00081 00082 // The reset action that is invoked resetting 00083 // This is same but different the former rtc_init_entry() 00084 // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id); 00085 00086 // The state update action that is invoked after onExecute() action 00087 // no corresponding operation exists in OpenRTm-aist-0.2.0 00088 // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id); 00089 00090 // The action that is invoked when execution context's rate is changed 00091 // no corresponding operation exists in OpenRTm-aist-0.2.0 00092 // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id); 00093 00094 00095 protected: 00096 // DataInPort declaration 00097 // <rtc-template block="inport_declare"> 00098 TimedOctetSeq m_in; 00099 InPort<TimedOctetSeq> m_inIn; 00100 // </rtc-template> 00101 00102 00103 // DataOutPort declaration 00104 // <rtc-template block="outport_declare"> 00105 00106 // </rtc-template> 00107 00108 // CORBA Port declaration 00109 // <rtc-template block="corbaport_declare"> 00110 00111 // </rtc-template> 00112 00113 // Service declaration 00114 // <rtc-template block="service_declare"> 00115 00116 // </rtc-template> 00117 00118 // Consumer declaration 00119 // <rtc-template block="consumer_declare"> 00120 00121 // </rtc-template> 00122 00123 private: 00124 int dummy; 00125 IplImage* m_img; 00126 int m_img_height; 00127 int m_img_width; 00128 }; 00129 00130 00131 extern "C" 00132 { 00133 DLL_EXPORT void USBCameraMonitorInit(RTC::Manager* manager); 00134 }; 00135 00136 #endif // USBCAMERAMONITOR_H