sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // The implementation of the transition methods for the CRegistrar class. sl@0: // sl@0: // sl@0: sl@0: #include "RegistrarStateAccessor.h" sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarNewLTransition,"CRegistrar_NewL_Transition"); sl@0: sl@0: inline CRegistrar_NewL_Transition::CRegistrar_NewL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarNewLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_NewL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarNewLTransitMethod, "CRegistrar::NewL transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarNewLTransitMethod); sl@0: Context().iRegistrar = CRegistrar::NewL(Context().iRegistryData, Context().iRegistrarObserver, Context().iFs); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_NewL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarDtorTransition,"CRegistrar_Dtor_Transition"); sl@0: sl@0: inline CRegistrar_Dtor_Transition::CRegistrar_Dtor_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarDtorTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_Dtor_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarDtorTransitMethod, "CRegistrar::Dtor transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarDtorTransitMethod); sl@0: delete Context().iRegistrar; sl@0: Context().iRegistrar = NULL; sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_Dtor_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarDiscoveriesBeginTransition,"CRegistrar_DiscoveriesBegin_Transition"); sl@0: sl@0: inline CRegistrar_DiscoveriesBegin_Transition::CRegistrar_DiscoveriesBegin_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarDiscoveriesBeginTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_DiscoveriesBegin_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarDiscoveriesBeginTransitMethod, "CRegistrar::DiscoveriesBegin transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarDiscoveriesBeginTransitMethod); sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.DiscoveriesBegin(*(Context().iRegistrar)); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesBegin_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarDiscoveriesCompleteTransition,"CRegistrar_DiscoveriesComplete_Transition"); sl@0: sl@0: inline CRegistrar_DiscoveriesComplete_Transition::CRegistrar_DiscoveriesComplete_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarDiscoveriesCompleteTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_DiscoveriesComplete_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarDiscoveriesCompleteTransitMethod, "CRegistrar::DiscoveriesComplete transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarDiscoveriesCompleteTransitMethod); sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.DiscoveriesComplete(*(Context().iRegistrar), ETrue); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesComplete_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarResumeTransition,"CRegistrar_Resume_Transition"); sl@0: sl@0: inline CRegistrar_Resume_Transition::CRegistrar_Resume_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarResumeTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_Resume_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarResumeTransitMethod, "CRegistrar::Resume transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarResumeTransitMethod); sl@0: Context().iReturnErrorCode = Context().iRegistrar->Resume(); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_Resume_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarSuspendTransition,"CRegistrar_Suspend_Transition"); sl@0: sl@0: inline CRegistrar_Suspend_Transition::CRegistrar_Suspend_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarSuspendTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_Suspend_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarSuspendTransitMethod, "CRegistrar::Suspend transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarSuspendTransitMethod); sl@0: Context().iReturnErrorCode = Context().iRegistrar->Suspend(); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_Suspend_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarParseLTransition,"CRegistrar_ParseL_Transition"); sl@0: sl@0: inline CRegistrar_ParseL_Transition::CRegistrar_ParseL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransitionType(KRegistrarParseLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_ParseL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarParseLTransitMethod, "CRegistrar::ParseL transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarParseLTransitMethod); sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.ParseL(*Context().iRegistrar, *Context().iDllData, KResourceFileName); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_ParseL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarDisableTransition,"CRegistrar_Disable_Transition"); sl@0: sl@0: inline CRegistrar_Disable_Transition::CRegistrar_Disable_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarDisableTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_Disable_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarDisableTransitMethod, "CRegistrar::Disable transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarDisableTransitMethod); sl@0: Context().iReturnErrorCode = Context().iRegistrar->Disable(Context().iImplementationUid); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_Disable_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarDriveReinstatedLTransition,"CRegistrar_DriveReinstatedL_Transition"); sl@0: sl@0: inline CRegistrar_DriveReinstatedL_Transition::CRegistrar_DriveReinstatedL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransitionType(KRegistrarDriveReinstatedLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_DriveReinstatedL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarDriveReinstatedLTransitMethod, "CRegistrar::DriveReinstatedL transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarDriveReinstatedLTransitMethod); sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.DriveReinstatedL(*(Context().iRegistrar), Context().iDriveUnit); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_DriveReinstatedL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarDriveRemovedTransition,"CRegistrar_DriveRemoved_Transition"); sl@0: sl@0: inline CRegistrar_DriveRemoved_Transition::CRegistrar_DriveRemoved_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarDriveRemovedTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_DriveRemoved_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarDriveRemovedTransitMethod, "CRegistrar::DriveRemoved transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarDriveRemovedTransitMethod); sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.DriveRemoved(*(Context().iRegistrar), Context().iDriveUnit); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_DriveRemoved_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarEnableTransition,"CRegistrar_Enable_Transition"); sl@0: sl@0: inline CRegistrar_Enable_Transition::CRegistrar_Enable_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KRegistrarEnableTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_Enable_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarEnableTransitMethod, "CRegistrar::Enable transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarEnableTransitMethod); sl@0: Context().iReturnErrorCode = Context().iRegistrar->Enable(Context().iImplementationUid); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_Enable_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarRegisterDiscoveryLTransition,"CRegistrar_RegisterDiscoveryL_Transition"); sl@0: sl@0: inline CRegistrar_RegisterDiscoveryL_Transition::CRegistrar_RegisterDiscoveryL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransitionType(KRegistrarRegisterDiscoveryLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_RegisterDiscoveryL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarRegisterDiscoveryLTransitMethod, "CRegistrar::RegisterDiscoveryL transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarRegisterDiscoveryLTransitMethod); sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.RegisterDiscoveryL(*(Context().iRegistrar), Context().iDllEntry); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_RegisterDiscoveryL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KRegistrarParseRegistrationDataLTransition,"CRegistrar_ParseRegistrationDataL_Transition"); sl@0: sl@0: inline CRegistrar_ParseRegistrationDataL_Transition::CRegistrar_ParseRegistrationDataL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransitionType(KRegistrarParseRegistrationDataLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CRegistrar_ParseRegistrationDataL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KRegistrarParseRegistrationDataLTransitMethod, "CRegistrar::ParseRegistrationDataL transition"); sl@0: Context().DataLogger().LogInformation(KRegistrarParseRegistrationDataLTransitMethod); sl@0: // Find the appropriate drive entry sl@0: TChar driveLetter = User::UpperCase((Context().iDllEntry.iName)[0]) - 'A'; sl@0: TDriveUnit driveUnit = EDriveA + driveLetter; sl@0: TRegistrar_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor()); sl@0: accessor.ParseRegistrationDataL(*Context().iRegistrar, sl@0: Context().iDllEntry, sl@0: KResourceFileName, sl@0: driveUnit, sl@0: Context().iUpdate, sl@0: Context().iIndex); sl@0: } sl@0: sl@0: inline CRegistrar_UnitTestContext& CRegistrar_ParseRegistrationDataL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext); sl@0: } sl@0: