|
1 /* |
|
2 * Copyright (c) 2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include <liwcommon.h> |
|
21 #include <liwserviceifbase.h> |
|
22 |
|
23 #include "cpclientservice.h" |
|
24 #include "cpdebug.h" |
|
25 #include "cpglobals.h" |
|
26 #include "cdatasourceinterface.h" |
|
27 #include "ccontentpublishinginterface.h" |
|
28 |
|
29 const TInt implUid( 0x20016B7E ); |
|
30 const TInt implContentUid( 0x2001955F ); |
|
31 |
|
32 using namespace LIW; |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CCPClientService::CCPClientService() |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CCPClientService* CCPClientService::NewL() |
|
48 { |
|
49 return new(ELeave) CCPClientService(); |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CCPClientService::~CCPClientService() |
|
57 { |
|
58 |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CCPClientService::InitialiseL( |
|
66 MLiwNotifyCallback& /*aFrameworkCallback*/, const RCriteriaArray& /*aInterest*/) |
|
67 { |
|
68 |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CCPClientService::HandleServiceCmdL( const TInt& aCmdId, |
|
76 const CLiwGenericParamList& aInParamList, |
|
77 CLiwGenericParamList& aOutParamList, TUint aCmdOptions, |
|
78 const MLiwNotifyCallback* aCallback ) |
|
79 { |
|
80 CP_DEBUG( _L8("CCPClientService::HandleServiceCmdL()") ); |
|
81 if ( (aCallback ) || (aCmdOptions ) ) |
|
82 { |
|
83 // report error if request is anything other than synchronous |
|
84 //or user sends a callback parameter |
|
85 aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, |
|
86 TLiwVariant( KErrNotSupported ) ) ); |
|
87 aOutParamList.AppendL( TLiwGenericParam( KErrorCode, |
|
88 TLiwVariant( KErrNotSupported ) ) ); |
|
89 return; |
|
90 } |
|
91 |
|
92 TPtrC8 cmdName; |
|
93 const TLiwGenericParam* cmd= NULL; |
|
94 |
|
95 if ( aCmdId == KLiwCmdAsStr ) |
|
96 { |
|
97 TInt pos = 0; |
|
98 cmd = aInParamList.FindFirst( pos, KCommand ); |
|
99 if ( cmd ) |
|
100 { |
|
101 cmdName.Set( cmd->Value().AsData( ) ); |
|
102 } |
|
103 else |
|
104 { |
|
105 aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, |
|
106 TLiwVariant( KErrArgument ) ) ); |
|
107 aOutParamList.AppendL( TLiwGenericParam( KErrorCode, |
|
108 TLiwVariant( KErrArgument ) ) ); |
|
109 } |
|
110 } |
|
111 else |
|
112 { |
|
113 aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, |
|
114 TLiwVariant( KErrNotSupported ) ) ); |
|
115 aOutParamList.AppendL( TLiwGenericParam( KErrorCode, |
|
116 TLiwVariant( KErrNotSupported ) ) ); |
|
117 } |
|
118 if ( !cmdName.CompareF( KCPInterface ) ) |
|
119 { |
|
120 //Create interface pointer and return the output param |
|
121 CDataSourceInterface* ifp =CDataSourceInterface::NewLC( ); |
|
122 aOutParamList.AppendL( TLiwGenericParam( KCPInterface, |
|
123 TLiwVariant( ifp ) ) ); |
|
124 CleanupStack::Pop( ifp ); |
|
125 return; |
|
126 } |
|
127 else if ( !cmdName.CompareF( KCPContentInterface ) ) |
|
128 { |
|
129 //Create interface pointer and return the output param |
|
130 CContentPublishingInterface* ifp = |
|
131 CContentPublishingInterface::NewLC( ); |
|
132 aOutParamList.AppendL( TLiwGenericParam( KCPContentInterface, |
|
133 TLiwVariant( ifp ) ) ); |
|
134 CleanupStack::Pop( ifp ); |
|
135 return; |
|
136 } |
|
137 else |
|
138 { |
|
139 aOutParamList.AppendL( TLiwGenericParam( EGenericParamError, |
|
140 TLiwVariant( KErrNotSupported ) ) ); |
|
141 aOutParamList.AppendL( TLiwGenericParam( KErrorCode, |
|
142 TLiwVariant( KErrNotSupported ) ) ); |
|
143 } |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------- |
|
147 // Map the interface UIDs to implementation factory functions |
|
148 // --------------------------------------------------------- |
|
149 // |
|
150 const TImplementationProxy ImplementationTable[] = |
|
151 { |
|
152 IMPLEMENTATION_PROXY_ENTRY( implUid, CCPClientService::NewL ), |
|
153 IMPLEMENTATION_PROXY_ENTRY( implContentUid, CCPClientService::NewL ) |
|
154 }; |
|
155 |
|
156 // --------------------------------------------------------- |
|
157 // Exported proxy for instantiation method resolution |
|
158 // --------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( |
|
161 TInt& aTableCount) |
|
162 { |
|
163 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
164 return ImplementationTable; |
|
165 } |