author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 23 | 50974a8b132e |
parent 5 | 989d2f495d90 |
permissions | -rw-r--r-- |
5 | 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 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: |
|
15 |
* |
|
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 |
|
22 |
#include "messaginginterface.h" |
|
23 |
#include "messagingservicehandler.h" |
|
24 |
#include "serviceerrno.h" |
|
25 |
||
26 |
using namespace LIW; |
|
27 |
||
28 |
_LIT8(KMessagingInterface, "IMessaging"); |
|
29 |
_LIT8(KMessagingService, "Service.Messaging"); |
|
30 |
_LIT8(KCommand, "cmd"); |
|
31 |
_LIT8( KErrorMessage1, "ErrorMessage"); |
|
32 |
_LIT( KInterfaceErrorMessage, "Invalid Interface"); |
|
33 |
||
34 |
// --------------------------------------------------------- |
|
35 |
// Two-phased constructor. |
|
36 |
// --------------------------------------------------------- |
|
37 |
// |
|
38 |
CMessagingServiceHandler* CMessagingServiceHandler::NewL() |
|
39 |
{ |
|
40 |
return new(ELeave) CMessagingServiceHandler(); |
|
41 |
} |
|
42 |
||
43 |
// --------------------------------------------------------- |
|
44 |
// Constructor. |
|
45 |
// --------------------------------------------------------- |
|
46 |
// |
|
47 |
CMessagingServiceHandler::CMessagingServiceHandler() |
|
48 |
{ |
|
49 |
} |
|
50 |
||
51 |
// --------------------------------------------------------- |
|
52 |
// Called by the LIW framework to initialise necessary information |
|
53 |
// from the Service Handler. This method is called when the consumer makes |
|
54 |
//the attach operation. |
|
55 |
// --------------------------------------------------------- |
|
56 |
// |
|
57 |
void CMessagingServiceHandler::InitialiseL( |
|
58 |
MLiwNotifyCallback& /*aFrameworkCallback*/, |
|
59 |
const RCriteriaArray& aInterest) |
|
60 |
{ |
|
61 |
TInt count = aInterest.Count(); |
|
62 |
for(TInt index = 0; index < count ; index++) |
|
63 |
{ |
|
64 |
if(aInterest[index]->ContentType() == KMessagingService) |
|
65 |
return; |
|
66 |
} |
|
67 |
||
68 |
User::Leave(SErrNotFound); |
|
69 |
} |
|
70 |
||
71 |
// --------------------------------------------------------- |
|
72 |
// Executes generic service commands included in criteria |
|
73 |
// --------------------------------------------------------- |
|
74 |
// |
|
75 |
void CMessagingServiceHandler::HandleServiceCmdL( |
|
76 |
const TInt& aCmdId, |
|
77 |
const CLiwGenericParamList& aInParamList, |
|
78 |
CLiwGenericParamList& aOutParamList, |
|
79 |
TUint /*aCmdOptions*/, |
|
80 |
const MLiwNotifyCallback* /*aCallback*/) |
|
81 |
{ |
|
82 |
TPtrC8 cmdName; |
|
83 |
||
84 |
if ( aCmdId == KLiwCmdAsStr ) |
|
85 |
{ |
|
86 |
TInt pos = 0; |
|
87 |
const TLiwGenericParam* cmd = aInParamList.FindFirst( pos, KCommand ); |
|
88 |
if ( cmd ) |
|
89 |
{ |
|
90 |
cmdName.Set(cmd->Value().AsData()); |
|
91 |
} |
|
92 |
} |
|
93 |
||
94 |
if ( cmdName == KMessagingInterface ) |
|
95 |
{ |
|
96 |
CMessagingInterface* msgInterface = CMessagingInterface::NewL(); |
|
97 |
CleanupStack::PushL( msgInterface ); |
|
98 |
aOutParamList.AppendL(TLiwGenericParam(KMessagingInterface, TLiwVariant(msgInterface))); |
|
99 |
CleanupStack::Pop( msgInterface ); |
|
100 |
} |
|
101 |
else |
|
102 |
{ |
|
103 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMessage1, |
|
104 |
TLiwVariant( KInterfaceErrorMessage.operator()() ))); |
|
105 |
aOutParamList.AppendL(TLiwGenericParam(EGenericParamError, |
|
106 |
TLiwVariant((TInt32)SErrInvalidServiceArgument))); |
|
107 |
} |
|
108 |
} |
|
109 |
||
110 |
// --------------------------------------------------------- |
|
111 |
// Map the interface UIDs to implementation factory functions |
|
112 |
// --------------------------------------------------------- |
|
113 |
// |
|
114 |
const TImplementationProxy ImplementationTable[] = |
|
115 |
{ |
|
116 |
IMPLEMENTATION_PROXY_ENTRY(0x10282CF9, CMessagingServiceHandler::NewL) |
|
117 |
}; |
|
118 |
||
119 |
// --------------------------------------------------------- |
|
120 |
// Exported proxy for instantiation method resolution |
|
121 |
// --------------------------------------------------------- |
|
122 |
// |
|
123 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
124 |
{ |
|
125 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
126 |
return ImplementationTable; |
|
127 |
} |