1 /* |
|
2 * Copyright (c) 2008-2008 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: Forwards remote party info changes to Mediator. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cperemotepartyinfomediator.h" |
|
19 |
|
20 #include <MediatorDomainUIDs.h> |
|
21 #include <MediatorCommandResponder.h> |
|
22 #include <MediatorEventProvider.h> |
|
23 #include <callremotepartyinformation.h> |
|
24 |
|
25 #include "cperemotepartyinfoproxy.h" |
|
26 #include "tperemotepartyinfomediatorupdater.h" |
|
27 #include "mpephonemodelinternal.h" |
|
28 #include "mpedatastore.h" |
|
29 #include <talogger.h> |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // Static constructor |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CPERemotePartyInfoMediator* CPERemotePartyInfoMediator::NewL( MPEPhoneModelInternal& aModel ) |
|
38 { |
|
39 CPERemotePartyInfoMediator* self = CPERemotePartyInfoMediator::NewLC( aModel ); |
|
40 CleanupStack::Pop( self ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // Static constructor |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CPERemotePartyInfoMediator* CPERemotePartyInfoMediator::NewLC( MPEPhoneModelInternal& aModel ) |
|
50 { |
|
51 CPERemotePartyInfoMediator* self = new( ELeave ) CPERemotePartyInfoMediator; |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL( aModel ); |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // Destructor |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CPERemotePartyInfoMediator::~CPERemotePartyInfoMediator() |
|
63 { |
|
64 if ( iEventProvider ) |
|
65 { |
|
66 TInt ignore = iEventProvider->UnregisterEvent( |
|
67 KMediatorTelephonyDomain, |
|
68 KCatCallRemotePartyInformation, |
|
69 EChangesInRemotePartyInformation ); |
|
70 } |
|
71 delete iEventProvider; |
|
72 if ( iResponder ) |
|
73 { |
|
74 TInt ignore = iResponder->UnregisterCommand( |
|
75 KMediatorTelephonyDomain, |
|
76 KCatCallRemotePartyInformation, |
|
77 EGetCallRemotePartyInformation ); |
|
78 } |
|
79 delete iResponder; |
|
80 delete iUpdater; |
|
81 delete iProxy; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // Updates call infos |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CPERemotePartyInfoMediator::UpdateRemotePartyInfo() |
|
89 { |
|
90 TEFLOGSTRING( KTAINT, "CPERemotePartyInfoMediator::UpdateRemotePartyInfo(): IN" ); |
|
91 |
|
92 iUpdater->Update(); |
|
93 |
|
94 TEFLOGSTRING( KTAINT, "CPERemotePartyInfoMediator::UpdateRemotePartyInfo(): OUT" ); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // From base class MPEMediator |
|
99 // Sends the response to mediator |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CPERemotePartyInfoMediator::SendResponse( TUid aCategory, |
|
103 TInt aCommandId, |
|
104 const TDesC8& aData ) |
|
105 { |
|
106 TEFLOGSTRING( KTAINT, "CPERemotePartyInfoMediator::SendResponse(): IN" ); |
|
107 const TInt ignore( iResponder->IssueResponse( |
|
108 KMediatorTelephonyDomain, |
|
109 aCategory, |
|
110 aCommandId, KErrNone, aData ) ); |
|
111 TEFLOGSTRING2( KTAINT, "CPERemotePartyInfoMediator::SendResponse() err = %d", ignore ); |
|
112 TEFLOGSTRING( KTAINT, "CPERemotePartyInfoMediator::SendResponse(): OUT" ); |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // From base class MPEMediator |
|
117 // Raises the mediator event. |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 void CPERemotePartyInfoMediator::RaiseEvent( TUid aCategory, |
|
121 TInt aEventId, |
|
122 const TDesC8& aData ) |
|
123 { |
|
124 TEFLOGSTRING( KTAINT, "CPERemotePartyInfoMediator::RaiseEvent(): IN" ); |
|
125 TVersion version( KCallRemotePartyInformationVersionMajor, |
|
126 KCallRemotePartyInformationVersionMinor, |
|
127 KCallRemotePartyInformationVersionBuild ); |
|
128 |
|
129 const TInt ignore( iEventProvider->RaiseEvent( |
|
130 KMediatorTelephonyDomain, |
|
131 aCategory, |
|
132 aEventId, version, aData ) ); |
|
133 TEFLOGSTRING2( KTAINT, "CPERemotePartyInfoMediator::RaiseEvent() err = %d", ignore ); |
|
134 TEFLOGSTRING( KTAINT, "CPERemotePartyInfoMediator::RaiseEvent(): OUT" ); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // Constructor |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 CPERemotePartyInfoMediator::CPERemotePartyInfoMediator() |
|
142 { |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // Second phase constructor. |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 void CPERemotePartyInfoMediator::ConstructL( MPEPhoneModelInternal& aModel ) |
|
151 { |
|
152 MPEDataStore* dataStore = aModel.DataStore(); |
|
153 |
|
154 iProxy = CPERemotePartyInfoProxy::NewL(*this ); |
|
155 |
|
156 iUpdater = new( ELeave ) TPERemotePartyInfoMediatorUpdater( *iProxy, *dataStore ); |
|
157 |
|
158 iResponder = CMediatorCommandResponder::NewL( iUpdater ); |
|
159 TCapabilitySet caps = TCapabilitySet( ECapabilityReadUserData ); |
|
160 |
|
161 TVersion version( KCallRemotePartyInformationVersionMajor, |
|
162 KCallRemotePartyInformationVersionMinor, |
|
163 KCallRemotePartyInformationVersionBuild ); |
|
164 |
|
165 User::LeaveIfError( iResponder->RegisterCommand( |
|
166 KMediatorTelephonyDomain, |
|
167 KCatCallRemotePartyInformation, |
|
168 EGetCallRemotePartyInformation, |
|
169 version, |
|
170 caps, |
|
171 KMediatorTimeoutInfinite ) ); |
|
172 |
|
173 iEventProvider = CMediatorEventProvider::NewL(); |
|
174 User::LeaveIfError( |
|
175 iEventProvider->RegisterEvent( |
|
176 KMediatorTelephonyDomain, KCatCallRemotePartyInformation, |
|
177 EChangesInRemotePartyInformation, version, caps ) ); |
|
178 |
|
179 } |
|