|
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: XIMP Framework server root session implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "ximpbase.h" |
|
19 #include "ximprootsession.h" |
|
20 #include "ximprootserverdefs.h" |
|
21 #include "ximpglobals.h" |
|
22 #include "ximppluginfactory.h" |
|
23 #include "ximpfeaturemanager.h" |
|
24 #include "ximpsrvmessage.h" |
|
25 #include "ximptrace.h" |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 |
|
30 //Import NRootSrv namespace |
|
31 using namespace NRootSrv; |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CXIMPRootSession::NewL() |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CXIMPRootSession* CXIMPRootSession::NewL() |
|
38 { |
|
39 CXIMPRootSession* self = new( ELeave ) CXIMPRootSession(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CXIMPRootSession::~CXIMPRootSession() |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CXIMPRootSession::~CXIMPRootSession() |
|
49 { |
|
50 delete iBuffer; |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CXIMPRootSession::CXIMPRootSession() |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CXIMPRootSession::CXIMPRootSession() |
|
59 { |
|
60 } |
|
61 |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CXIMPRootSession::TryHandleMessageL() |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CXIMPRootSession::TryHandleMessageL( MXIMPSrvMessage& aMessage ) |
|
68 { |
|
69 TBool msgNeedsToBeCompleted = ETrue; |
|
70 |
|
71 switch( aMessage.Function() ) |
|
72 { |
|
73 case NRequest::ERootSsPrepareProtocolList: |
|
74 { |
|
75 DoPrepareProtocolListL( aMessage ); |
|
76 aMessage.Complete( iBuffer->Size() ); |
|
77 msgNeedsToBeCompleted = EFalse; |
|
78 break; |
|
79 } |
|
80 |
|
81 case NRequest::ERootSsPrepareSupportedFeatures: |
|
82 { |
|
83 DoPrepareSupportedFeaturesL( aMessage ); |
|
84 aMessage.Complete( iBuffer->Size() ); |
|
85 msgNeedsToBeCompleted = EFalse; |
|
86 break; |
|
87 } |
|
88 |
|
89 case NRequest::ERootSsFetchServerSideData: |
|
90 { |
|
91 DoFetchServerDataL( aMessage ); |
|
92 break; |
|
93 } |
|
94 |
|
95 default: |
|
96 { |
|
97 // bogus message |
|
98 break; |
|
99 } |
|
100 } |
|
101 |
|
102 if ( msgNeedsToBeCompleted ) |
|
103 { |
|
104 aMessage.Complete( KErrNone ); |
|
105 } |
|
106 |
|
107 } |
|
108 |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CXIMPRootSession::DoPrepareProtocolListL() |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void CXIMPRootSession::DoPrepareProtocolListL( |
|
115 const MXIMPSrvMessage& /* aMessage */ ) |
|
116 { |
|
117 HBufC8* tmp = CXIMPGlobals::Instance()->PluginFactory()->GetProtocolsL(); |
|
118 delete iBuffer; |
|
119 iBuffer = tmp; |
|
120 } |
|
121 |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CXIMPRootSession::DoPrepareSupportedFeaturesL() |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CXIMPRootSession::DoPrepareSupportedFeaturesL( |
|
128 const MXIMPSrvMessage& /* aMessage */ ) |
|
129 { |
|
130 HBufC8* tmp = CXIMPGlobals::Instance()->FeatureManager()->GetFrameworkFeaturesL(); |
|
131 delete iBuffer; |
|
132 iBuffer = tmp; |
|
133 } |
|
134 |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CXIMPRootSession::DoFetchServerDataL() |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CXIMPRootSession::DoFetchServerDataL( |
|
141 const MXIMPSrvMessage& aMessage ) |
|
142 { |
|
143 aMessage.WriteL( MXIMPSrvMessage::Ep0, *iBuffer ); |
|
144 delete iBuffer; |
|
145 iBuffer = NULL; |
|
146 } |
|
147 |
|
148 |
|
149 // End of file |