localisation/apparchitecture/tef/TSidChecker/TestSidChecker.cpp
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    14 //
    14 //
    15 
    15 
    16 #include "TestSidChecker.h"
    16 #include "TestSidChecker.h"
    17 
    17 
    18 #include <e32std.h>
    18 #include <e32std.h>
    19 #include <ImplementationProxy.h>
    19 #include <ecom/implementationproxy.h>
    20 #include <e32property.h>
    20 #include <e32property.h>
    21 #include <e32test.h>
    21 #include <e32test.h>
    22 #include <e32debug.h>
    22 #include <e32debug.h>
    23 #include <f32file.h>
    23 #include <f32file.h>
    24 
    24 
    37 	{
    37 	{
    38 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
    38 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
    39 	return ImplementationTable;
    39 	return ImplementationTable;
    40 	}
    40 	}
    41 
    41 
    42 //////////////////////////////
    42 //
    43 // private class declarations
    43 // private class declarations
    44 //////////////////////////////
    44 //
    45 
    45 
    46 NONSHARABLE_CLASS(CApFileTestPropertyMonitor) : public CActive
    46 NONSHARABLE_CLASS(CApFileTestPropertyMonitor) : public CActive
    47 	{
    47 	{
    48 public:
    48 public:
    49 	static CApFileTestPropertyMonitor* NewL(TCallBack aCallBack);
    49 	static CApFileTestPropertyMonitor* NewL(TCallBack aCallBack);
    75 private:
    75 private:
    76 	TCallBack iCallBack;
    76 	TCallBack iCallBack;
    77 	RTimer iTimer;
    77 	RTimer iTimer;
    78 	};
    78 	};
    79 
    79 
    80 //////////////////////////////
    80 //
    81 // CApFileTestPropertyMonitor
    81 // CApFileTestPropertyMonitor
    82 //////////////////////////////
    82 //
    83 
    83 
    84 CApFileTestPropertyMonitor* CApFileTestPropertyMonitor::NewL(TCallBack aCallBack)
    84 CApFileTestPropertyMonitor* CApFileTestPropertyMonitor::NewL(TCallBack aCallBack)
    85 	{	
    85 	{	
    86 	CApFileTestPropertyMonitor* self = new(ELeave) CApFileTestPropertyMonitor(aCallBack);
    86 	CApFileTestPropertyMonitor* self = new(ELeave) CApFileTestPropertyMonitor(aCallBack);
    87 	TInt err = self->iProperty.Attach(KApFileTestPubSubCategory, KApFileTestPubSubCallBackKey);
    87 	TInt err = self->iProperty.Attach(KApFileTestPubSubCategory, KApFileTestPubSubCallBackKey);
   124 void CApFileTestPropertyMonitor::DoCancel()
   124 void CApFileTestPropertyMonitor::DoCancel()
   125 	{
   125 	{
   126 	iProperty.Cancel();
   126 	iProperty.Cancel();
   127 	}
   127 	}
   128 
   128 
   129 //////////////////////////////
   129 //
   130 // CApFileTestOneShotTimer
   130 // CApFileTestOneShotTimer
   131 //////////////////////////////
   131 //
   132 
   132 
   133 CApFileTestOneShotTimer* CApFileTestOneShotTimer::NewL(TCallBack aCallBack)
   133 CApFileTestOneShotTimer* CApFileTestOneShotTimer::NewL(TCallBack aCallBack)
   134 	{
   134 	{
   135 	CApFileTestOneShotTimer* self = new(ELeave) CApFileTestOneShotTimer(aCallBack);
   135 	CApFileTestOneShotTimer* self = new(ELeave) CApFileTestOneShotTimer(aCallBack);
   136 	TInt err = self->iTimer.CreateLocal();
   136 	TInt err = self->iTimer.CreateLocal();
   173 void CApFileTestOneShotTimer::DoCancel()
   173 void CApFileTestOneShotTimer::DoCancel()
   174 	{
   174 	{
   175 	iTimer.Cancel();
   175 	iTimer.Cancel();
   176 	}
   176 	}
   177 
   177 
   178 //////////////////////////////
   178 //
   179 // CTestSidChecker
   179 // CTestSidChecker
   180 //////////////////////////////
   180 //
   181 
   181 
   182 CTestSidChecker* CTestSidChecker::NewL()
   182 CTestSidChecker* CTestSidChecker::NewL()
   183 	{
   183 	{
   184 	CTestSidChecker* self = new(ELeave) CTestSidChecker();
   184 	CTestSidChecker* self = new(ELeave) CTestSidChecker();
   185 	return self;
   185 	return self;
   205 		#ifdef __WINS__
   205 		#ifdef __WINS__
   206 		TDriveUnit drive(EDriveX);
   206 		TDriveUnit drive(EDriveX);
   207 		#else
   207 		#else
   208 		TDriveUnit drive(EDriveX);
   208 		TDriveUnit drive(EDriveX);
   209 		RFs	fs;
   209 		RFs	fs;
   210 		User::LeaveIfError(fs.Connect());
   210 		TInt err = fs.Connect();
   211 		CleanupClosePushL(fs);
   211 		if (err != KErrNone)
       
   212 			return ret;
   212 		//The removable media is expected at D: on NAND ROM and at E: on normal ROMs.
   213 		//The removable media is expected at D: on NAND ROM and at E: on normal ROMs.
   213 		//The following code works on techview but not guaranteed to work on all platforms. 
   214 		//The following code works on techview but not guaranteed to work on all platforms. 
   214 		TDriveInfo driveInfo;
   215 		TDriveInfo driveInfo;
   215 		TInt error = fs.Drive(driveInfo, EDriveD);
   216 		TInt error = fs.Drive(driveInfo, EDriveD);
   216 		if(error == KErrNone && ((driveInfo.iDriveAtt & KDriveAttRemovable) != 0))
   217 		if(error == KErrNone && ((driveInfo.iDriveAtt & KDriveAttRemovable) != 0))
   226 			 	// Use drive E
   227 			 	// Use drive E
   227 			 	drive = EDriveE;
   228 			 	drive = EDriveE;
   228 			 	}
   229 			 	}
   229 			}
   230 			}
   230 		fs.Close();
   231 		fs.Close();
   231 		CleanupStack::PopAndDestroy(&fs);
       
   232 		#endif
   232 		#endif
   233 		ret = (aDrive == drive);
   233 		ret = (aDrive == drive);
   234 		}
   234 		}
   235 	else if(aSid == KApFileTestCallBackApp)
   235 	else if(aSid == KApFileTestCallBackApp)
   236 		{
   236 		{