wim/Scard/inc/ScardNotifier.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     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:  Notifier for SmartCard.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CSCARDNOTIFIER_H
       
    21 #define CSCARDNOTIFIER_H
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include "ScardNotifyRegistry.h"
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30 *  Used to notify smart card server about card events.
       
    31 *
       
    32 *  @lib Scard.lib
       
    33 *  @since Series60 2.1
       
    34 */
       
    35 class CScardNotifier : public CActive
       
    36     {
       
    37     public:  // Constructors and destructor
       
    38         
       
    39         /**
       
    40         * Two-phased constructor.
       
    41         * @param aRegistry Pointer to notify registry
       
    42         * @param aClient Client thread
       
    43         * @param aClientStatus Client request status
       
    44         * @param aReaderID Reader ID
       
    45         */
       
    46         static CScardNotifier* NewL( CScardNotifyRegistry* aRegistry, 
       
    47                                      RMessage2& aMessage,
       
    48                                      TRequestStatus* aClientStatus, 
       
    49                                      const TReaderID& aReaderID );
       
    50         
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CScardNotifier();
       
    55     
       
    56     public: // New functions
       
    57     
       
    58         /**
       
    59         * Complete our own request, or if that's done already, 
       
    60         * store the event until it can be serviced.
       
    61         * @param aEvent Scard event
       
    62         * @param aReaderID Reader ID
       
    63         * @return void
       
    64         */
       
    65         void NotifyCardEvent( TScardServiceStatus aEvent, 
       
    66                               TReaderID aReaderID );
       
    67                               
       
    68         TReaderID ReaderId();
       
    69 
       
    70     public: // Functions from base classes    
       
    71         
       
    72         /**
       
    73         * From CActive RunL.
       
    74         */
       
    75         void RunL();
       
    76 
       
    77         /**
       
    78         * From CActive DoCancel.
       
    79         */
       
    80         void DoCancel();
       
    81         
       
    82     private:
       
    83         
       
    84         /**
       
    85         * C++ default constructor.
       
    86         * @param aRegistry Pointer to notify registry
       
    87         * @param aClient Client thread
       
    88         * @param aClientStatus Client request status
       
    89         * @param aReaderID Reader ID
       
    90         */
       
    91         CScardNotifier( CScardNotifyRegistry* aRegistry, 
       
    92                         RMessage2& aMessage,
       
    93                         TRequestStatus* aClientStatus,
       
    94                         const TReaderID& aReaderID );
       
    95         
       
    96         /**
       
    97         * By default Symbian 2nd phase constructor is private.
       
    98         */
       
    99         void ConstructL();
       
   100 
       
   101     public: // Data
       
   102                 
       
   103     
       
   104     private:    // Data
       
   105         struct TCardEvent
       
   106             {
       
   107             TScardServiceStatus iEvent;
       
   108             TReaderID           iReaderID;
       
   109             };
       
   110 
       
   111         // Pointer to notify registry. Not owned.
       
   112         CScardNotifyRegistry*      iRegistry;
       
   113         // Event stack. Owned.
       
   114         CArrayFixFlat<TCardEvent>* iEventStack;
       
   115         
       
   116         // Client message to be completed when event occurs
       
   117         RMessage2       iMessage;
       
   118 
       
   119         // Clients request status. Not owned. 
       
   120         TRequestStatus* iClientStatus; 
       
   121         
       
   122         // Reader ID
       
   123         TReaderID       iReaderID;
       
   124         
       
   125         // Flag to tell if message is already completed
       
   126         TBool           iMessageCompleted;
       
   127  
       
   128     };
       
   129 
       
   130 #endif      // CSCARDNOTIFIER_H
       
   131 
       
   132 // End of File