|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * Declaration of class CMMKeyBearer. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __MMKEYBEARERIMPLEMENTATION_H__ |
|
21 #define __MMKEYBEARERIMPLEMENTATION_H__ |
|
22 |
|
23 // INCLUDE |
|
24 #include <e32base.h> |
|
25 #include <c32comm.h> |
|
26 #include <remcon/remconbearerplugin.h> |
|
27 #include <remcon/remconbearerinterface.h> |
|
28 #include <remcon/messagetype.h> |
|
29 #include <AknCapServerClient.h> |
|
30 |
|
31 #include "MMKeyBearerObserverPS.h" |
|
32 |
|
33 //CONSTANTS |
|
34 const TInt KDataBufferSize = 10; |
|
35 |
|
36 /** |
|
37 * CMMKeyBearer |
|
38 * Implementation of the Rem Con Bearer Plugin |
|
39 * @lib MMKeyBearer.dll |
|
40 * @since 3.0 |
|
41 */ |
|
42 class CMMKeyBearer : public CRemConBearerPlugin, |
|
43 public MRemConBearerInterface, |
|
44 public MCallBackReceiver |
|
45 { |
|
46 public: |
|
47 /** |
|
48 * Creates instance of the CMMKeyBearer class. |
|
49 * |
|
50 * @param TBearerParams: required for the CRemConBearerPlugin |
|
51 * @return : Instance of the CMMKeyBearer |
|
52 */ |
|
53 static CMMKeyBearer* NewL(TBearerParams& aParams); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CMMKeyBearer(); |
|
59 |
|
60 private: // constructors |
|
61 /** |
|
62 * default constructor. |
|
63 * @param aParams: BearerPlugin Params |
|
64 */ |
|
65 CMMKeyBearer(TBearerParams& aParams); |
|
66 |
|
67 /** |
|
68 * Two - phase construction. |
|
69 */ |
|
70 void ConstructL(); |
|
71 |
|
72 private: // from CRemConBearerPlugin |
|
73 /** @see CRemConBearerPlugin::GetInterface() */ |
|
74 TAny* GetInterface(TUid aUid); |
|
75 |
|
76 private: // from MRemConBearerInterface |
|
77 |
|
78 /** @see MRemConBearerInterface::GetResponse() */ |
|
79 TInt GetResponse(TUid& aInterfaceUid, |
|
80 TUint& aTransactionId, |
|
81 TUint& aOperationId, |
|
82 RBuf8& aData, |
|
83 TRemConAddress& aAddr); |
|
84 |
|
85 /** @see MRemConBearerInterface::SendCommand() */ |
|
86 TInt SendCommand(TUid aInterfaceUid, |
|
87 TUint aCommand, |
|
88 TUint aTransactionId, |
|
89 RBuf8& aData, |
|
90 const TRemConAddress& aAddr); |
|
91 |
|
92 /** @see MRemConBearerInterface::GetCommand() */ |
|
93 TInt GetCommand(TUid& aInterfaceUid, |
|
94 TUint& aTransactionId, |
|
95 TUint& aCommand, |
|
96 RBuf8& aData, |
|
97 TRemConAddress& aAddr); |
|
98 |
|
99 /** @see MRemConBearerInterface::SendResponse() */ |
|
100 TInt SendResponse(TUid aInterfaceUid, |
|
101 TUint aOperationId, |
|
102 TUint aTransactionId, |
|
103 RBuf8& aData, |
|
104 const TRemConAddress& aAddr); |
|
105 |
|
106 /** @see MRemConBearerInterface::ConnectRequest() */ |
|
107 void ConnectRequest(const TRemConAddress& aAddr); |
|
108 |
|
109 /** @see MRemConBearerInterface::DisconnectRequest() */ |
|
110 void DisconnectRequest(const TRemConAddress& aAddr); |
|
111 |
|
112 /** @see MRemConBearerInterface::ClientStatus() */ |
|
113 void ClientStatus(TBool aControllerPresent, TBool aTargetPresent); |
|
114 |
|
115 /** @see MRemConBearerInterface::SecurityPolicy() */ |
|
116 TSecurityPolicy SecurityPolicy() const; |
|
117 |
|
118 private: // from MCallBackReceiver |
|
119 |
|
120 /** @see MCallBackReceiver::ReceivedKeyEvent() */ |
|
121 void ReceivedKeyEvent(TInt aScanCode, TInt aKeyType); |
|
122 |
|
123 private: |
|
124 /** |
|
125 * SetSVKOperationIdAndData |
|
126 * Assigns the Operation Id and Data field based on the aEnumValue |
|
127 * for SVK keys |
|
128 */ |
|
129 void SetSVKOperationIdAndData(TInt aEnumValue); |
|
130 |
|
131 /** |
|
132 * SetMediaKeyOperationIdAndData |
|
133 * Assigns the Operation Id and Data field based on the aEnumValue |
|
134 * for Media Keys |
|
135 */ |
|
136 void SetMediaKeyOperationIdAndData(TInt aEnumValue); |
|
137 |
|
138 private: // Data |
|
139 |
|
140 // Last received and corrected-decoded message. |
|
141 TUid iInterfaceUid; |
|
142 TUint iOperationId; |
|
143 |
|
144 TBuf8<KDataBufferSize> iData; |
|
145 |
|
146 TUint iTransactionId; |
|
147 |
|
148 CMMKeyBearerObserver* iMMKeyBearerObserver; |
|
149 CMMKeyBearerObserver* iMediaKeyObserver; |
|
150 CMMKeyBearerObserver* iAccessoryVolKeyObserver; |
|
151 CMMKeyBearerObserver* iUSBFileTransferObserver; |
|
152 |
|
153 TInt iUSBFileTransfer; |
|
154 // For posting event to P&S |
|
155 RProperty iProperty; |
|
156 |
|
157 // For keylock interaction |
|
158 RAknUiServer iAknServer; |
|
159 TBool iAknServerConnected; |
|
160 }; |
|
161 |
|
162 #endif // __MMKEYBEARERIMPLEMENTATION_H__ |