22 |
22 |
23 using namespace QTMS; |
23 using namespace QTMS; |
24 using namespace TMS; |
24 using namespace TMS; |
25 |
25 |
26 QTMSInbandToneImpl::QTMSInbandToneImpl() |
26 QTMSInbandToneImpl::QTMSInbandToneImpl() |
27 { |
27 { |
28 } |
28 } |
29 |
29 |
30 QTMSInbandToneImpl::~QTMSInbandToneImpl() |
30 QTMSInbandToneImpl::~QTMSInbandToneImpl() |
31 { |
31 { |
32 RemoveObserver(*this); |
32 RemoveObserver(*this); |
33 } |
33 } |
34 |
34 |
35 gint QTMSInbandToneImpl::Create(QTMSInbandTone*& qinband, |
35 gint QTMSInbandToneImpl::Create(QTMSInbandTone*& qinband, TMS::TMSInbandTone*& tmsinband) |
36 TMS::TMSInbandTone*& tmsinband) |
36 { |
37 { |
|
38 gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY); |
37 gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY); |
39 QTMSInbandToneImpl* self = new QTMSInbandToneImpl(); |
38 QTMSInbandToneImpl* self = new QTMSInbandToneImpl(); |
40 if (self) |
39 if (self) { |
41 { |
|
42 ret = self->PostConstruct(); |
40 ret = self->PostConstruct(); |
43 if (ret != QTMS_RESULT_SUCCESS) |
41 if (ret != QTMS_RESULT_SUCCESS) { |
44 { |
|
45 delete self; |
42 delete self; |
46 self = NULL; |
43 self = NULL; |
47 } |
44 } |
48 self->iInbandTone = tmsinband; |
45 self->iInbandTone = tmsinband; |
49 self->AddObserver(*self, NULL); |
46 self->AddObserver(*self, NULL); |
50 } |
47 } |
51 qinband = self; |
48 qinband = self; |
52 return ret; |
49 return ret; |
53 } |
50 } |
54 |
51 |
55 gint QTMSInbandToneImpl::PostConstruct() |
52 gint QTMSInbandToneImpl::PostConstruct() |
56 { |
53 { |
57 gint ret(QTMS_RESULT_SUCCESS); |
54 gint ret(QTMS_RESULT_SUCCESS); |
58 return ret; |
55 return ret; |
59 } |
56 } |
60 |
57 |
61 gint QTMSInbandToneImpl::AddObserver(TMS::TMSInbandToneObserver& obsrvr, |
58 gint QTMSInbandToneImpl::AddObserver(TMS::TMSInbandToneObserver& obsrvr, gpointer user_data) |
62 gpointer user_data) |
59 { |
63 { |
|
64 gint ret(QTMS_RESULT_SUCCESS); |
60 gint ret(QTMS_RESULT_SUCCESS); |
65 |
61 |
66 if (iInbandTone) |
62 if (iInbandTone) { |
67 { |
|
68 ret = iInbandTone->AddObserver(obsrvr, user_data); |
63 ret = iInbandTone->AddObserver(obsrvr, user_data); |
69 } |
64 } |
70 return ret; |
65 return ret; |
71 } |
66 } |
72 |
67 |
73 gint QTMSInbandToneImpl::RemoveObserver(TMS::TMSInbandToneObserver& obsrvr) |
68 gint QTMSInbandToneImpl::RemoveObserver(TMS::TMSInbandToneObserver& obsrvr) |
74 { |
69 { |
75 gint ret(QTMS_RESULT_SUCCESS); |
70 gint ret(QTMS_RESULT_SUCCESS); |
76 |
71 |
77 if (iInbandTone) |
72 if (iInbandTone) { |
78 { |
|
79 ret = iInbandTone->RemoveObserver(obsrvr); |
73 ret = iInbandTone->RemoveObserver(obsrvr); |
80 } |
74 } |
81 return ret; |
75 return ret; |
82 } |
76 } |
83 |
77 |
84 void QTMSInbandToneImpl::InbandToneEvent( |
78 void QTMSInbandToneImpl::InbandToneEvent(const TMS::TMSInbandTone& /*inbandtone*/, |
85 const TMS::TMSInbandTone& /*inbandtone*/, TMS::TMSSignalEvent event) |
79 TMS::TMSSignalEvent event) |
86 { |
80 { |
87 QTMSSignalEvent qevent; |
81 QTMSSignalEvent qevent; |
88 qevent.type = event.type; |
82 qevent.type = event.type; |
89 qevent.reason = event.reason; |
83 qevent.reason = event.reason; |
90 qevent.curr_state = event.curr_state; |
84 qevent.curr_state = event.curr_state; |
91 qevent.prev_state = event.prev_state; |
85 qevent.prev_state = event.prev_state; |
92 qevent.event_data = event.event_data; |
86 qevent.event_data = event.event_data; |
93 qevent.user_data = event.user_data; |
87 qevent.user_data = event.user_data; |
94 |
88 |
95 emit QTMS::QTMSInbandTone::InbandToneEvent( |
89 emit QTMS::QTMSInbandTone::InbandToneEvent(static_cast<QTMSInbandTone&> (*this), qevent); |
96 static_cast<QTMSInbandTone&> (*this), qevent); |
90 } |
97 } |
|
98 |
91 |
99 // End of file |
92 // End of file |