locationcentre/lcserver/src/lcregistryupdate.cpp
changeset 0 522cd55cc3d7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationcentre/lcserver/src/lcregistryupdate.cpp	Tue Feb 02 00:16:03 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* 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:  Location Centre Server object.
+*
+*/
+
+
+// SYSTEM INCLUDES
+
+// USER INCLUDES
+#include "lcregistryupdate.h"
+#include "lcregistrationupdatenotifier.h"
+#include "lcdebug.h"
+
+// CONSTANT DEFINTIONS
+_LIT(KFileName,"?:\\private\\10283138\\import\\");
+
+const TInt KLCUpdateDelay = 2000000;
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::CLcRegistryUpdate
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CLcRegistryUpdate::CLcRegistryUpdate(MLcRegistryUpdateNotifier& aFileNotifier,
+    								 RFs& aFs)
+    :CActive(EPriorityStandard),
+    iFileNotifier( aFileNotifier ),
+    iFs( aFs )
+    {
+    TInt err = iTimer.CreateLocal();
+    CActiveScheduler::Add( this );    
+    }
+    
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CLcRegistryUpdate* CLcRegistryUpdate::NewL(MLcRegistryUpdateNotifier& aFileNotifier,
+    								   	   RFs& aFs)
+    {
+    CLcRegistryUpdate* self = new( ELeave ) CLcRegistryUpdate( aFileNotifier, aFs );    
+    return self;
+    }    
+    
+    
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::~CLcRegistryUpdate
+// ----------------------------------------------------------------------------
+//
+CLcRegistryUpdate::~CLcRegistryUpdate()
+    {
+    Cancel();
+    }  
+
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::ConstructL
+// ----------------------------------------------------------------------------
+//
+void CLcRegistryUpdate::ConstructL()
+    {    
+    }
+    
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::RunL
+// ----------------------------------------------------------------------------
+//
+void CLcRegistryUpdate::RunL()
+    { 
+    if ( iFileNotifyPending )
+        {    
+        StartFileNotifation();
+        iFileNotifier.HandleDynamicRegistrationL();
+        iFileNotifyPending = EFalse;       
+        }
+    else
+        {
+        iTimer.After( iStatus, KLCUpdateDelay );
+        SetActive();
+        iFileNotifyPending = ETrue;
+        }
+    }
+    
+
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::DoCancel
+// ----------------------------------------------------------------------------
+//
+void CLcRegistryUpdate::DoCancel()
+    {
+    iTimer.Cancel();
+    iFs.NotifyChangeCancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CLcRegistryUpdate::RunError
+// ---------------------------------------------------------------------------
+//        
+TInt CLcRegistryUpdate::RunError( TInt aError )
+    {
+    return aError;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CLcRegistryUpdate::StartFileNotifation
+// ----------------------------------------------------------------------------
+//
+void CLcRegistryUpdate::StartFileNotifation()
+    {
+    SetActive();  
+    iFs.NotifyChange(ENotifyEntry,iStatus,KFileName);
+    }
+    
+//End of File