breakdeps/DRMEngine/DRMClock.cpp
author Tom Pritchard <tomp@symbian.org>
Wed, 27 Oct 2010 15:05:33 +0100
changeset 90 62156f66dbad
parent 88 ca165d35976d
permissions -rw-r--r--
Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
/*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
* Contributors:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
* Description:  Implementation of the DRM Clock
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    15
*
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
*/
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
// INCLUDE FILES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
#include <mmtsy_names.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    22
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
#include "DRMClock.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
#include "drmlog.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
#include "DRMEventTimeChange.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
#include "wmdrmfileserverclient.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
#include <DRMNotifier.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
#include <s32strm.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
#include <s32file.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    31
#include <e32property.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
#include <e32keys.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
#ifdef RD_MULTIPLE_DRIVE
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    35
#include <driveinfo.h>
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
#include "DRMNitzObserver.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
#include "GPSWatcher.h"
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
// EXTERNAL DATA STRUCTURES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
// EXTERNAL FUNCTION PROTOTYPES  
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
// CONSTANTS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
const TInt KMinuteInMicroseconds = 60000000;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
const TInt KTimeZoneIncrement = 15;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
// The time zones sanity check values, not sure if -13 hours exists
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
// But atleast +13 does in: Nuku'Alofa
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    51
const TInt KTimeZoneLow = -52; // -13 hours
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
const TInt KTimeZoneHigh = 55; // +13 hours 45 minutes Some NZ owned island
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
// MACROS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    57
// LOCAL CONSTANTS AND MACROS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
// MODULE DATA STRUCTURES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
// LOCAL FUNCTION PROTOTYPES
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
// FORWARD DECLARATIONS
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
// ============================= LOCAL FUNCTIONS ===============================
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    67
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
// ============================ MEMBER FUNCTIONS ===============================
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
// CDRMRightsDB::CDRMRightsDB
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
// C++ default constructor can NOT contain any code, that
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    74
// might leave.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
//    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
CDRMClock::CDRMClock()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
    {      
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
// CDRMRightsDB::ConstructL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
// Symbian 2nd phase constructor can leave.
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    85
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
void CDRMClock::ConstructL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
    DRMLOG( _L( "DRM Clock Starting: " ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
    TInt error = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
    // Create a notifier instance
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    92
    iNotifier = CDRMNotifier::NewL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
        
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
    94
#if 0 //ndef __WINS__
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
    ConnectToPhoneL();            
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
            
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
    iObserver = CDRMNitzObserver::NewL( iPhone, const_cast<CDRMClock*>(this));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
    iObserver->Start();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
    TRAP( error, iGpsWatcher = CGPSWatcher::NewL( const_cast<CDRMClock*>(this) ));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
    DRMLOG2( _L("DRMClock: GPS watcher started: %d"), error );    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
#endif
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105
    DRMLOG( _L( "DRM Clock started" ) );		    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   106
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   107
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   108
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   109
// CDRMClock::NewLC
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   110
// Two-phased constructor
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   111
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   112
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   113
CDRMClock* CDRMClock::NewLC()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   114
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   115
    DRMLOG( _L( "CDRMClock::NewLC" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   116
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   117
    CDRMClock* self = new(ELeave) CDRMClock;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   118
    CleanupStack::PushL( self );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   119
    self->ConstructL();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   120
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   121
    DRMLOG( _L( "CDRMClock::NewLC ok" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   122
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   123
    return self;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   124
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   125
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   126
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   127
// CDRMClock::NewL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   128
// Two-phased constructor
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   129
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   130
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   131
CDRMClock* CDRMClock::NewL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   132
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   133
    DRMLOG( _L( "CDRMClock::NewL" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   134
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   135
    CDRMClock* self = NewLC();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   136
    CleanupStack::Pop();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   137
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   138
    DRMLOG( _L( "CDRMClock::NewL ok" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   139
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   140
    return self;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   141
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   142
  
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   143
// ---------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   144
// CDRMClock::~CDRMClock
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   145
// Destructor
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   146
// ---------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   147
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   148
CDRMClock::~CDRMClock()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   149
    { 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   150
    DRMLOG( _L( "CDRMClock::~CDRMClock" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   151
       
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   152
    if( iNotifier )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   153
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   154
        delete iNotifier;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   155
        iNotifier = 0;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   156
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   157
        
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   158
#if 0 //ndef __WINS__
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   159
    if(iObserver)            
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   160
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   161
        iObserver->Cancel();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   162
        delete iObserver;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   163
        iObserver = 0;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   164
        }  
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   165
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   166
    if( iGpsWatcher )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   167
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   168
        iGpsWatcher->Cancel();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   169
        delete iGpsWatcher;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   170
        iGpsWatcher = 0;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   171
        }   
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   172
#endif // __WINS__        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   173
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   174
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   175
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   176
// CDRMClock::GetSecureTime
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   177
// returns time and security level
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   178
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   179
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   180
void CDRMClock::GetSecureTime(TTime& aTime, TInt& aTimeZone, 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   181
                              DRMClock::ESecurityLevel& aSecurityLevel)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   182
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   183
    DRMLOG( _L( "CDRMClock::GetSecureTime" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   184
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   185
    TTime currentUniversal;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   186
    TTime currentHome;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   187
    TInt error = KErrNone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   188
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   189
    // if there is an error it's not initialized
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   190
    error = aTime.UniversalTimeSecure();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   191
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   192
    if( error == KErrNoSecureTime )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   193
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   194
        currentHome.HomeTime();               
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   195
        currentUniversal.UniversalTime();         
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   196
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   197
        aTimeZone = ( currentHome.Int64() - currentUniversal.Int64() ) / 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   198
                   ( KMinuteInMicroseconds* KTimeZoneIncrement );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   199
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   200
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   201
        aTime.UniversalTime();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   202
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   203
        aSecurityLevel = DRMClock::KInsecure; 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   204
       
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   205
        DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Insecure" ) );        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   206
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   207
    else 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   208
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   209
        currentHome.HomeTimeSecure();        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   210
        currentUniversal.UniversalTimeSecure();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   211
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   212
        aTimeZone = ( currentHome.Int64() - currentUniversal.Int64() ) / 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   213
                   ( KMinuteInMicroseconds* KTimeZoneIncrement );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   214
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   215
        aSecurityLevel = DRMClock::KSecure;     
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   216
        DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Secure" ) );  
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   217
        }    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   218
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   219
    DRMLOG( _L( "CDRMClock::GetSecureTime ok" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   220
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   221
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   222
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   223
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   224
// CDRMClock::ResetSecureTimeL
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   225
// resets the secure time and recalculates the offsets
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   226
// should not reset to 0
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   227
// -----------------------------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   228
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   229
// Do not reset the timezone, use whatever has been set or retrieved from the UI time
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   230
// However check that the timezone is a valid one just in case
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   231
void CDRMClock::ResetSecureTimeL( const TTime& aTime, const TInt& aTimeZone )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   232
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   233
    DRMLOG( _L( "CDRMClock::ResetSecureTimeL" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   234
   
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   235
    TRequestStatus status;  
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   236
    TInt error = KErrNone;  
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   237
    CDRMEventTimeChange* change = CDRMEventTimeChange::NewLC();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   238
	TTime previousTime;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   239
	TTime previousTimeLocal;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   240
	TTime newTime;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   241
	TInt timezone = 0;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   242
	TDateTime temppi; // Only for logging
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   243
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   244
    // check for param that the time is even reasonably valid:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   245
    if( aTime.Int64() == 0 )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   246
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   247
        DRMLOG( _L("Trying to reset to zero time") );             
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   248
    	User::Leave( KErrArgument );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   249
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   250
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   251
    // Sanity check: Time zone has to be +/- certail hours
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   252
    // for this check -13h to +13.75h
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   253
    if( aTimeZone < KTimeZoneLow || aTimeZone > KTimeZoneHigh )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   254
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   255
        DRMLOG2( _L("TimeZone invalid, time may be as well, aborting change: %d"), aTimeZone  );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   256
        User::Leave( KErrArgument );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   257
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   258
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   259
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   260
    // Get the current secure time with timezone
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   261
    // Ask the hometime first so that rounding of any divider goes correctly
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   262
    error = previousTimeLocal.HomeTimeSecure(); 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   263
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   264
    // If there is an error, the secure hometime has not been set
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   265
    // Which means that the UI clock has the valid data
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   266
    if( error )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   267
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   268
        previousTimeLocal.HomeTime();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   269
        previousTime.UniversalTime();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   270
        timezone = ( previousTimeLocal.Int64() - previousTime.Int64() ) / 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   271
                   ( KMinuteInMicroseconds* KTimeZoneIncrement );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   272
		change->SetOldSecurityLevel( DRMClock::KInsecure );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   273
		}
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   274
	else
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   275
		{
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   276
		previousTime.UniversalTimeSecure();		                   
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   277
        
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   278
        timezone = ( previousTimeLocal.Int64() - previousTime.Int64() ) / 
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   279
                   ( KMinuteInMicroseconds* KTimeZoneIncrement );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   280
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   281
		change->SetOldSecurityLevel( DRMClock::KSecure );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   282
		change->SetNewSecurityLevel( DRMClock::KSecure );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   283
		}
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   284
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   285
    // Since it's not important to get the timezone we keep what is set or reset it:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   286
    previousTimeLocal = aTime.Int64() + ( timezone * ( KMinuteInMicroseconds* KTimeZoneIncrement ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   287
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   288
    // Do the actual updating:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   289
    // Update using the wmdrm fileserver since it has TCB capability
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   290
    RWmDrmFileServerClient resetclient;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   291
    User::LeaveIfError( resetclient.Connect() );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   292
    CleanupClosePushL( resetclient );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   293
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   294
    newTime = aTime;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   295
    User::LeaveIfError( resetclient.UpdateSecureTime( previousTimeLocal, newTime ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   296
       
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   297
    CleanupStack::PopAndDestroy();
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   298
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   299
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   300
    DRMLOG( _L( "CDRMClock::ResetSecureTimeL: AFTER RESET." ));	
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   301
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   302
    // DRM Notifier data:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   303
    // send info about the change:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   304
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   305
    change->SetNewSecurityLevel( DRMClock::KSecure );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   306
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   307
    change->SetOldTime( previousTime );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   308
    change->SetOldTimeZone( timezone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   309
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   310
    change->SetNewTime( aTime );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   311
    change->SetNewTimeZone( timezone );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   312
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   313
    // Notify clients
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   314
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   315
    iNotifier->SendEventL(*change,status);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   316
    User::WaitForRequest(status);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   317
    CleanupStack::PopAndDestroy();    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   318
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   319
    DRMLOG( _L( "CDRMClock::ResetSecureTimeL ok" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   320
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   321
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   322
// ---------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   323
// CDRMClock::Notify
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   324
// Notify DRM clock about an event
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   325
// ---------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   326
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   327
void CDRMClock::Notify( TInt aNotify )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   328
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   329
    switch( aNotify )
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   330
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   331
        case ENotifyGPSTimeReceived:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   332
            // GPS time received, listen again after the next boot, destroy GPS watcher:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   333
            DRMLOG(_L("Notify: ENotifyGPSTimeReceived, Deleting GPS watcher"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   334
            delete iGpsWatcher;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   335
            iGpsWatcher = NULL;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   336
            DRMLOG(_L("Notify: GPS Watcher deleted"));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   337
            break;    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   338
        case ENotifyNone:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   339
        default:
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   340
            break;  // Do nothing    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   341
        }    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   342
    }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   343
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   344
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   345
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   346
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   347
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   348
// ---------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   349
// CDRMClock::ConnectToPhoneL(const TDateTime& aDateTime)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   350
// Gets the nitz time from iNitzInfo
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   351
// ---------------------------------------------------------
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   352
//
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   353
void CDRMClock::ConnectToPhoneL()
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   354
    {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   355
    DRMLOG( _L( "CDRMClock::ConnectToPhoneL" ) );
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   356
#if 0    
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   357
    const TInt KTriesToConnectServer(10);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   358
    const TInt KTimeBeforeRetryingServerConnection(100000);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   359
    TInt thisTry(0);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   360
    TInt err(KErrNone);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   361
    TInt numPhone;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   362
    TName tsyName;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   363
    RTelServer::TPhoneInfo phoneInfo;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   364
    RMobilePhone::TMobilePhoneSubscriberId imsi;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   365
    TRequestStatus status;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   366
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   367
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   368
    while ((err = iEtelServer.Connect()) != KErrNone &&
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   369
                            (thisTry++) <= KTriesToConnectServer)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   370
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   371
        User::After(KTimeBeforeRetryingServerConnection);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   372
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   373
    User::LeaveIfError(err);
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   374
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   375
    User::LeaveIfError(iEtelServer.LoadPhoneModule(KMmTsyModuleName));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   376
    User::LeaveIfError(iEtelServer.EnumeratePhones(numPhone));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   377
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   378
    for (TInt i(0); i < numPhone; i++)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   379
        {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   380
        User::LeaveIfError(iEtelServer.GetPhoneInfo(i, phoneInfo));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   381
        User::LeaveIfError(iEtelServer.GetTsyName(i,tsyName));
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   382
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   383
        if (tsyName.CompareF(KMmTsyModuleName) == 0)
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   384
            {
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   385
            break;
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   386
            }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   387
        }
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   388
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   389
    User::LeaveIfError(iPhone.Open(iEtelServer, phoneInfo.iName));   
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   390
    
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   391
    iPhone.GetSubscriberId( status, imsi );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   392
    User::WaitForRequest( status );
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   393
	
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   394
    DRMLOG( imsi );    
90
62156f66dbad Breaking DRM's dependency Etel so that AVKON can start. The ROM now boots, but doesn't seem to have any items in the matrix menu at all.
Tom Pritchard <tomp@symbian.org>
parents: 88
diff changeset
   395
 #endif   
88
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   396
    DRMLOG( _L( "CDRMClock::ConnectToPhoneL ok" ) );
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   397
    };
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   398
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   399
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   400
// ========================== OTHER EXPORTED FUNCTIONS =========================
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   401
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   402
ca165d35976d Adding parts of the DRM Engine to be rebuilt
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   403
//  End of File