secsrv_plat/remote_lock_api/inc/RemoteLockSettings.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2006 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:  API for applications to access remote lock settings.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef REMOTELOCKSETTINGS_H
       
    20 #define REMOTELOCKSETTINGS_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <e32cons.h>
       
    27 #include <cenrepnotifyhandler.h>      
       
    28 
       
    29 // CONSTANT
       
    30 
       
    31 // MACROS 
       
    32 /** Maximum length of user-given remote lock code */
       
    33 const TInt KRLockMaxLockCodeLength = 20;
       
    34 /** Minimum length of user-given remote lock code */
       
    35 const TInt KRLockMinLockCodeLength = 5;
       
    36 /** Length of the stored remote lock code */
       
    37 const TInt KRLockStoredLockCodeLength = 32;
       
    38 
       
    39 // DATA TYPES 
       
    40 
       
    41 // FUNCTION PROTOTYPES 
       
    42 
       
    43 // FORWARD DECLARATIONS 
       
    44 class MRemoteLockSettingsHandler;
       
    45 
       
    46 
       
    47 // CLASS DECLARATION
       
    48 /**
       
    49 * Interface for handling remote lock settings
       
    50 *
       
    51 * @lib rlocksettings.lib
       
    52 * @since S60 3.2
       
    53 *
       
    54 */
       
    55 class CRemoteLockSettings: public CBase, public MCenRepNotifyHandlerCallback 
       
    56     {
       
    57     public:                
       
    58         /**
       
    59         * Two-Phased constructor
       
    60         *
       
    61         * @since S60 3.2
       
    62         * @param aHandler Client implemented notification handler that will be
       
    63         *                 called when remote lock settings are changed. 
       
    64         *                 If the client doesn't need notification, then no 
       
    65         *                 parameter needed.
       
    66         * @return
       
    67         */
       
    68         IMPORT_C static CRemoteLockSettings* NewL( 
       
    69             MRemoteLockSettingsHandler* aHandler = NULL );        
       
    70          
       
    71         /**
       
    72         * Two-Phased constructor
       
    73         *
       
    74         * @since S60 3.2
       
    75         * @param aHandler Client implemented notification handler that will be
       
    76         *                 called when remote lock settings are changed. 
       
    77         *                 If the client doesn't need notification, then no 
       
    78         *                 parameter needed.
       
    79         * @return
       
    80         */              
       
    81         IMPORT_C static CRemoteLockSettings* NewLC( 
       
    82             MRemoteLockSettingsHandler* aHandler  = NULL);
       
    83         
       
    84         IMPORT_C virtual ~CRemoteLockSettings();
       
    85 
       
    86         /**
       
    87         * Gets the remote lock code. Note that the retrieved remote lock code 
       
    88         * is not in plain format.
       
    89         *
       
    90         * @since S60 3.2
       
    91         * @param aLockCode For retrieving the remote lock code. The length 
       
    92         *                  must be at least KRLStoredLockCodeLength.
       
    93         * @return ETrue if succeeded,
       
    94         *         EFalse otherwise.
       
    95         */
       
    96         IMPORT_C TBool GetLockCode( TDes& aLockCode ) const;
       
    97         
       
    98         /**
       
    99         * Gets the remote lock code. Note that the retrieved remote lock code 
       
   100         * is not in plain format.
       
   101         *
       
   102         * @since S60 3.2
       
   103         * @param aLockCode For retrieving the remote lock code. The length 
       
   104         *                  must be at least KRLStoredLockCodeLength.
       
   105         * @param aLockCodeTrimmed For retrieving the remote lock code. 
       
   106         *                         The length must be at least 
       
   107         *                         KRLStoredLockCodeLength. Same as aLockCode, 
       
   108         *                         but formatted differently before storing: 
       
   109         *                         leading and trailing space characters 
       
   110         *                         removed, multiple spaces replaced with 
       
   111         *                         single space.
       
   112         * @return ETrue if succeeded,
       
   113         *         EFalse otherwise.
       
   114         */
       
   115         IMPORT_C TBool GetLockCode( 
       
   116         	TDes& aLockCode, 
       
   117         	TDes& aLockCodeTrimmed ) const;
       
   118         
       
   119         /**
       
   120         * Enables remote lock and stores the correct remote lock code.
       
   121         *
       
   122         * @since S60 3.2
       
   123         * @param aLockCode New remote lock code.
       
   124         * @return ETrue if succeeded,
       
   125         *         EFalse otherwise. 
       
   126         */
       
   127         IMPORT_C TBool SetEnabledL( const TDesC& aLockCode );
       
   128         
       
   129         /**
       
   130         * Disables remote lock.
       
   131         *
       
   132         * @since S60 3.2
       
   133         * @param
       
   134         * @return ETrue if succeeded,
       
   135         *         EFalse otherwise. 
       
   136         */
       
   137         IMPORT_C TBool SetDisabled();
       
   138 
       
   139         /**
       
   140         * Gets the current remote lock status.
       
   141         *
       
   142         * @since S60 3.2
       
   143         * @param aEnabled For retrieving the current remote lock status.
       
   144         * @return ETrue if succeeded,
       
   145         *         EFalse otherwise.
       
   146         */
       
   147         IMPORT_C TBool GetEnabled( TBool& aEnabled ) const;      
       
   148         
       
   149         /**
       
   150         * Compares two remote lock codes.
       
   151         *
       
   152         * @since S60 3.2
       
   153         * @param aLockCode The lock code to compare. This should be in plain 
       
   154        	*        format.
       
   155         * @param aCorrectLockCode The correct lock code to compare against. 
       
   156         *        This should be the one retrieved using GetLockCode(), and 
       
   157         *        thus is not in plain format.
       
   158         * @return ETrue if the lock codes are the same,
       
   159         *         EFalse otherwise.
       
   160         */
       
   161         IMPORT_C TBool CompareLockCodesL( 
       
   162             const TDesC& aLockCode, 
       
   163             const TDesC& aCorrectLockCode ) const;      
       
   164         
       
   165         /**
       
   166         * Enables or disables remote lock settings notification. If the 
       
   167         * settings are changed, the notification handler given in NewL()
       
   168         * or NewLC() will be called.
       
   169         *
       
   170         * @since S60 3.2
       
   171         * @param aNotifyEnable For enabling or disabling the remote lock 
       
   172         *                      settings notification.
       
   173         * @return ETrue if succeeded,
       
   174         *         EFalse otherwise.
       
   175         */
       
   176         IMPORT_C TBool RemoteLockNotifyL( const TBool aNotifyEnable ); 
       
   177    
       
   178     private:
       
   179         
       
   180         /**
       
   181         * Constructor.
       
   182         *
       
   183         * @since S60 3.2
       
   184         * @param aHandler Client implemented notification handler that will be
       
   185         *                 called when remote lock settings are changed. 
       
   186         */   
       
   187         CRemoteLockSettings( MRemoteLockSettingsHandler* aHandler );
       
   188         
       
   189         /**
       
   190         * 2nd phase constructor.
       
   191         */
       
   192         void ConstructL();
       
   193         
       
   194         // from base class MCenRepNotifyHandler
       
   195         
       
   196         /**
       
   197         * From MCenRepNotifyHandler
       
   198         * Notify handler.
       
   199         */
       
   200         void HandleNotifyGeneric( TUint32 aId );
       
   201 
       
   202     public: // data
       
   203         
       
   204     private: // data
       
   205     
       
   206         CRepository* iSession;
       
   207         CCenRepNotifyHandler* iNotifyHandler;
       
   208         MRemoteLockSettingsHandler* iHandler;                  
       
   209     };
       
   210 
       
   211 // CLASS DECLARATION
       
   212 
       
   213 /**
       
   214 * Abstract interface for handling the notification when remote lock settings 
       
   215 * are changed. User derives his class from this and implements 
       
   216 * HandleRemoteLockNotifyL().
       
   217 *
       
   218 * @lib rlocksettings.lib
       
   219 * @since S60 3.2
       
   220 */
       
   221 class MRemoteLockSettingsHandler
       
   222     {    
       
   223     public:
       
   224         /**
       
   225         * This function will be called when the remote lock settings are 
       
   226         * changed.
       
   227         *
       
   228         * @since S60 3.2
       
   229         * @param
       
   230         * @return 
       
   231         */
       
   232         virtual void HandleRemoteLockNotifyL() = 0; 
       
   233     };
       
   234 
       
   235 #endif
       
   236 //End of File.