|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: QT Bindings for TMS |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <qtms.h> |
|
19 #include <tmsbuffer.h> |
|
20 #include <tmsclientsink.h> |
|
21 #include "qtmsclientsinkimpl.h" |
|
22 |
|
23 using namespace QTMS; |
|
24 using namespace TMS; |
|
25 |
|
26 QTMSClientSinkImpl::QTMSClientSinkImpl() |
|
27 { |
|
28 } |
|
29 |
|
30 QTMSClientSinkImpl::~QTMSClientSinkImpl() |
|
31 { |
|
32 RemoveObserver(*this); |
|
33 } |
|
34 |
|
35 gint QTMSClientSinkImpl::Create(QTMSSink*& qsink, TMS::TMSSink*& tmssink) |
|
36 { |
|
37 gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY); |
|
38 QTMSClientSinkImpl* self = new QTMSClientSinkImpl(); |
|
39 if (self) |
|
40 { |
|
41 ret = self->PostConstruct(); |
|
42 if (ret != QTMS_RESULT_SUCCESS) |
|
43 { |
|
44 delete self; |
|
45 self = NULL; |
|
46 } |
|
47 self->iSink = tmssink; |
|
48 self->AddObserver(*self, NULL); |
|
49 } |
|
50 qsink = self; |
|
51 return ret; |
|
52 } |
|
53 |
|
54 gint QTMSClientSinkImpl::PostConstruct() |
|
55 { |
|
56 gint ret(QTMS_RESULT_SUCCESS); |
|
57 return ret; |
|
58 } |
|
59 |
|
60 gint QTMSClientSinkImpl::AddObserver(TMS::TMSClientSinkObserver& obsrvr, |
|
61 gpointer user_data) |
|
62 { |
|
63 gint ret(QTMS_RESULT_SUCCESS); |
|
64 if (iSink) |
|
65 { |
|
66 ret = static_cast<TMSClientSink*> (iSink)->AddObserver(obsrvr, |
|
67 user_data); |
|
68 } |
|
69 return ret; |
|
70 } |
|
71 |
|
72 gint QTMSClientSinkImpl::RemoveObserver(TMS::TMSClientSinkObserver& obsrvr) |
|
73 { |
|
74 gint ret(QTMS_RESULT_UNINITIALIZED_OBJECT); |
|
75 if (iSink) |
|
76 { |
|
77 ret = static_cast<TMSClientSink*> (iSink)->RemoveObserver(obsrvr); |
|
78 } |
|
79 return ret; |
|
80 } |
|
81 |
|
82 gint QTMSClientSinkImpl::GetSink(TMS::TMSSink*& tmssink) |
|
83 { |
|
84 gint ret(QTMS_RESULT_UNINITIALIZED_OBJECT); |
|
85 |
|
86 if (iSink) |
|
87 { |
|
88 tmssink = iSink; |
|
89 ret = QTMS_RESULT_SUCCESS; |
|
90 } |
|
91 return ret; |
|
92 } |
|
93 |
|
94 void QTMSClientSinkImpl::ProcessBuffer(const TMS::TMSBuffer* buffer) |
|
95 { |
|
96 emit QTMS::QTMSClientSink::ProcessBuffer(buffer); |
|
97 } |
|
98 |
|
99 // End of file |