--- a/omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp Fri Mar 12 15:43:46 2010 +0200
+++ b/omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp Mon Mar 15 12:41:43 2010 +0200
@@ -21,13 +21,13 @@
#include <e32base.h>
#include <e32std.h>
#include <f32file.h>
-#include <ActiveIdle2DomainPSKeys.h>
+#include <activeidle2domainpskeys.h>
#include <e32property.h> //for RProperty
#include "IdleObserver.h"
#include "DRMHelperServer.h"
// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES
+// EXTERNAL FUNCTION PROTOTYPES
// CONSTANTS
// MACROS
// LOCAL CONSTANTS AND MACROS
@@ -35,24 +35,24 @@
#ifdef _DRM_TESTING
LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName )
- {
+ {
RFile file;
- TInt size;
+ TInt size;
User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) );
CleanupClosePushL( file );
User::LeaveIfError( file.Size( size ) );
- User::LeaveIfError( file.Write( size, text ) );
+ User::LeaveIfError( file.Write( size, text ) );
CleanupStack::PopAndDestroy(&file); //file
- }
+ }
LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs )
- {
- _LIT( KLogFile , "c:\\IOLog.txt" );
- WriteFileL( text , aFs , KLogFile );
- }
+ {
+ _LIT( KLogFile , "c:\\IOLog.txt" );
+ WriteFileL( text , aFs , KLogFile );
+ }
LOCAL_C void CreateLogL()
- {
+ {
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
@@ -60,47 +60,47 @@
User::LeaveIfError( file.Replace( fs , _L("c:\\IOLog.txt") , EFileWrite ) );
file.Close();
CleanupStack::PopAndDestroy(&fs); //fs
- }
+ }
LOCAL_C void WriteL( const TDesC& aText )
- {
+ {
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL(fs);
- HBufC8* text = HBufC8::NewLC(1000);
- TPtr8 textptr(text->Des() );
- textptr.Append( aText );
+ HBufC8* text = HBufC8::NewLC(1000);
+ TPtr8 textptr(text->Des() );
+ textptr.Append( aText );
textptr.Append(_L( "\r\n" ));
- WriteLogL(textptr , fs);
+ WriteLogL(textptr , fs);
CleanupStack::PopAndDestroy(text);
CleanupStack::PopAndDestroy(&fs); //fs
- }
+ }
LOCAL_C void WriteCurrentTimeL()
- {
+ {
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL(fs);
- HBufC8* text = HBufC8::NewLC(100);
- TPtr8 textptr(text->Des() );
+ HBufC8* text = HBufC8::NewLC(100);
+ TPtr8 textptr(text->Des() );
// Date and Time display
TTime time;
time.HomeTime();
- TBuf<256> dateString;
- _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3");
- time.FormatL(dateString,KDate);
- textptr.Append(_L( "\r\n\t\tData:\t" ) );
- textptr.Append( dateString );
- _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B");
- time.FormatL(dateString,KTime);
- textptr.Append(_L( "\r\n\t\tTime:\t" ) );
- textptr.Append( dateString );
- textptr.Append(_L( "\r\n" ) );
- textptr.Append(_L( "\r\n" ) );
- WriteLogL(textptr , fs);
+ TBuf<256> dateString;
+ _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3");
+ time.FormatL(dateString,KDate);
+ textptr.Append(_L( "\r\n\t\tData:\t" ) );
+ textptr.Append( dateString );
+ _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B");
+ time.FormatL(dateString,KTime);
+ textptr.Append(_L( "\r\n\t\tTime:\t" ) );
+ textptr.Append( dateString );
+ textptr.Append(_L( "\r\n" ) );
+ textptr.Append(_L( "\r\n" ) );
+ WriteLogL(textptr , fs);
CleanupStack::PopAndDestroy(text);
CleanupStack::PopAndDestroy(&fs); //fs
- }
+ }
#endif
// MODULE DATA STRUCTURES
// LOCAL FUNCTION PROTOTYPES
@@ -136,7 +136,7 @@
#endif
User::LeaveIfError( iProperty.Attach( KPSUidAiInformation, KActiveIdleState ) );
}
-
+
// -----------------------------------------------------------------------------
// CIdleObserver::NewL
// Two-phased constructor.
@@ -145,7 +145,7 @@
CIdleObserver* CIdleObserver::NewL(CDRMHelperServer& aServer)
{
CIdleObserver* self = new( ELeave ) CIdleObserver(aServer);
-
+
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop(self);
@@ -153,12 +153,12 @@
return self;
}
-
+
// Destructor
CIdleObserver::~CIdleObserver()
{
#ifdef _DRM_TESTING
- TRAPD( err , WriteL(_L("CIdleObserver-Destruct")) );
+ TRAPD( err , WriteL(_L("CIdleObserver-Destruct")) );
TRAP( err , WriteCurrentTimeL() );
#endif
Cancel();
@@ -192,23 +192,23 @@
//
void CIdleObserver::RunL()
{
-#ifdef _DRM_TESTING
+#ifdef _DRM_TESTING
//test code start
WriteL(_L("RunL"));
WriteCurrentTimeL();
//test code end
#endif
-
+
// Resubscribe before processing new value to prevent missing updates
TInt idleStauts = 0;
TInt err( iStatus.Int() );
if (err == KErrNone)
{
StartL();
- User::LeaveIfError( iProperty.Get(
- KPSUidAiInformation,
+ User::LeaveIfError( iProperty.Get(
+ KPSUidAiInformation,
KActiveIdleState, idleStauts ) );
- if ( idleStauts == EPSAiForeground )
+ if ( idleStauts == EPSAiForeground )
{
iServer.HandleIdleL();
}
@@ -216,7 +216,7 @@
else if ( err != KErrCancel )
{
StartL();
- }
+ }
}
// -----------------------------------------------------------------------------
@@ -235,4 +235,4 @@
}
// ========================== OTHER EXPORTED FUNCTIONS =========================
-// End of File
+// End of File