--- a/fotaapplication/fotaserver/fmsclient/src/fmsclient.cpp Tue Jul 13 09:26:23 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
-* Copyright (c) 2009 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: Implementation of fotaserver component
-* This is part of fotaapplication.
-*
-*/
-
-#include <f32file.h>
-#include <fotaConst.h>
-#include <fotaengine.h>
-#include "fmsclientserver.h"
-#include "fmsclient.h"
-#include "fmsclientdebug.h"
-
-#include "fotaserverPrivateCRKeys.h"
-#include <centralrepository.h>
-// ---------------------------------------------------------------------------
-// IsSecureClient()
-// Checks who is trying to launch FMS
-// ---------------------------------------------------------------------------
-TBool IsSecureClient(TBool& aFotaStartUp)
- {
- FLOG(_L("IsSecureClient Started"));
- RThread thread;
- TUid fotaserver,fotastartup;
- fotaserver.iUid = KFotaServerUid;
- fotastartup.iUid = KStarterUid;
- if ( thread.SecureId() == fotaserver.iUid )
- {
- FLOG(_L("fmsclient fotaserver is using the service"));
- return ETrue;
- }
- else if ( thread.SecureId() == fotastartup.iUid )
- {
- FLOG(_L("fmsclient fotastartupplugin is using the service"));
- aFotaStartUp = ETrue;
- return ETrue;
- }
- else if (thread.SecureId() == 0x01D278B9 ) //test app
- {
- FLOG(_L("fmsclient test app is using the service"));
- return ETrue;
- }
- FLOG(_L("fmsclient not launched"));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// StartServerL()
-// Starts Fota Downlaod Interrupt Monitory server
-// ---------------------------------------------------------------------------
-TInt StartServerL()
- {
- FLOG(_L("StartServerLt Started"));
- TInt res = KErrNone;
- RProcess server;
- res=server.Create(KFMSServerName,KNullDesC);
- FLOG(_L("StartServerL-- create server error as %d"),res);
- if (res!=KErrNone)
- {
- return res;
- }
- TRequestStatus stat;
- server.Rendezvous(stat);
- if (stat!=KRequestPending)
- server.Kill(0); // abort startup
- else
- server.Resume(); // logon OK - start the server
- User::WaitForRequest(stat); // wait for start or death
- res=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
- FLOG(_L("StartServerL-- server.ExitType() returns %d"),res);
- server.Close();
- return res;
- }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::OpenL()
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFMSClient::OpenL()
- {
- FLOG(_L("RFMSClient::OpenL()- Begin"));
- TInt res = KErrNone;
- TBool FotaStartUp = EFalse;
- if( IsSecureClient(FotaStartUp))
- {
- FLOG(_L("RFMSClient::OpenL()- Secured client"));
- res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
- if ( res != KErrNone )
- {
- FLOG(_L("RFMSClient::OpenL()- session not created"));
- res = StartServerL();
- User::LeaveIfError( res );
- res = CreateSession( KFMSServerName,TVersion(1,0,0),2 );
- }
- User::LeaveIfError( res );
- FLOG(_L("RFMSClient::OpenL()- session created"));
- CRepository* centrep2 = NULL;
- TRAPD( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) )
- TInt val = KErrNone;
- if (err==KErrNone )
- {
- centrep2->Get( KFotaUpdateState, val );
- delete centrep2;
- }
-
- centrep2 = NULL;
-
- if( FotaStartUp && val == EFotaDownloadInterrupted )
- {
- FLOG(_L("RFMSClient::OpenL()- fotastartup using FMS session"));
- SendInterruptParamsL();
- }
- }
- else //not a secured client
- {
- FLOG(_L("fmsclient not launched--insecured client"));
- res = KErrNotFound;
- }
- FLOG(_L("RFMSClient::OpenL()- End %d"),res);
- return res;
- }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::Close()
-// ---------------------------------------------------------------------------
-EXPORT_C void RFMSClient::Close()
- {
- FLOG(_L(" RFMSClient::Close"));
- RSessionBase::Close(); //basecall
- }
-
-// ----------------------------------------------------------------------------
-// RFMSClient::NotifyForResumeL()
-// ----------------------------------------------------------------------------
-EXPORT_C void RFMSClient::NotifyForResumeL(const TOmaDLInterruptReason& aReason,
- const TInt& aBearer, const TDriveNumber& aDrive, const TInt& aSize)
- {
- FLOG(_L(" RFMSClient::NotifyForResumeL--Begin"));
- TInt Size(aSize),Drive((TInt)aDrive),Bearer(aBearer);
- TInt err = SendReceive( (TInt)aReason, TIpcArgs(Bearer,Drive,Size));
- FLOG(_L(" RFMSClient::NotifyForResumeL--End error as %d"),err);
- }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::SendInterruptParamsL() called only when fotastartup launched
-// ---------------------------------------------------------------------------
-void RFMSClient::SendInterruptParamsL()
- {
- FLOG(_L(" RFMSClient::SendInterruptParamsL--Begin"));
- TInt err = Send( EFotaStartUpPlugin );
- FLOG(_L(" RFMSClient::SendInterruptParamsL--End as %d"),err);
- }
-// ---------------------------------------------------------------------------
-// RFMSClient::CancelNotifyForResume()
-// ---------------------------------------------------------------------------
-EXPORT_C void RFMSClient::CancelNotifyForResume()
- {
- FLOG(_L(" RFMSClient::CancelNotifyForResume--Begin"));
- TInt err = Send( ECancelOutstandingRequest );
- FLOG(_L(" RFMSClient::CancelNotifyForResume--End as %d"),err);
- }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::MonitorForBatteryL()
-// ---------------------------------------------------------------------------
-EXPORT_C void RFMSClient::MonitorForBatteryL(TUint aLevel)
- {
- FLOG(_L(" RFMSClient::MonitorForBatteryL--Begin, level = %d"), aLevel);
- TInt err = SendReceive( EMonitorbattery, TIpcArgs (aLevel));
- FLOG(_L(" RFMSClient::MonitorForBatterL--End as %d"),err);
- User::LeaveIfError(err);
- }
-// ---------------------------------------------------------------------------
-// RFMSClient::Cancel()
-// ---------------------------------------------------------------------------
-EXPORT_C void RFMSClient::Cancel()
- {
- FLOG(_L(" RFMSClient::Cancel--Begin"));
- TInt err = SendReceive( ECancelOutstandingRequest );
- FLOG(_L(" RFMSClient::Cancel--End as %d"),err);
- }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::ActivePhoneCallSync()
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFMSClient::IsPhoneCallActive(TInt& aCallActive)
- {
- FLOG(_L(" RFMSClient::IsPhoneCallActive--Begin"));
- TPckgBuf<TInt> result(aCallActive);
- TInt err = SendReceive( EPhoneCallActive,TIpcArgs(&result));
- aCallActive=result();
- FLOG(_L(" RFMSClient::IsPhoneCallActive--End as %d,%d"),err,aCallActive);
- return err;
- }
-
-// ---------------------------------------------------------------------------
-// RFMSClient::MonitorActivePhoneCallEnd()
-// ---------------------------------------------------------------------------
-EXPORT_C TInt RFMSClient::MonitorActivePhoneCallEnd(TInt aPkgId,TInt aProfileId)
- {
- FLOG(_L(" RFMSClient::MonitorActivePhoneCallEnd--Begin, pkgid:%d, \
- / profileid:%d"),aPkgId,aProfileId);
- TInt err = SendReceive( EMonitorPhoneCallEnd, TIpcArgs(aPkgId,aProfileId));
- FLOG(_L(" RFMSClient::MonitorActivePhoneCallEnd--End as %d"),err);
- return err;
- }
-//End of file