|
1 /* |
|
2 * Copyright (c) 2006-2009 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 #include "cdummytokenclient.h" |
|
20 #include "cdummykeystoreclient.h" |
|
21 |
|
22 _LIT(KTokenString, "Dummy KeyStore Manager1"); |
|
23 |
|
24 |
|
25 MCTToken* CDummyTokenClient::NewL(MCTTokenType* aTokenType) |
|
26 { |
|
27 CDummyTokenClient* self = new (ELeave) CDummyTokenClient(aTokenType); |
|
28 return static_cast<MCTToken*>(self); |
|
29 } |
|
30 |
|
31 CDummyTokenClient::CDummyTokenClient(MCTTokenType* aTokenType) |
|
32 : iTokenType(aTokenType), |
|
33 iRefCount(0) |
|
34 { |
|
35 } |
|
36 |
|
37 MCTTokenType& CDummyTokenClient::TokenType() |
|
38 { |
|
39 return *iTokenType; |
|
40 } |
|
41 |
|
42 const TDesC& CDummyTokenClient::Label() |
|
43 { |
|
44 return KTokenString(); |
|
45 } |
|
46 |
|
47 TCTTokenHandle CDummyTokenClient::Handle() |
|
48 { |
|
49 return (TCTTokenHandle(iTokenType->Type(), 0)); |
|
50 } |
|
51 |
|
52 TInt& CDummyTokenClient::ReferenceCount() |
|
53 { |
|
54 return iRefCount; |
|
55 } |
|
56 |
|
57 void CDummyTokenClient::DoGetInterface(TUid aRequiredInterface, MCTTokenInterface*& aReturnedInterface, TRequestStatus& aStatus) |
|
58 { |
|
59 // No longer calls server to get the interface - just creates a client object of the appropriate type |
|
60 TUid userUid = {0x101F7334}; |
|
61 #ifndef KEYSTORE_INTERFACE |
|
62 TUid managerUid = {0x101F7335}; |
|
63 #endif // KEYSTORE_INTERFACE |
|
64 |
|
65 // Complete the TRequestStatus here since not asynchronous |
|
66 TRequestStatus* status = &aStatus; |
|
67 aReturnedInterface = NULL; |
|
68 TInt err = KErrGeneral; |
|
69 |
|
70 if(userUid == aRequiredInterface |
|
71 #ifndef KEYSTORE_INTERFACE |
|
72 || managerUid == aRequiredInterface |
|
73 #endif //KEYSTORE_INTERFACE |
|
74 ) |
|
75 { |
|
76 TRAP(err, aReturnedInterface = CDummyKeyStoreClient::NewKeyStoreInterfaceL(*this)); |
|
77 } |
|
78 |
|
79 if (NULL == aReturnedInterface) |
|
80 { |
|
81 Release(); |
|
82 } |
|
83 |
|
84 User::RequestComplete(status, err); |
|
85 } |
|
86 |
|
87 TBool CDummyTokenClient::DoCancelGetInterface() |
|
88 {// Not an asynchronous call for current file store, so nothing to do |
|
89 return EFalse; |
|
90 } |
|
91 |
|
92 const TDesC& CDummyTokenClient::Information(TTokenInformation /*aRequiredInformation*/) |
|
93 { |
|
94 return KNullDesC; |
|
95 } |