diff options
author | Henri Herscher <henri@oreka.org> | 2006-06-30 19:39:27 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2006-06-30 19:39:27 +0000 |
commit | 868a99733ddb6a44f660f4aab9089fd619f38cfa (patch) | |
tree | 487309e2706b8389bc8985283c5d29334343bf7e /orkbasecxx/messages/CaptureMsg.cpp | |
parent | 3868172df25ae59bd0ecc524b782ac4734812891 (diff) |
Moved more stuff to orkbasecxx
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@287 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/messages/CaptureMsg.cpp')
-rw-r--r-- | orkbasecxx/messages/CaptureMsg.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/orkbasecxx/messages/CaptureMsg.cpp b/orkbasecxx/messages/CaptureMsg.cpp new file mode 100644 index 0000000..f013e1f --- /dev/null +++ b/orkbasecxx/messages/CaptureMsg.cpp @@ -0,0 +1,84 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "Utils.h" +#include "CaptureMsg.h" +//#include "LogManager.h" +#include "CapturePluginProxy.h" + +#define CAPTURE_CLASS "capture" +#define CAPTURE_RESPONSE_CLASS "captureresponse" +#define CAPTURE_STATE_PARAM "state" +#define COMMENT_PARAM "comment" + +void CaptureResponseMsg::Define(Serializer* s) +{ + s->BoolValue(SUCCESS_PARAM, m_success); + s->StringValue(COMMENT_PARAM, m_comment); +} + +CStdString CaptureResponseMsg::GetClassName() +{ + return CStdString(CAPTURE_RESPONSE_CLASS); +} + +ObjectRef CaptureResponseMsg::NewInstance() +{ + return ObjectRef(new CaptureResponseMsg); +} + +//=============================== + +void CaptureMsg::Define(Serializer* s) +{ + CStdString captureClass(CAPTURE_CLASS); + s->StringValue(OBJECT_TYPE_TAG, captureClass, true); + s->StringValue(CAPTURE_PORT_PARAM, m_capturePort, true); + s->EnumValue(CAPTURE_STATE_PARAM, (int&)m_eventType, CaptureEvent::EventTypeToEnum, CaptureEvent::EventTypeToString, true); +} + + +CStdString CaptureMsg::GetClassName() +{ + return CStdString(CAPTURE_CLASS); +} + +ObjectRef CaptureMsg::NewInstance() +{ + return ObjectRef(new CaptureMsg); +} + +ObjectRef CaptureMsg::Process() +{ + CaptureResponseMsg* msg = new CaptureResponseMsg; + ObjectRef ref(msg); + + if(m_eventType == CaptureEvent::EtStart) + { + CapturePluginProxySingleton::instance()->StartCapture(m_capturePort); + msg->m_success = true; + } + else if(m_eventType == CaptureEvent::EtStop) + { + CapturePluginProxySingleton::instance()->StopCapture(m_capturePort); + msg->m_success = true; + } + else + { + msg->m_success = false; + msg->m_comment = CAPTURE_STATE_PARAM; + msg->m_comment += " needs to be start or stop"; + } + return ref; +} + |