author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 18 Jan 2010 21:02:57 +0200 | |
changeset 27 | 02682e02e51f |
parent 23 | 50974a8b132e |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 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 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: This class provides the interface for calling |
|
15 |
* the functionalities of ServiceRegistry SAPI. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
20 |
#include <ecom/implementationproxy.h> |
5 | 21 |
#include "serviceregistryservicehandler.h" |
22 |
// Including a copy of common constants for this compilation unit |
|
23 |
#include "serviceregistryservice.hrh" |
|
24 |
||
25 |
#include "serviceinterface.h" |
|
26 |
||
27 |
// ----------------------------------------------------------------------------- |
|
28 |
// CServiceRegistryServiceHandler::NewL |
|
29 |
// Returns the instance of CServiceRegistryServiceHandler |
|
30 |
// ----------------------------------------------------------------------------- |
|
31 |
// |
|
32 |
CServiceRegistryServiceHandler* CServiceRegistryServiceHandler::NewL() |
|
33 |
{ |
|
34 |
return new( ELeave ) CServiceRegistryServiceHandler; |
|
35 |
} |
|
36 |
||
37 |
// ----------------------------------------------------------------------------- |
|
38 |
// CServiceRegistryServiceHandler::~CServiceRegistryServiceHandler |
|
39 |
// Class destructor |
|
40 |
// ----------------------------------------------------------------------------- |
|
41 |
// |
|
42 |
CServiceRegistryServiceHandler::~CServiceRegistryServiceHandler() |
|
43 |
{ |
|
44 |
} |
|
45 |
||
46 |
// ----------------------------------------------------------------------------- |
|
47 |
// CServiceRegistryServiceHandler::InitialiseL |
|
48 |
// Initializes provider with necessary information |
|
49 |
// ----------------------------------------------------------------------------- |
|
50 |
// |
|
51 |
void CServiceRegistryServiceHandler::InitialiseL(MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
52 |
const RCriteriaArray& /*aInterest*/) |
|
53 |
{ |
|
54 |
// Domain Specific Initialization |
|
55 |
} |
|
56 |
||
57 |
// ----------------------------------------------------------------------------- |
|
58 |
// CServiceRegistryServiceHandler::HandleServiceCmdL |
|
59 |
// Executes generic service commands included in criteria. |
|
60 |
// ----------------------------------------------------------------------------- |
|
61 |
// |
|
62 |
void CServiceRegistryServiceHandler::HandleServiceCmdL(const TInt& aCmdId, |
|
63 |
const CLiwGenericParamList& aInParamList, |
|
64 |
CLiwGenericParamList& aOutParamList, |
|
65 |
TUint aCmdOptions, |
|
66 |
const MLiwNotifyCallback* aCallback) |
|
67 |
{ |
|
68 |
if( ( aCallback ) || ( 0 != aCmdOptions ) ) |
|
69 |
{ |
|
70 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode , TLiwVariant( KErrNotSupported ) ) ); |
|
71 |
// return from function |
|
72 |
return; |
|
73 |
} |
|
74 |
||
75 |
TPtrC8 cmdName; |
|
76 |
TLiwGenericParam cmd; |
|
77 |
||
78 |
if ( aCmdId == KLiwCmdAsStr ) |
|
79 |
{ |
|
80 |
TInt pos(0); |
|
81 |
aInParamList.FindFirst( pos, KCommand ); |
|
82 |
if ( pos >= 0 ) |
|
83 |
{ |
|
84 |
cmd = aInParamList[pos]; |
|
85 |
cmdName.Set( cmd.Value().AsData() ); |
|
86 |
} |
|
87 |
else |
|
88 |
{ |
|
89 |
aOutParamList.AppendL( TLiwGenericParam( |
|
90 |
KErrorCode, TLiwVariant( KErrArgument ) ) ); |
|
91 |
return; |
|
92 |
} |
|
93 |
} |
|
94 |
else |
|
95 |
{ |
|
96 |
aOutParamList.AppendL( TLiwGenericParam( |
|
97 |
KErrorCode, TLiwVariant( KErrNotSupported ) ) ); |
|
98 |
return; |
|
99 |
} |
|
100 |
||
101 |
// Resolving the requested interface |
|
102 |
if ( cmdName.CompareF( KService ) == 0 ) |
|
103 |
{ |
|
104 |
//Create interface pointer and return the output param |
|
105 |
CServiceInterface* ifp = CServiceInterface::NewL(); |
|
106 |
CleanupClosePushL( *ifp ); |
|
107 |
aOutParamList.AppendL( TLiwGenericParam( KService, TLiwVariant( ifp ) ) ); |
|
108 |
CleanupStack::Pop( ifp ); |
|
109 |
return; |
|
110 |
} |
|
111 |
else |
|
112 |
{ |
|
113 |
aOutParamList.AppendL( |
|
114 |
TLiwGenericParam( KErrorCode, TLiwVariant( KErrNotSupported ) ) ); |
|
115 |
} |
|
116 |
} |
|
117 |
||
118 |
// |
|
119 |
// Rest of the file is for ECom initialization. |
|
120 |
// |
|
121 |
||
122 |
// Map the interface UIDs to implementation factory functions |
|
123 |
||
124 |
const TImplementationProxy ImplementationTable[] = |
|
125 |
{ |
|
126 |
IMPLEMENTATION_PROXY_ENTRY(0x20022EE5, CServiceRegistryServiceHandler::NewL) |
|
127 |
}; |
|
128 |
||
129 |
// --------------------------------------------------------- |
|
130 |
// Exported proxy for instantiation method resolution |
|
131 |
// --------------------------------------------------------- |
|
132 |
// |
|
133 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
134 |
{ |
|
135 |
aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); |
|
136 |
return ImplementationTable; |
|
137 |
} |