|
1 /* |
|
2 * Copyright (c) 2003 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: Notification Registry for SmartCard. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CSCARDNOTIFYREGISTRY_H |
|
21 #define CSCARDNOTIFYREGISTRY_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include "ScardServerBase.h" |
|
26 #include "ScardNotifyObserver.h" |
|
27 |
|
28 |
|
29 // CONSTANTS |
|
30 const TReaderID KServerNotifier = -1; |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CScardServer; |
|
34 class CScardNotifier; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Keeps track of notifiers. |
|
40 * |
|
41 * @lib Scard.lib |
|
42 * @since Series60 2.1 |
|
43 */ |
|
44 class CScardNotifyRegistry : public CBase, public MScardNotifyObserver |
|
45 { |
|
46 |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 IMPORT_C static CScardNotifyRegistry* NewL( CScardServer* aServer ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CScardNotifyRegistry(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Creates a notifier if necessary. |
|
63 * @param aMessage Message |
|
64 * @return void |
|
65 */ |
|
66 void AddReaderEventListenerL( const RMessage2& aMessage ); |
|
67 |
|
68 /** |
|
69 * Removes the notifier. |
|
70 * @param aMessage Message |
|
71 * @return void |
|
72 */ |
|
73 void RemoveReaderEventListener( const RMessage2& aMessage ); |
|
74 |
|
75 /** |
|
76 * Removes all notifiers for given client. |
|
77 * @param aClient Client thread |
|
78 * @return void |
|
79 */ |
|
80 void RemoveReaderEventListeners( const RThread& aClient ); |
|
81 |
|
82 /** |
|
83 * Notify clients about card event. |
|
84 * @param aEvent Event |
|
85 * @param aReaderID Reader ID |
|
86 * @return void |
|
87 */ |
|
88 IMPORT_C void NotifyCardEvent( TScardServiceStatus aEvent, |
|
89 TReaderID aReaderID ); |
|
90 |
|
91 /** |
|
92 * Return pointer to Server |
|
93 * @return Pointer to the Server object |
|
94 */ |
|
95 CScardServer* Server(); |
|
96 |
|
97 /** |
|
98 * Cancels the request. |
|
99 * @param aStatus Request status |
|
100 * @return void |
|
101 */ |
|
102 void Cancel( TRequestStatus& aStatus ); |
|
103 |
|
104 private: |
|
105 |
|
106 /** |
|
107 * C++ default constructor. |
|
108 */ |
|
109 CScardNotifyRegistry(); |
|
110 |
|
111 /** |
|
112 * Symbian 2nd phase constructor. |
|
113 */ |
|
114 void ConstructL( CScardServer* aServer); |
|
115 |
|
116 private: // Data |
|
117 // Array of notifiers. Owned. |
|
118 CArrayPtrFlat<CScardNotifier>* iNotifiers; |
|
119 // Server object. Not owned. |
|
120 CScardServer* iServer; |
|
121 }; |
|
122 |
|
123 #endif // CSCARDREGISTRY_H |
|
124 |
|
125 // End of File |