From 868a99733ddb6a44f660f4aab9089fd619f38cfa Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Fri, 30 Jun 2006 19:39:27 +0000 Subject: Moved more stuff to orkbasecxx git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@287 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkbasecxx/messages/CaptureMsg.cpp | 84 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 orkbasecxx/messages/CaptureMsg.cpp (limited to 'orkbasecxx/messages/CaptureMsg.cpp') 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; +} + -- cgit v1.2.3