wmdrm/wmdrmengine/wmdrmserver/server/inc/clock.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:56:06 +0300
changeset 42 a7bc3704293e
parent 0 95b198f216e5
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Server definitions
*
*/


#ifndef __CLOCK_H
#define __CLOCK_H

#include <e32base.h>
#include <f32file.h>

class CWmDrmServer;

namespace DRM
    {
    class CDrmServiceApiWrapper;    
    }


class CClock : public CTimer
	{
public:
	static const TInt KClockInterval = 15 * 60 * 1000000;

    static CClock* NewL( CWmDrmServer* aServer );
	~CClock();
	CClock( CWmDrmServer* aServer );

    void ConstructL();

    void Start();

    static TInt ChangeCallback( TAny* aClock );

    void HandleChange();

    TInt ReadTimeL();

    TInt WriteTimeL();

    void EvaluateCurrentTime();

    TBool TimeIsGood();

    void SetTimeAsGoodL( TBool aGood );
    
    void GetTimeL( TTime& aTime, TBool& aValid );

protected:

    void RunL();

	CEnvironmentChangeNotifier* iChangeNotifier;
	TTime iTime;
	TBool iTimeIsGood;
	CWmDrmServer* iServer;

private:
    TInt LoadServiceApi();
    
    TBool iServiceApiLoaded;
	DRM::CDrmServiceApiWrapper* iServiceApi;
	RLibrary iServiceApiLib;

	};

#endif