void CScrEMMCComponentStep::ImplTestStepL() { TInt noOfComponents(0); GetIntFromConfig(ConfigSection(), KNoOfComponents, noOfComponents); TPtrC formatDrive; GetStringFromConfig(ConfigSection(), KFormatDrive, formatDrive); TInt drive; RFs fs; User::LeaveIfError(fs.Connect()); User::LeaveIfError(fs.CharToDrive(formatDrive[0], drive)); fs.Close(); TDriveList filterFormatDrive; filterFormatDrive.FillZ(KMaxDrives); filterFormatDrive[drive] = 1; CComponentFilter* componentFilter = CComponentFilter::NewLC(); componentFilter->SetInstalledDrivesL(filterFormatDrive); RArray<TComponentId> foundComponentIds; CleanupClosePushL(foundComponentIds); iScrSession.GetComponentIdsL(foundComponentIds, componentFilter); if (foundComponentIds.Count() != noOfComponents) { ERR_PRINTF1(_L("Mismatch for number of components found.")); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(2); }
void CListCommand::OptionHandlerL(const TPtrC& aName, const RArray<TPtrC>& aValues) { // Configure the component query filter: // Component name if (aName == KTxtListOptName) { AssertNumValuesL(aValues, 1); iFilter->SetNameL(aValues[0]); } // Vendor else if (aName == KTxtListOptVendor) { AssertNumValuesL(aValues, 1); iFilter->SetVendorL(aValues[0]); } // Software type else if (aName == KTxtListOptType) { AssertNumValuesL(aValues, 1); iFilter->SetSoftwareTypeL(aValues[0]); } // SCOMO state - Activated else if (aName == KTxtListOptActivated) { AssertNumValuesL(aValues, 0); // The activated and deactivated options are mutually exclusive if (iScomoStateSet) { User::Leave(KErrArgument); } iScomoStateSet = ETrue; iFilter->SetScomoStateL(EActivated); } // SCOMO state - Deactivated else if (aName == KTxtListOptDeactivated) { AssertNumValuesL(aValues, 0); // The activated and deactivated options are mutually exclusive if (iScomoStateSet) { User::Leave(KErrArgument); } iScomoStateSet = ETrue; iFilter->SetScomoStateL(EDeactivated); } // Removable else if (aName == KTxtListOptRemovable) { AssertNumValuesL(aValues, 0); iFilter->SetRemovable(ETrue); } // String property else if (aName == KTxtListOptProperty) { const TInt numValues = aValues.Count(); if (numValues < 2 || numValues > 3) { User::Leave(KErrArgument); } // Convert language from string to int if specified TInt language = KUnspecifiedLocale; if (numValues == 3) { TLex lex(aValues[2]); if (lex.Val(language) != KErrNone || language < ELangEnglish || language >= ELangMaximum) { User::Leave(KErrArgument); } } // Add the property to the filter iFilter->AddPropertyL(aValues[0], aValues[1], static_cast<TLanguage>(language)); } // Integer property else if (aName == KTxtListOptIntProperty) { AssertNumValuesL(aValues, 2); TLex lex(aValues[1]); TInt64 val; if (lex.Val(val) != KErrNone) { User::Leave(KErrArgument); } iFilter->AddPropertyL(aValues[0], val); } // Drives else if (aName == KTxtListOptDrives) { AssertNumValuesL(aValues, 1); TPtrC drives = aValues[0]; TDriveList driveList; driveList.FillZ(KMaxDrives); for (TInt i=0; i<drives.Length(); ++i) { TChar driveLetter = static_cast<TChar>(drives[i]); TInt driveNumber = 0; User::LeaveIfError(RFs::CharToDrive(driveLetter, driveNumber)); driveList[driveNumber] = ETrue; } iFilter->SetInstalledDrivesL(driveList); } // Locale else if (aName == KTxtListOptLocale) { AssertNumValuesL(aValues, 1); TLex lex(aValues[0]); TInt val; if (lex.Val(val) != KErrNone || val < ELangEnglish || val >= ELangNone) { User::Leave(KErrArgument); } iLocale = static_cast<TLanguage>(val); } // Unknown else { User::Leave(KErrArgument); } }