--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp Tue Feb 02 01:08:46 2010 +0200
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Telephony Multimedia Service
+ *
+ */
+
+#include <tms.h>
+#include <tmscall.h>
+#include <tmsformat.h>
+#include <tmseffect.h>
+#include <tmsbuffer.h>
+#include <tmssource.h>
+#include <tmssink.h>
+#include "tmsutility.h"
+#include "tmsproxy.h"
+#include "tmscallimpl.h"
+#include "tmsformatimpl.h"
+#include "tmseffectimpl.h"
+#include "tmsbufferimpl.h"
+#include "tmssourceimpl.h"
+#include "tmssinkimpl.h"
+#include "tmsglobalroutingimpl.h"
+#include "tmsfactoryimpl.h"
+
+using namespace TMS;
+
+TMSFactoryImpl::TMSFactoryImpl()
+ {
+ iFormats.Reset();
+ }
+
+TMSFactoryImpl::~TMSFactoryImpl()
+ {
+ iFormats.Reset();
+ iFormats.Close();
+ }
+
+gint TMSFactoryImpl::CreateCall(TMSCallType ctype, TMSCall*& tmscall,
+ guint ctxid)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSCallImpl::Create(ctype, tmscall, ctxid);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteCall(TMSCall*& tmscall)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ // TODO put the delete in the impl
+ delete tmscall; //iTMSCall
+ tmscall = NULL;
+ return ret;
+ }
+
+gint TMSFactoryImpl::IsCallTypeSupported(TMSCallType ctype, gboolean& flag)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+
+ switch (ctype)
+ {
+ case TMS_CALL_CS:
+ case TMS_CALL_IP:
+ flag = ETrue;
+ break;
+ case TMS_CALL_ECS: //from TB 10.1
+ case TMS_CALL_RTP: //from TB 10.1
+ default:
+ flag = EFalse;
+ break;
+ }
+ return ret;
+ }
+
+gint TMSFactoryImpl::GetSupportedFormats(const TMSStreamType strmtype,
+ FormatVector& fmtlist)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ gint fmtCount = iFormats.Count();
+ if (fmtCount <= 0)
+ {
+ iFormats.Reset();
+ ret = QueryDevice(strmtype);
+ fmtCount = iFormats.Count();
+ }
+ if (ret == TMS_RESULT_SUCCESS)
+ {
+ TMSFormatType fmtype = NULL;
+ TMSFormat* format(NULL);
+ for (gint i = 0; i < fmtCount; i++)
+ {
+ fmtype = TOTMSFORMAT(iFormats[i]);
+ if (fmtype)
+ {
+ format = NULL;
+ ret = CreateFormat(fmtype, format);
+ if (ret == TMS_RESULT_SUCCESS && format)
+ {
+ fmtlist.push_back(format);
+ }
+ }
+ }
+ }
+ return ret;
+ }
+
+gint TMSFactoryImpl::CreateFormat(TMSFormatType fmttype, TMSFormat*& tmsfmt)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSFormatImpl::Create(fmttype, tmsfmt);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteFormat(TMSFormat*& tmsfmt)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSFormatImpl::Delete(tmsfmt);
+ return ret;
+ }
+
+gint TMSFactoryImpl::CreateEffect(TMSEffectType tmseffecttype,
+ TMSEffect*& tmseffect)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSEffectImpl::Create(tmseffecttype, tmseffect);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteEffect(TMSEffect*& tmseffect)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSEffectImpl::Delete(tmseffect);
+ return ret;
+ }
+
+gint TMSFactoryImpl::CreateBuffer(TMSBufferType buffertype, guint size,
+ TMSBuffer*& tmsbuffer)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSBufferImpl::Create(buffertype, size, tmsbuffer);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteBuffer(TMSBuffer*& tmsbuffer)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSBufferImpl::Delete(tmsbuffer);
+ return ret;
+ }
+
+gint TMSFactoryImpl::CreateSource(TMSSourceType srctype, TMSSource*& tmssrc)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSSourceImpl::Create(srctype, tmssrc);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteSource(TMSSource*& tmssrc)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSSourceImpl::Delete(tmssrc);
+ return ret;
+ }
+
+gint TMSFactoryImpl::CreateSink(TMSSinkType sinktype, TMSSink*& tmssink)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSSinkImpl::Create(sinktype, tmssink);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteSink(TMSSink*& tmssink)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSSinkImpl::Delete(tmssink);
+ return ret;
+ }
+
+gint TMSFactoryImpl::CreateGlobalRouting(TMSGlobalRouting*& globrouting)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSGlobalRoutingImpl::Create(globrouting);
+ return ret;
+ }
+
+gint TMSFactoryImpl::DeleteGlobalRouting(TMSGlobalRouting*& globrouting)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ ret = TMSGlobalRoutingImpl::Delete(globrouting);
+ return ret;
+ }
+
+gint TMSFactoryImpl::QueryDevice(const TMSStreamType strmtype)
+ {
+ gint ret(TMS_RESULT_SUCCESS);
+ TMSProxy* session = new TMSProxy;
+ if (session)
+ {
+ if (session->Connect() == TMS_RESULT_SUCCESS)
+ {
+ if (strmtype == TMS_STREAM_UPLINK)
+ {
+ ret = session->GetSupportedEncoders(iFormats, iFrameSize);
+ }
+ else if (strmtype == TMS_STREAM_DOWNLINK)
+ {
+ ret = session->GetSupportedDecoders(iFormats, iFrameSize);
+ }
+ else
+ {
+ ret = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
+ }
+ }
+ delete session;
+ session = NULL;
+ }
+ else
+ {
+ ret = TMS_RESULT_INSUFFICIENT_MEMORY;
+ }
+ return ret;
+ }
+
+// End of file