|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: CLandmarkService class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include "landmarkprovider.h" |
|
21 #include "landmarkinterface.h" |
|
22 #include "landmarkliwparams.hrh" |
|
23 #include "../../inc/serviceerrno.h" |
|
24 |
|
25 //CONSTANTS |
|
26 _LIT8(KCmdName,"cmd"); |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CLandmarkProvider::NewL() |
|
31 // Two-phased constructor. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CLandmarkProvider* CLandmarkProvider::NewL() |
|
35 { |
|
36 return new (ELeave) CLandmarkProvider(); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CLandmarkProvider::CLandmarkProvider() |
|
41 // C++ default constructor can NOT contain any code, that might leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CLandmarkProvider :: CLandmarkProvider() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CLandmarkProvider::~CLandmarkProvider() |
|
50 // Destructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CLandmarkProvider :: ~CLandmarkProvider() |
|
54 { |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CLandmarkProvider::InitialiseL(MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
59 // const RCriteriaArray& aInterest) |
|
60 // Called by the AIW framework to initialise provider with necessary information |
|
61 // from the Service Handler. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void CLandmarkProvider::InitialiseL(MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
65 const RCriteriaArray& /*aInterest*/) |
|
66 { |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CLandmarkProvider::HandleServiceCmdL(const TInt& aCmdId, |
|
71 // const CLiwGenericParamList& aInParamList, |
|
72 // CLiwGenericParamList& aOutParamList, |
|
73 // TUint aCmdOptions, |
|
74 // const MLiwNotifyCallback* aCallback) |
|
75 // Called by the AIW framework to initialise provider with necessary information |
|
76 // from the Service Handler. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CLandmarkProvider::HandleServiceCmdL( const TInt& aCmdId, |
|
80 const CLiwGenericParamList& aInParamList, |
|
81 CLiwGenericParamList& aOutParamList, |
|
82 TUint aCmdOptions, |
|
83 const MLiwNotifyCallback* /*aCallback*/ ) |
|
84 { |
|
85 // Cancel bit must always be checked. Support can be implemented if necessary. |
|
86 if ( aCmdOptions & KLiwOptCancel ) |
|
87 { |
|
88 return; |
|
89 } |
|
90 TPtrC8 CmdName; |
|
91 const TLiwGenericParam* cmd; |
|
92 if ( aCmdId == KLiwCmdAsStr ) |
|
93 { |
|
94 TInt pos = 0; |
|
95 cmd = aInParamList.FindFirst(pos,KCmdName); |
|
96 if ( NULL != cmd ) |
|
97 { |
|
98 CmdName.Set( cmd->Value().AsData() ); |
|
99 } |
|
100 } |
|
101 if ( CmdName == KIDataSource ) |
|
102 { |
|
103 //Create interface pointer and return the output param |
|
104 CLandmarkInterface* interface = CLandmarkInterface::NewL(); |
|
105 CleanupClosePushL(*interface); |
|
106 TRAPD (err,interface->SetActiveL(aInParamList)); |
|
107 if( err ) |
|
108 { |
|
109 err = interface->SapiError(err); |
|
110 } |
|
111 aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)err))); |
|
112 if( SErrBadArgumentType == err ) |
|
113 { |
|
114 aOutParamList.AppendL(TLiwGenericParam(KErrorMsg,TLiwVariant(KInvalidDbUri()))); |
|
115 } |
|
116 aOutParamList.AppendL(TLiwGenericParam(KIDataSource,TLiwVariant(interface))); |
|
117 CleanupStack::Pop(interface); |
|
118 } |
|
119 else |
|
120 { |
|
121 aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SErrMissingArgument))); |
|
122 aOutParamList.AppendL(TLiwGenericParam(KErrorMsg,TLiwVariant(KInterfaceMissing()))); |
|
123 } |
|
124 } |
|
125 |
|
126 // |
|
127 // Rest of the file is for ECom initialization. |
|
128 // |
|
129 |
|
130 // Map the interface UIDs to implementation factory functions |
|
131 const TImplementationProxy ImplementationTable[] = |
|
132 { |
|
133 IMPLEMENTATION_PROXY_ENTRY( 0x10282CF6, CLandmarkProvider::NewL ) |
|
134 }; |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // Exported proxy for instantiation method resolution |
|
138 // --------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
141 { |
|
142 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
143 return ImplementationTable; |
|
144 } |