omadrm/drmengine/drmclock/Inc/DRMNitzObserver.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     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:  Nitz information observer used by DRMClock
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DRMNITZOBSERVER_H
       
    20 #define DRMNITZOBSERVER_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>	// CBase
       
    25 #include <e32std.h>
       
    26 #include <e32def.h>		// Type definitions
       
    27 #include <bacntf.h>
       
    28 #include <etelmm.h>
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 // CLASS DECLARATION
       
    41 class CDRMClock;
       
    42 
       
    43 /**
       
    44 *  CDRMNitzObserver implements the NITZ observer
       
    45 *  required by DRM Clock
       
    46 *
       
    47 *  @lib unipertar.exe
       
    48 *  @since 2.8
       
    49 */
       
    50 NONSHARABLE_CLASS( CDRMNitzObserver ) : public CActive
       
    51     {
       
    52     public:
       
    53         /**
       
    54         * NewL
       
    55         *
       
    56         * Creates an instance of the CDRMNitzObserver class and returns a pointer to it
       
    57         *
       
    58         * @since  2.8
       
    59         * @param aMobilePhone : connected handle to RMobilePhone
       
    60         * @param aDRMClock : pointer to an instance of CDRMClock
       
    61         * @return Functional CDRMNitzObserver object, Function leaves if an error occurs.
       
    62         */    
       
    63         static CDRMNitzObserver* NewL( RMobilePhone& aMobilePhone, 
       
    64                                        CDRMClock* aDRMClock);
       
    65         
       
    66         /**
       
    67         * Start
       
    68         *
       
    69         * Adds the instance to the active scheduler unless it's already there and
       
    70         * completes a request so RunL() gets called.
       
    71         *
       
    72         * @since  2.8
       
    73         * @return none
       
    74         */  
       
    75         void Start();  
       
    76          
       
    77         /**
       
    78         * From CActive: RunL catches events from The phone server
       
    79         */
       
    80         void RunL();
       
    81                   
       
    82         void DoCancel();
       
    83         
       
    84         // Destructor
       
    85         virtual ~CDRMNitzObserver();
       
    86 
       
    87     protected:
       
    88           
       
    89         /**
       
    90         * From CActive: RunError checks the errors from RunL.
       
    91         */
       
    92         TInt RunError( TInt aError );   
       
    93     
       
    94     private:
       
    95         /* constructor */
       
    96         CDRMNitzObserver( RMobilePhone& aMobilePhone, CDRMClock* aDRMClock);
       
    97         
       
    98         /* secondary constructor */
       
    99         void ConstructL();
       
   100             
       
   101         /**
       
   102         * CheckDateTimeVal
       
   103         *
       
   104         * Validates the given datetime
       
   105         *
       
   106         * @since 2.8
       
   107         * @param aDateTime : the time to be validated
       
   108         * @return System wide error code
       
   109         */
       
   110         TInt CheckDateTimeVal(const TDateTime& aDateTime);
       
   111 
       
   112         /**
       
   113         * GetNitzTime
       
   114         *
       
   115         * Gets the NITZ time
       
   116         *
       
   117         * @since 2.8
       
   118         * @param aNitzTime : the requested NITZ time in UTC 
       
   119         * @param aTimeZone : the timezone in +/- 15 minutes 
       
   120         * @return ETrue if NITZ is available a
       
   121         *         EFalse if NITZ is not available
       
   122         */
       
   123         TBool GetNitzTime(TTime& aNitzTime, TInt& aTimeZone);
       
   124                
       
   125         CDRMClock* iDRMClock;
       
   126         RMobilePhone* iMobilePhone;
       
   127         RMobilePhone::TMobilePhoneNITZ iNitzInfo;
       
   128         TInt iError;
       
   129     };
       
   130     
       
   131 #endif // DRMNITZOBSERVER_H
       
   132 
       
   133 // End of File