|
1 /* |
|
2 * Copyright (c) 2006 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: Aiw service wrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPhCntAIWService.h" |
|
20 #include <AiwServiceHandler.h> |
|
21 #include <AiwGenericParam.hrh> |
|
22 #include <AiwCommon.hrh> |
|
23 #include <AiwContactSelectionDataTypes.h> |
|
24 #include "mphcntservicerequestparam.h" |
|
25 #include "mphcntserviceresult.h" |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // Static constructor |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CPhCntAiwService* CPhCntAiwService::NewL() |
|
32 { |
|
33 CPhCntAiwService* self = |
|
34 new( ELeave )CPhCntAiwService(); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Destructor |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CPhCntAiwService::~CPhCntAiwService() |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // Cancels request if request is outstanding. |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void CPhCntAiwService::Cancel() |
|
54 { |
|
55 if ( IsRequestActive() ) |
|
56 { |
|
57 CancelRequest(); |
|
58 iObserver = NULL; |
|
59 iResult = NULL; |
|
60 iParams = NULL; |
|
61 } |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // Response received from AIW. |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void CPhCntAiwService::ResponseReceived( |
|
69 TInt aError ) |
|
70 { |
|
71 if( iObserver ) |
|
72 { |
|
73 iObserver->RequestComplete( aError ); |
|
74 } |
|
75 iObserver = NULL; |
|
76 iResult = NULL; |
|
77 iParams = NULL; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // Indicates if request is active. |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 TBool CPhCntAiwService::IsRequestActive() const |
|
85 { |
|
86 return iObserver && iResult && iParams; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // From MPhCntService |
|
91 // Executes AIW service request. |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CPhCntAiwService::ExecuteRequestL( |
|
95 MPhCntServiceRequestParam& aServiceRequestParams, |
|
96 MPhCntServiceResult& aResult, |
|
97 MPhCntAiwServiceObserver& aObserver) |
|
98 { |
|
99 CancelRequest(); |
|
100 iObserver = &aObserver; |
|
101 SetRequestAndResult( aServiceRequestParams,aResult ); |
|
102 DoMakeAsyncRequestL(); |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // Second-phase constructor |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CPhCntAiwService::ConstructL() |
|
110 { |
|
111 CPhCntService::ConstructL(); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Constructor |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CPhCntAiwService::CPhCntAiwService() : |
|
119 CPhCntService() |
|
120 { |
|
121 } |
|
122 |
|
123 |
|
124 |