|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Defines the key event handling API of Accessory Server and |
|
15 * implements the converter plugin for Remote Connection framework. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "RemConKeyEventConverter.h" |
|
23 #include "RemConKeyEventConverterImpl.h" |
|
24 #include "RemConDebug.h" |
|
25 #include <RemConExtensionApi.h> |
|
26 #include <remconcoreapi.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KRemConBearerUid = 0x102069AA; // From Bearer |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CRemConKeyEventConverter::CRemConKeyEventConverter |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CRemConKeyEventConverter::CRemConKeyEventConverter() |
|
40 { |
|
41 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::CRemConKeyEventConverter()" ); |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CRemConKeyEventConverter::ConstructL |
|
46 // Symbian 2nd phase constructor can leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 void CRemConKeyEventConverter::ConstructL() |
|
50 { |
|
51 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::ConstructL()" ); |
|
52 iImpl = CRemConKeyEventConverterImpl::NewL(); |
|
53 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::ConstructL() return void" ); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CRemConKeyEventConverter::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CRemConKeyEventConverter* CRemConKeyEventConverter::NewL() |
|
62 { |
|
63 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::NewL()" ); |
|
64 |
|
65 CRemConKeyEventConverter* self = new( ELeave ) CRemConKeyEventConverter; |
|
66 |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop( self ); |
|
70 |
|
71 COM_TRACE_1( "[AccFW:RemConConverter] CRemConKeyEventConverter::NewL() return %d", self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 |
|
76 // Destructor |
|
77 CRemConKeyEventConverter::~CRemConKeyEventConverter() |
|
78 { |
|
79 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::~CRemConKeyEventConverter()" ); |
|
80 delete iImpl; |
|
81 iImpl = 0; |
|
82 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::~CRemConKeyEventConverter() return void" ); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CRemConKeyEventConverter::InterfaceToBearer |
|
87 // Overload of CRemConConverterPlugin -base class function definition. |
|
88 // (other items were commented in a header). |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 TInt CRemConKeyEventConverter::InterfaceToBearer( |
|
92 TUid /*aInterfaceUid*/, |
|
93 TUint /*aOperationId*/, |
|
94 const TDesC8& /*aData*/, |
|
95 TRemConMessageType /*aMsgType*/, |
|
96 TDes8& /*aBearerData*/ ) const |
|
97 { |
|
98 COM_TRACE_( "[AccFW:RemConConverter] CRemConKeyEventConverter::InterfaceToBearer() return KErrNone (does nothing))" ); |
|
99 return KErrNone; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CRemConKeyEventConverter::BearerToInterface |
|
104 // Overload of CRemConConverterPlugin -base class function definition. |
|
105 // (other items were commented in a header). |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TInt CRemConKeyEventConverter::BearerToInterface( |
|
109 const TDesC8& aBearerData, |
|
110 TUid& aInterfaceUid, |
|
111 TUint& aOperationId, |
|
112 TRemConMessageType& /*aMsgType*/, |
|
113 TDes8& aData ) const |
|
114 { |
|
115 COM_TRACE_2( "[AccFW:RemConConverter] CRemConKeyEventConverter::BearerToInterface(aInterfaceUid=%d, aOperationId=%d)", aInterfaceUid, aOperationId ); |
|
116 TInt ret( KErrNone ); |
|
117 TRemConKeyEventDataBuf data; |
|
118 data.Copy(aBearerData); |
|
119 const TRemConKeyEventData keyData = data(); |
|
120 |
|
121 ret = iImpl->ResolveOperationID( keyData, aInterfaceUid, aOperationId, aData ); |
|
122 |
|
123 COM_TRACE_1( "[AccFW:RemConConverter] CRemConKeyEventConverter::BearerToInterface() returns %d", ret ); |
|
124 return ret; |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CRemConKeyEventConverter::SupportedUids |
|
129 // Overload of CRemConConverterPlugin -base class function definition. |
|
130 // (other items were commented in a header). |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 TBool CRemConKeyEventConverter::SupportedUids( |
|
134 const TUid& aInterfaceUid, |
|
135 const TUid& aBearerUid ) const |
|
136 { |
|
137 COM_TRACE_2( "[AccFW:RemConConverter] CRemConKeyEventConverter::SupportedUids(aInterfaceUid=%d, aBearerUid=%d)", aInterfaceUid, aBearerUid ); |
|
138 |
|
139 TBool ret( ( |
|
140 aInterfaceUid == TUid::Uid(KRemConCoreApiUid) || |
|
141 aInterfaceUid == TUid::Uid(KRemConExtPocApiUid) || |
|
142 aInterfaceUid == TUid::Uid(KRemConExtSynchronizationApiUid) || |
|
143 aInterfaceUid == TUid::Uid(KRemConExtCallHandlingApiUid) |
|
144 ) |
|
145 |
|
146 && |
|
147 |
|
148 ( |
|
149 aBearerUid == TUid::Uid(KRemConBearerUid) |
|
150 ) |
|
151 ); |
|
152 |
|
153 COM_TRACE_1( "[AccFW:RemConConverter] CRemConKeyEventConverter::SupportedUids() returns %d", ret ); |
|
154 return ret; |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CRemConKeyEventConverter::SupportedInterface |
|
159 // Overload of CRemConConverterPlugin -base class function definition. |
|
160 // (other items were commented in a header). |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TBool CRemConKeyEventConverter::SupportedInterface( |
|
164 const TDesC8& aInterfaceData, |
|
165 const TUid& aBearerUid) const |
|
166 { |
|
167 COM_TRACE_1( "[AccFW:RemConConverter] CRemConKeyEventConverter::SupportedInterface(aBearerUid=%d)", aBearerUid.iUid ); |
|
168 COM_TRACE_1( "[AccFW:RemConConverter] Compare bearerUID to %d )", KRemConBearerUid ); |
|
169 (void) aInterfaceData; |
|
170 TBool ret( aBearerUid == TUid::Uid(KRemConBearerUid) ); |
|
171 COM_TRACE_1( "[AccFW:RemConConverter] CRemConKeyEventConverter::SupportedInterface() returns %d", ret ); |
|
172 return ret; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CRemConKeyEventConverter::GetInterface |
|
177 // Returns API of this converter, if it's asked. |
|
178 // (other items were commented in a header). |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TAny* CRemConKeyEventConverter::GetInterface( TUid aUid ) |
|
182 { |
|
183 COM_TRACE_2( "[AccFW:RemConConverter] CRemConKeyEventConverter::GetInterface() this=%d, aUid=%d", this, aUid ); |
|
184 |
|
185 TAny* ret = NULL; |
|
186 |
|
187 // Interface version implemented by this converter asked ? |
|
188 if ( aUid == TUid::Uid( KRemConConverterInterface1 ) ) |
|
189 { |
|
190 ret = reinterpret_cast<TAny*>( |
|
191 static_cast<MRemConConverterInterface*>( this ) ); |
|
192 } |
|
193 |
|
194 COM_TRACE_1( "[AccFW:RemConConverter] CRemConKeyEventConverter::GetInterface() this=%d", ret ); |
|
195 return ret; |
|
196 } |
|
197 |
|
198 // End of File |