summaryrefslogtreecommitdiff
path: root/orkbasecxx/messages/RecordMsg.cpp
blob: 6b5688f1fba64da9b52cc9bafa9e66788a49b056 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * 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 "RecordMsg.h"
#include "messages/AsyncMessage.h"
#include "CapturePluginProxy.h"

#define RECORD_CLASS "record"
#define PAUSE_CLASS "pause"
#define STOP_CLASS "stop"

void PauseMsg::Define(Serializer* s)
{
	CStdString pauseClass(PAUSE_CLASS);
	s->StringValue(OBJECT_TYPE_TAG, pauseClass, true);
	s->StringValue(PARTY_PARAM, m_party, false);
	s->StringValue(ORKUID_PARAM, m_orkuid, false);
	s->StringValue(NATIVE_CALLID_PARAM, m_nativecallid, false);
}

CStdString PauseMsg::GetClassName()
{
	return  CStdString(PAUSE_CLASS);
}

ObjectRef PauseMsg::NewInstance()
{
	return ObjectRef(new PauseMsg);
}

ObjectRef PauseMsg::Process()
{
	SimpleResponseMsg* msg = new SimpleResponseMsg;
	ObjectRef ref(msg);
	CStdString logMsg;

	CapturePluginProxy::Singleton()->PauseCapture(m_party, m_orkuid, m_nativecallid);
	logMsg.Format("Pausing capture for party:%s orkuid:%s nativecallid:%s", m_party, m_orkuid, m_nativecallid);
	msg->m_success = true;
	msg->m_comment = logMsg;

	return ref;
}

//===================================================

void StopMsg::Define(Serializer* s)
{
	CStdString stopClass(STOP_CLASS);
	s->StringValue(OBJECT_TYPE_TAG, stopClass, true);
	s->StringValue(PARTY_PARAM, m_party, false);
	s->StringValue(ORKUID_PARAM, m_orkuid, false);
	s->StringValue(NATIVE_CALLID_PARAM, m_nativecallid, false);
}

CStdString StopMsg::GetClassName()
{
	return  CStdString(STOP_CLASS);
}

ObjectRef StopMsg::NewInstance()
{
	return ObjectRef(new StopMsg);
}

ObjectRef StopMsg::Process()
{
	SimpleResponseMsg* msg = new SimpleResponseMsg;
	ObjectRef ref(msg);
	CStdString logMsg;

	CapturePluginProxy::Singleton()->StopCapture(m_party, m_orkuid, m_nativecallid);
	logMsg.Format("Stopping capture for party:%s orkuid:%s nativecallid:%s", m_party, m_orkuid, m_nativecallid);
	msg->m_success = true;
	msg->m_comment = logMsg;

	return ref;
}

//===================================================

void RecordMsg::Define(Serializer* s)
{
	CStdString recordClass(RECORD_CLASS);
	s->StringValue(OBJECT_TYPE_TAG, recordClass, true);
	s->StringValue(PARTY_PARAM, m_party, false);
	s->StringValue(ORKUID_PARAM, m_orkuid, false);
	s->StringValue(NATIVE_CALLID_PARAM, m_nativecallid, false);
}

CStdString RecordMsg::GetClassName()
{
	return  CStdString(RECORD_CLASS);
}

ObjectRef RecordMsg::NewInstance()
{
	return ObjectRef(new RecordMsg);
}

ObjectRef RecordMsg::Process()
{
	SimpleResponseMsg* msg = new SimpleResponseMsg;
	ObjectRef ref(msg);
	CStdString logMsg;

	CapturePluginProxy::Singleton()->StartCapture(m_party, m_orkuid, m_nativecallid);
	logMsg.Format("Starting capture for party:%s orkuid:%s nativecallid:%s", m_party, m_orkuid, m_nativecallid);
	msg->m_success = true;
	msg->m_comment = logMsg;

	return ref;
}