bluetoothmgmt/btmgr/BTManServer/btmanserverburstatemachine.cpp
branchRCL_3
changeset 13 20fda83a6398
equal deleted inserted replaced
12:8a27654f7b62 13:20fda83a6398
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implements the state machine which drives backup and restore support for the 
       
    15 // Bluetooth Manager server.
       
    16 //
       
    17 
       
    18 #include <e32std.h>
       
    19 #include <e32base.h>
       
    20 #include "btmanserverburmgr.h"
       
    21 
       
    22 #include <bluetooth/logger.h>
       
    23 
       
    24 #ifdef __FLOG_ACTIVE
       
    25 _LIT8(KLogComponent, LOG_COMPONENT_BT_MANAGER_SERVER);
       
    26 #endif
       
    27 
       
    28 /**
       
    29 CBTManServerBURMgrStateFactory - Manages the state machine that drives CBTManServerBURMgr
       
    30 **/
       
    31 
       
    32 CBTManServerBURMgrStateFactory* CBTManServerBURMgrStateFactory::NewL(CBTManServerBURMgr& aBURMgr)
       
    33 	{
       
    34 	LOG_STATIC_FUNC
       
    35 
       
    36 	CBTManServerBURMgrStateFactory* result = new (ELeave) CBTManServerBURMgrStateFactory(aBURMgr);
       
    37 	CleanupStack::PushL(result);
       
    38 	result->ConstructL();
       
    39 	CleanupStack::Pop(result);
       
    40 	return result;
       
    41 	}
       
    42 
       
    43 CBTManServerBURMgrStateFactory::CBTManServerBURMgrStateFactory(CBTManServerBURMgr& aBURMgr) 
       
    44 	: iBURMgr(aBURMgr), 
       
    45 	iState(EBTBURStateNormal)
       
    46 	{
       
    47 	LOG_FUNC
       
    48 	}
       
    49 
       
    50 CBTManServerBURMgrStateFactory::~CBTManServerBURMgrStateFactory()
       
    51 	{
       
    52 	LOG_FUNC
       
    53 
       
    54 	// Destroy state machine
       
    55 	iStateActions.ResetAndDestroy();
       
    56 	}
       
    57 
       
    58 void CBTManServerBURMgrStateFactory::ConstructL()
       
    59 	{
       
    60 	LOG_FUNC
       
    61 
       
    62 	ConstructStateMachineL();
       
    63 	}
       
    64 
       
    65 void CBTManServerBURMgrStateFactory::ConstructStateMachineL()
       
    66 	{
       
    67 	LOG_FUNC
       
    68 
       
    69 	// Construct the state instances - each state knows how to carry out its action and its possible transitions
       
    70 	// Note that the ordering here is critical - it must reflect the ordering of the enums in TBTBURState
       
    71 	for (TInt i = EBTBURStateNormal; i < EBTBURStateUnknown; i++)
       
    72 		{
       
    73 		CBTManServerBURMgrStateAction* nextState = ConstructStateLC(static_cast<TBTBURState>(i));
       
    74 		iStateActions.AppendL(nextState);
       
    75 		CleanupStack::Pop(nextState);
       
    76 		}
       
    77 	}
       
    78 
       
    79 CBTManServerBURMgrStateAction* CBTManServerBURMgrStateFactory::ConstructStateLC(TBTBURState aState)
       
    80 	{
       
    81 	LOG_FUNC
       
    82 
       
    83 	CBTManServerBURMgrStateAction* result = NULL;
       
    84 
       
    85 	switch (aState)
       
    86 		{
       
    87 	case EBTBURStateNormal:
       
    88 		result = CBTManServerBURMgrStateNormal::NewLC();
       
    89 		break;
       
    90 	case EBTBURStateBackupRequest:
       
    91 		result = CBTManServerBURMgrStateBackupRequest::NewLC();
       
    92 		break;
       
    93 	case EBTBURStateBackupOngoing:
       
    94 		result = CBTManServerBURMgrStateBackupOngoing::NewLC();
       
    95 		break;
       
    96 	case EBTBURStateBackupIgnore:
       
    97 		result = CBTManServerBURMgrStateBackupIgnore::NewLC();
       
    98 		break;
       
    99 	case EBTBURStateRestoreRequest:
       
   100 		result = CBTManServerBURMgrStateRestoreRequest::NewLC();
       
   101 		break;
       
   102 	case EBTBURStateRestoreOngoing:
       
   103 		result = CBTManServerBURMgrStateRestoreOngoing::NewLC();
       
   104 		break;
       
   105 	case EBTBURStateRestoreIgnore:
       
   106 		result = CBTManServerBURMgrStateRestoreIgnore::NewLC();
       
   107 		break;
       
   108 	case EBTBURStateProcessRestoreFile:
       
   109 		result = CBTManServerBURMgrStateProcessRestoreFile::NewLC();
       
   110 		break;
       
   111 	case EBTBURStateRestoreFileProcessingComplete:
       
   112 		result = CBTManServerBURMgrStateRestoreFileProcessingComplete::NewLC();
       
   113 		break;
       
   114 	default:
       
   115 		// EBTBURStateUnknown
       
   116 		__ASSERT_DEBUG(EFalse, PANIC(KBTBackupPanicCat, EBTBURMgrInvalidStateIndex));
       
   117 		User::Leave(KErrNotFound);
       
   118 		}
       
   119 
       
   120 	return result;
       
   121 	}
       
   122 
       
   123 /**
       
   124 Attempts to transition to a new state in the state machine, in response to a given event.
       
   125 This only succeeds if the event yields a valid transition from the current state.
       
   126 The transition event EBTBUREventAbortStateAction yields a valid transition for any state, 
       
   127 and this is tested for here.
       
   128 Upon successful transition, the action associated with the new state is executed.
       
   129 An invalid state transition in debug mode will result in a panic. In release mode, the current
       
   130 state is maintained.
       
   131 @param aTransitionEvent The event driving the state transition.
       
   132 @return	KErrNone if state transition is successful.
       
   133 	KErrNotFound if aTransitionEvent does not yield a valid transition for the current state.
       
   134 **/
       
   135 TInt CBTManServerBURMgrStateFactory::TransitionState(TBTBUREvent aTransitionEvent)
       
   136 	{
       
   137 	LOG_FUNC
       
   138 
       
   139 	TBTBURState nextState;
       
   140 
       
   141 	// We allow EBTBUREventAbortStateAction to transition any state back to normal (used for error handling)
       
   142 	if (aTransitionEvent == EBTBUREventAbortStateAction)
       
   143 		{
       
   144 		nextState = EBTBURStateNormal;
       
   145 		}
       
   146 	else
       
   147 		{
       
   148 		nextState = iStateActions[iState]->GetNextState(aTransitionEvent);
       
   149 		}
       
   150 	
       
   151 	// A request to process a restore file may come in at any time, and we may not be in a correct state to deal with it.
       
   152 	// This scenario is not an error, instead the request is simply ignored (as state transition is disallowed) and will be picked up
       
   153 	// when BTManServer next starts.
       
   154 	__ASSERT_DEBUG(nextState != EBTBURStateUnknown || aTransitionEvent == EBTBUREventProcessRestoreFile, InvalidStateTransitionPanic(iState, aTransitionEvent));
       
   155 
       
   156 	if (nextState == EBTBURStateUnknown)
       
   157 		{
       
   158 		// Invalid transition
       
   159 		return KErrNotFound;
       
   160 		}
       
   161 	else
       
   162 		{
       
   163 		// Make the transition and execute new state action.
       
   164 		iState = nextState;
       
   165 		ExecuteAction();
       
   166 
       
   167 		return KErrNone;
       
   168 		}
       
   169 	}
       
   170 
       
   171 /**
       
   172 Executes the action associated with the current state.
       
   173 The implementation of the action is given by CBTManServerBURMgrStateAction::ExecuteActionL().
       
   174 Error handling is provided by CBTManServerBURMgrStateAction::HandleActionError().
       
   175 **/
       
   176 void CBTManServerBURMgrStateFactory::ExecuteAction()
       
   177 	{
       
   178 	LOG_FUNC
       
   179 
       
   180 	TRAPD(err, iStateActions[iState]->ExecuteActionL(iBURMgr));
       
   181 	if (err != KErrNone)
       
   182 		{
       
   183 		iStateActions[iState]->HandleActionError(iBURMgr, err);
       
   184 		}
       
   185 	}
       
   186 
       
   187 /**
       
   188 CBTManServerBURMgrStateAction - Base class for action/transition handling for states of CBTManServerBURMgr
       
   189 **/
       
   190 
       
   191 CBTManServerBURMgrStateAction::CBTManServerBURMgrStateAction(TBTBURState aState) 
       
   192 	: iState(aState)
       
   193 	{
       
   194 	LOG_FUNC
       
   195 	}
       
   196 
       
   197 CBTManServerBURMgrStateAction::~CBTManServerBURMgrStateAction()
       
   198 	{
       
   199 	LOG_FUNC
       
   200 	}
       
   201 
       
   202 /**
       
   203 Handles a leave generated by ExecuteActionL().
       
   204 The default implementation is to do nothing. This accomodates states whose implementation of ExecuteActionL()
       
   205 is guaranteed not to leave.
       
   206 If a leave does occur, the state must either recover from the error in some way (allowing the state machine to 
       
   207 remain in its current state) or initiate a transition back to the normal state using the EBTBUREventAbortStateAction
       
   208 transition event (after any necessary cleanup has been performed).
       
   209 @param aBURMgr The CBTManServerBURMgr instance
       
   210 @param aError The error which generated the leave in ExecuteActionL()
       
   211 **/
       
   212 void CBTManServerBURMgrStateAction::HandleActionError(CBTManServerBURMgr& /*aBURMgr*/, TInt /*aError*/)
       
   213 	{
       
   214 	LOG_FUNC
       
   215 
       
   216 	// Do nothing by default (state may not have a leavable action)
       
   217 	}
       
   218 
       
   219 /**
       
   220 CBTManServerBURMgrStateNormal - Action/transition handling for EBTBURStateNormal state of CBTManServerBURMgr
       
   221 **/
       
   222 
       
   223 CBTManServerBURMgrStateNormal* CBTManServerBURMgrStateNormal::NewLC()
       
   224 	{
       
   225 	LOG_STATIC_FUNC
       
   226 
       
   227 	CBTManServerBURMgrStateNormal* result = new(ELeave) CBTManServerBURMgrStateNormal();
       
   228 	CleanupStack::PushL(result);
       
   229 	return result;
       
   230 	}
       
   231 
       
   232 CBTManServerBURMgrStateNormal::CBTManServerBURMgrStateNormal() 
       
   233 	: CBTManServerBURMgrStateAction(EBTBURStateNormal)
       
   234 	{
       
   235 	LOG_FUNC
       
   236 	}		
       
   237 
       
   238 CBTManServerBURMgrStateNormal::~CBTManServerBURMgrStateNormal()
       
   239 	{
       
   240 	LOG_FUNC
       
   241 	}
       
   242 
       
   243 TBTBURState CBTManServerBURMgrStateNormal::GetNextState(TBTBUREvent aTransitionEvent)
       
   244 	{
       
   245 	LOG_FUNC
       
   246 
       
   247 	// Valid transition events: EBTBUREventBackup, EBTBUREventRestore, EBTBUREventProcessRestoreFile, EBTBUREventUnset, EBTBUREventNormal
       
   248 	switch (aTransitionEvent)
       
   249 		{
       
   250 	case EBTBUREventBackup:
       
   251 		return EBTBURStateBackupRequest;
       
   252 	case EBTBUREventRestore:
       
   253 		return EBTBURStateRestoreRequest;
       
   254 	case EBTBUREventProcessRestoreFile:
       
   255 		return EBTBURStateProcessRestoreFile;
       
   256 	case EBTBUREventUnset:
       
   257 		// Fall-through
       
   258 	case EBTBUREventNormal:
       
   259 		return EBTBURStateNormal;
       
   260 	default:
       
   261 		// Unknown state (no valid transition)
       
   262 		return EBTBURStateUnknown;
       
   263 		}
       
   264 	}
       
   265 
       
   266 void CBTManServerBURMgrStateNormal::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   267 	{
       
   268 	LOG_FUNC
       
   269 
       
   270 	aBURMgr.HandleStateNormal();
       
   271 	}
       
   272 
       
   273 /**
       
   274 CBTManServerBURMgrStateBackupRequest - Action/transition handling for EBTBURStateBackupRequest state of CBTManServerBURMgr
       
   275 **/
       
   276 
       
   277 CBTManServerBURMgrStateBackupRequest* CBTManServerBURMgrStateBackupRequest::NewLC()
       
   278 	{
       
   279 	LOG_STATIC_FUNC
       
   280 
       
   281 	CBTManServerBURMgrStateBackupRequest* result = new(ELeave) CBTManServerBURMgrStateBackupRequest();
       
   282 	CleanupStack::PushL(result);
       
   283 	return result;
       
   284 	}
       
   285 
       
   286 CBTManServerBURMgrStateBackupRequest::CBTManServerBURMgrStateBackupRequest() 
       
   287 	: CBTManServerBURMgrStateAction(EBTBURStateBackupRequest)
       
   288 	{
       
   289 	LOG_FUNC
       
   290 	}		
       
   291 
       
   292 CBTManServerBURMgrStateBackupRequest::~CBTManServerBURMgrStateBackupRequest()
       
   293 	{
       
   294 	LOG_FUNC
       
   295 	}
       
   296 
       
   297 TBTBURState CBTManServerBURMgrStateBackupRequest::GetNextState(TBTBUREvent aTransitionEvent)
       
   298 	{
       
   299 	LOG_FUNC
       
   300 	
       
   301 	// Valid transition events: EBTBUREventBackupProceed, EBTBUREventBackupReject
       
   302 	switch (aTransitionEvent)
       
   303 		{
       
   304 	case EBTBUREventBackupProceed:
       
   305 		return EBTBURStateBackupOngoing;
       
   306 	case EBTBUREventBackupReject:
       
   307 		return EBTBURStateBackupIgnore;
       
   308 	default:
       
   309 		// Unknown state (no valid transition)
       
   310 		return EBTBURStateUnknown;
       
   311 		}
       
   312 	}
       
   313 
       
   314 void CBTManServerBURMgrStateBackupRequest::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   315 	{
       
   316 	LOG_FUNC
       
   317 
       
   318 	aBURMgr.HandleStateBackupRequestL();
       
   319 	}
       
   320 
       
   321 void CBTManServerBURMgrStateBackupRequest::HandleActionError(CBTManServerBURMgr& aBURMgr, TInt /*aError*/)
       
   322 	{
       
   323 	LOG_FUNC
       
   324 
       
   325 	aBURMgr.HandleStateBackupRequestError();
       
   326 	}
       
   327 
       
   328 /**
       
   329 CBTManServerBURMgrStateBackupOngoing - Action/transition handling for EBTBURStateBackupOngoing state of CBTManServerBURMgr
       
   330 **/
       
   331 
       
   332 CBTManServerBURMgrStateBackupOngoing* CBTManServerBURMgrStateBackupOngoing::NewLC()
       
   333 	{
       
   334 	LOG_STATIC_FUNC
       
   335 
       
   336 	CBTManServerBURMgrStateBackupOngoing* result = new(ELeave) CBTManServerBURMgrStateBackupOngoing();
       
   337 	CleanupStack::PushL(result);
       
   338 	return result;
       
   339 	}
       
   340 
       
   341 CBTManServerBURMgrStateBackupOngoing::CBTManServerBURMgrStateBackupOngoing() 
       
   342 	: CBTManServerBURMgrStateAction(EBTBURStateBackupOngoing)
       
   343 	{
       
   344 	LOG_FUNC
       
   345 	}		
       
   346 
       
   347 CBTManServerBURMgrStateBackupOngoing::~CBTManServerBURMgrStateBackupOngoing()
       
   348 	{
       
   349 	LOG_FUNC
       
   350 	}
       
   351 
       
   352 TBTBURState CBTManServerBURMgrStateBackupOngoing::GetNextState(TBTBUREvent aTransitionEvent)
       
   353 	{
       
   354 	LOG_FUNC
       
   355 	
       
   356 	// Valid transition events: EBTBUREventNormal
       
   357 	if (aTransitionEvent == EBTBUREventNormal)
       
   358 		{
       
   359 		return EBTBURStateNormal;
       
   360 		}
       
   361 	else
       
   362 		{
       
   363 		// Unknown state (no valid transition)
       
   364 		return EBTBURStateUnknown;
       
   365 		}
       
   366 	}
       
   367 
       
   368 void CBTManServerBURMgrStateBackupOngoing::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   369 	{
       
   370 	LOG_FUNC
       
   371 
       
   372 	aBURMgr.HandleStateBackupOngoingL();
       
   373 	}
       
   374 
       
   375 void CBTManServerBURMgrStateBackupOngoing::HandleActionError(CBTManServerBURMgr& aBURMgr, TInt /*aError*/)
       
   376 	{
       
   377 	LOG_FUNC
       
   378 
       
   379 	aBURMgr.HandleStateBackupOngoingError();
       
   380 	}	
       
   381 
       
   382 /**
       
   383 CBTManServerBURMgrStateBackupIgnore - Action/transition handling for EBTBURStateBackupIgnore state of CBTManServerBURMgr
       
   384 **/
       
   385 
       
   386 CBTManServerBURMgrStateBackupIgnore* CBTManServerBURMgrStateBackupIgnore::NewLC()
       
   387 	{
       
   388 	LOG_STATIC_FUNC
       
   389 
       
   390 	CBTManServerBURMgrStateBackupIgnore* result = new(ELeave) CBTManServerBURMgrStateBackupIgnore();
       
   391 	CleanupStack::PushL(result);
       
   392 	return result;
       
   393 	}
       
   394 
       
   395 CBTManServerBURMgrStateBackupIgnore::CBTManServerBURMgrStateBackupIgnore() 
       
   396 	: CBTManServerBURMgrStateAction(EBTBURStateBackupIgnore)
       
   397 	{
       
   398 	LOG_FUNC
       
   399 	}		
       
   400 
       
   401 CBTManServerBURMgrStateBackupIgnore::~CBTManServerBURMgrStateBackupIgnore()
       
   402 	{
       
   403 	LOG_FUNC
       
   404 	}
       
   405 
       
   406 TBTBURState CBTManServerBURMgrStateBackupIgnore::GetNextState(TBTBUREvent aTransitionEvent)
       
   407 	{
       
   408 	LOG_FUNC
       
   409 	
       
   410 	// Valid transition events: EBTBUREventNormal
       
   411 	if (aTransitionEvent == EBTBUREventNormal)
       
   412 		{
       
   413 		return EBTBURStateNormal;
       
   414 		}
       
   415 	else
       
   416 		{
       
   417 		// Unknown state (no valid transition)
       
   418 		return EBTBURStateUnknown;
       
   419 		}
       
   420 	}
       
   421 
       
   422 void CBTManServerBURMgrStateBackupIgnore::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   423 	{
       
   424 	LOG_FUNC
       
   425 
       
   426 	aBURMgr.HandleStateBackupIgnore();
       
   427 	}
       
   428 
       
   429 /**
       
   430 CBTManServerBURMgrStateRestoreRequest - Action/transition handling for EBTBURStateRestoreRequest state of CBTManServerBURMgr
       
   431 **/
       
   432 
       
   433 CBTManServerBURMgrStateRestoreRequest* CBTManServerBURMgrStateRestoreRequest::NewLC()
       
   434 	{
       
   435 	LOG_STATIC_FUNC
       
   436 
       
   437 	CBTManServerBURMgrStateRestoreRequest* result = new(ELeave) CBTManServerBURMgrStateRestoreRequest();
       
   438 	CleanupStack::PushL(result);
       
   439 	return result;
       
   440 	}
       
   441 
       
   442 CBTManServerBURMgrStateRestoreRequest::CBTManServerBURMgrStateRestoreRequest() 
       
   443 	: CBTManServerBURMgrStateAction(EBTBURStateRestoreRequest)
       
   444 	{
       
   445 	LOG_FUNC
       
   446 	}		
       
   447 
       
   448 CBTManServerBURMgrStateRestoreRequest::~CBTManServerBURMgrStateRestoreRequest()
       
   449 	{
       
   450 	LOG_FUNC
       
   451 	}
       
   452 
       
   453 TBTBURState CBTManServerBURMgrStateRestoreRequest::GetNextState(TBTBUREvent aTransitionEvent)
       
   454 	{
       
   455 	LOG_FUNC
       
   456 	
       
   457 	// Valid transition events: EBTBUREventRestoreProceed, EBTBUREventRestoreReject
       
   458 	switch (aTransitionEvent)
       
   459 		{
       
   460 	case EBTBUREventRestoreProceed:
       
   461 		return EBTBURStateRestoreOngoing;
       
   462 	case EBTBUREventRestoreReject:
       
   463 		return EBTBURStateRestoreIgnore;
       
   464 	default:
       
   465 		// Unknown state (no valid transition)
       
   466 		return EBTBURStateUnknown;
       
   467 		}
       
   468 	}
       
   469 
       
   470 void CBTManServerBURMgrStateRestoreRequest::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   471 	{
       
   472 	LOG_FUNC
       
   473 
       
   474 	aBURMgr.HandleStateRestoreRequestL();
       
   475 	}
       
   476 
       
   477 void CBTManServerBURMgrStateRestoreRequest::HandleActionError(CBTManServerBURMgr& aBURMgr, TInt /*aError*/)
       
   478 	{
       
   479 	LOG_FUNC
       
   480 
       
   481 	aBURMgr.HandleStateRestoreRequestError();
       
   482 	}
       
   483 
       
   484 /**
       
   485 CBTManServerBURMgrStateRestoreOngoing - Action/transition handling for EBTBURStateRestoreOngoing state of CBTManServerBURMgr
       
   486 **/
       
   487 
       
   488 CBTManServerBURMgrStateRestoreOngoing* CBTManServerBURMgrStateRestoreOngoing::NewLC()
       
   489 	{
       
   490 	LOG_STATIC_FUNC
       
   491 
       
   492 	CBTManServerBURMgrStateRestoreOngoing* result = new(ELeave) CBTManServerBURMgrStateRestoreOngoing();
       
   493 	CleanupStack::PushL(result);
       
   494 	return result;
       
   495 	}
       
   496 
       
   497 CBTManServerBURMgrStateRestoreOngoing::CBTManServerBURMgrStateRestoreOngoing() 
       
   498 	: CBTManServerBURMgrStateAction(EBTBURStateRestoreOngoing)
       
   499 	{
       
   500 	LOG_FUNC
       
   501 	}		
       
   502 
       
   503 CBTManServerBURMgrStateRestoreOngoing::~CBTManServerBURMgrStateRestoreOngoing()
       
   504 	{
       
   505 	LOG_FUNC
       
   506 	}
       
   507 
       
   508 TBTBURState CBTManServerBURMgrStateRestoreOngoing::GetNextState(TBTBUREvent aTransitionEvent)
       
   509 	{
       
   510 	LOG_FUNC
       
   511 
       
   512 	// Valid transition events: EBTBUREventNormal
       
   513 	if (aTransitionEvent == EBTBUREventNormal)
       
   514 		{
       
   515 		return EBTBURStateNormal;
       
   516 		}
       
   517 	else
       
   518 		{
       
   519 		// Unknown state (no valid transition)
       
   520 		return EBTBURStateUnknown;
       
   521 		}
       
   522 	}
       
   523 
       
   524 void CBTManServerBURMgrStateRestoreOngoing::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   525 	{
       
   526 	LOG_FUNC
       
   527 
       
   528 	aBURMgr.HandleStateRestoreOngoingL();
       
   529 	}
       
   530 
       
   531 void CBTManServerBURMgrStateRestoreOngoing::HandleActionError(CBTManServerBURMgr& aBURMgr, TInt /*aError*/)
       
   532 	{
       
   533 	LOG_FUNC
       
   534 
       
   535 	aBURMgr.HandleStateRestoreOngoingError();
       
   536 	}
       
   537 
       
   538 /**
       
   539 CBTManServerBURMgrStateRestoreIgnore - Action/transition handling for EBTBURStateRestoreIgnore state of CBTManServerBURMgr
       
   540 **/
       
   541 
       
   542 CBTManServerBURMgrStateRestoreIgnore* CBTManServerBURMgrStateRestoreIgnore::NewLC()
       
   543 	{
       
   544 	LOG_STATIC_FUNC
       
   545 
       
   546 	CBTManServerBURMgrStateRestoreIgnore* result = new(ELeave) CBTManServerBURMgrStateRestoreIgnore();
       
   547 	CleanupStack::PushL(result);
       
   548 	return result;
       
   549 	}
       
   550 
       
   551 CBTManServerBURMgrStateRestoreIgnore::CBTManServerBURMgrStateRestoreIgnore() 
       
   552 	: CBTManServerBURMgrStateAction(EBTBURStateRestoreIgnore)
       
   553 	{
       
   554 	LOG_FUNC
       
   555 	}		
       
   556 
       
   557 CBTManServerBURMgrStateRestoreIgnore::~CBTManServerBURMgrStateRestoreIgnore()
       
   558 	{
       
   559 	LOG_FUNC
       
   560 	}
       
   561 
       
   562 TBTBURState CBTManServerBURMgrStateRestoreIgnore::GetNextState(TBTBUREvent aTransitionEvent)
       
   563 	{
       
   564 	LOG_FUNC
       
   565 	
       
   566 	// Valid transition events: EBTBUREventNormal
       
   567 	if (aTransitionEvent==EBTBUREventNormal)
       
   568 		{
       
   569 		return EBTBURStateNormal;
       
   570 		}
       
   571 	else
       
   572 		{
       
   573 		// Unknown state (no valid transition)
       
   574 		return EBTBURStateUnknown;
       
   575 		}
       
   576 	}
       
   577 
       
   578 void CBTManServerBURMgrStateRestoreIgnore::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   579 	{
       
   580 	LOG_FUNC
       
   581 
       
   582 	aBURMgr.HandleStateRestoreIgnore();
       
   583 	}
       
   584 
       
   585 /**
       
   586 CBTManServerBURMgrStateProcessRestoreFile - Action/transition handling for EBTBURStateProcessRestoreFile state of CBTManServerBURMgr
       
   587 **/
       
   588 
       
   589 CBTManServerBURMgrStateProcessRestoreFile* CBTManServerBURMgrStateProcessRestoreFile::NewLC()
       
   590 	{
       
   591 	LOG_STATIC_FUNC
       
   592 
       
   593 	CBTManServerBURMgrStateProcessRestoreFile* result = new(ELeave) CBTManServerBURMgrStateProcessRestoreFile();
       
   594 	CleanupStack::PushL(result);
       
   595 	return result;
       
   596 	}
       
   597 
       
   598 CBTManServerBURMgrStateProcessRestoreFile::CBTManServerBURMgrStateProcessRestoreFile() 
       
   599 	: CBTManServerBURMgrStateAction(EBTBURStateProcessRestoreFile)
       
   600 	{
       
   601 	LOG_FUNC
       
   602 	}		
       
   603 
       
   604 CBTManServerBURMgrStateProcessRestoreFile::~CBTManServerBURMgrStateProcessRestoreFile()
       
   605 	{
       
   606 	LOG_FUNC
       
   607 	}
       
   608 
       
   609 TBTBURState CBTManServerBURMgrStateProcessRestoreFile::GetNextState(TBTBUREvent aTransitionEvent)
       
   610 	{
       
   611 	LOG_FUNC
       
   612 	
       
   613 	// Valid transition event: EBTBUREventProcessRestoreFileComplete
       
   614 	switch (aTransitionEvent)
       
   615 		{
       
   616 	case EBTBUREventProcessRestoreFileComplete:
       
   617 		return EBTBURStateRestoreFileProcessingComplete;
       
   618 	default:
       
   619 		// Unknown state (no valid transition)
       
   620 		return EBTBURStateUnknown;
       
   621 		}
       
   622 	}
       
   623 
       
   624 void CBTManServerBURMgrStateProcessRestoreFile::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   625 	{
       
   626 	LOG_FUNC
       
   627 
       
   628 	aBURMgr.HandleStateProcessRestoreFileL();
       
   629 	}
       
   630 
       
   631 void CBTManServerBURMgrStateProcessRestoreFile::HandleActionError(CBTManServerBURMgr& aBURMgr, TInt aError)
       
   632 	{
       
   633 	LOG_FUNC
       
   634 
       
   635 	aBURMgr.HandleStateProcessRestoreFileError(aError);
       
   636 	}
       
   637 
       
   638 /**
       
   639 CBTManServerBURMgrStateRestoreFileProcessingComplete - Action/transition handling for EBTBURStateRestoreFileProcessingComplete state of CBTManServerBURMgr
       
   640 **/
       
   641 
       
   642 CBTManServerBURMgrStateRestoreFileProcessingComplete* CBTManServerBURMgrStateRestoreFileProcessingComplete::NewLC()
       
   643 	{
       
   644 	LOG_STATIC_FUNC
       
   645 
       
   646 	CBTManServerBURMgrStateRestoreFileProcessingComplete* result = new(ELeave) CBTManServerBURMgrStateRestoreFileProcessingComplete();
       
   647 	CleanupStack::PushL(result);
       
   648 	return result;
       
   649 	}
       
   650 
       
   651 CBTManServerBURMgrStateRestoreFileProcessingComplete::CBTManServerBURMgrStateRestoreFileProcessingComplete() 
       
   652 	: CBTManServerBURMgrStateAction(EBTBURStateRestoreFileProcessingComplete)
       
   653 	{
       
   654 	LOG_FUNC
       
   655 	}		
       
   656 
       
   657 CBTManServerBURMgrStateRestoreFileProcessingComplete::~CBTManServerBURMgrStateRestoreFileProcessingComplete()
       
   658 	{
       
   659 	LOG_FUNC
       
   660 	}
       
   661 
       
   662 TBTBURState CBTManServerBURMgrStateRestoreFileProcessingComplete::GetNextState(TBTBUREvent aTransitionEvent)
       
   663 	{
       
   664 	LOG_FUNC
       
   665 	
       
   666 	// Valid transition events: EBTBUREventRestoreFileTransitionNormal
       
   667 	if (aTransitionEvent == EBTBUREventRestoreFileTransitionNormal)
       
   668 		{
       
   669 		return EBTBURStateNormal;
       
   670 		}
       
   671 	else
       
   672 		{
       
   673 		// Unknown state (no valid transition)
       
   674 		return EBTBURStateUnknown;
       
   675 		}
       
   676 	}
       
   677 
       
   678 void CBTManServerBURMgrStateRestoreFileProcessingComplete::ExecuteActionL(CBTManServerBURMgr& aBURMgr)
       
   679 	{
       
   680 	LOG_FUNC
       
   681 	aBURMgr.HandleStateRestoreFileProcessingComplete();
       
   682 	}