|
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 <tmsdtmf.h> |
|
19 #include "tmsutility.h" |
|
20 #include "qtmsdtmfimpl.h" |
|
21 |
|
22 using namespace QTMS; |
|
23 using namespace TMS; |
|
24 |
|
25 QTMSDTMFImpl::QTMSDTMFImpl() |
|
26 { |
|
27 } |
|
28 |
|
29 QTMSDTMFImpl::~QTMSDTMFImpl() |
|
30 { |
|
31 RemoveObserver(*this); |
|
32 } |
|
33 |
|
34 gint QTMSDTMFImpl::Create(QTMSDTMF*& qdtmf, TMS::TMSDTMF*& tmsdtmf) |
|
35 { |
|
36 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
|
37 QTMSDTMFImpl* self = new QTMSDTMFImpl(); |
|
38 if (self) { |
|
39 ret = self->PostConstruct(); |
|
40 if (ret != QTMS_RESULT_SUCCESS) { |
|
41 delete self; |
|
42 self = NULL; |
|
43 } |
|
44 self->iDtmf = tmsdtmf; |
|
45 ret = self->AddObserver(*self, NULL); |
|
46 } |
|
47 qdtmf = self; |
|
48 return ret; |
|
49 } |
|
50 |
|
51 gint QTMSDTMFImpl::PostConstruct() |
|
52 { |
|
53 gint ret(QTMS_RESULT_SUCCESS); |
|
54 return ret; |
|
55 } |
|
56 |
|
57 gint QTMSDTMFImpl::AddObserver(TMS::TMSDTMFObserver& obsrvr, gpointer user_data) |
|
58 { |
|
59 gint ret(QTMS_RESULT_UNINITIALIZED_OBJECT); |
|
60 |
|
61 if (iDtmf) { |
|
62 ret = iDtmf->AddObserver(obsrvr, user_data); |
|
63 } |
|
64 return ret; |
|
65 } |
|
66 |
|
67 gint QTMSDTMFImpl::RemoveObserver(TMS::TMSDTMFObserver& obsrvr) |
|
68 { |
|
69 gint ret(QTMS_RESULT_UNINITIALIZED_OBJECT); |
|
70 |
|
71 if (iDtmf) { |
|
72 ret = iDtmf->RemoveObserver(obsrvr); |
|
73 } |
|
74 return ret; |
|
75 } |
|
76 |
|
77 void QTMSDTMFImpl::DTMFEvent(const TMS::TMSDTMF& /*dtmf*/, TMS::TMSSignalEvent event) |
|
78 { |
|
79 QTMSSignalEvent qevent; |
|
80 |
|
81 qevent.type = event.type; |
|
82 qevent.reason = event.reason; |
|
83 qevent.curr_state = event.curr_state; |
|
84 qevent.prev_state = event.prev_state; |
|
85 qevent.event_data = event.event_data; |
|
86 qevent.user_data = event.user_data; |
|
87 |
|
88 emit QTMS::QTMSDTMF::DTMFEvent(static_cast<QTMSDTMF&> (*this), qevent); |
|
89 } |
|
90 |
|
91 // End of file |