accessoryservices/accessoryserver/src/ChargerContext/ChargingContextFSMBody.cpp
branchRCL_3
changeset 7 1a73e8f1b64d
parent 0 4e1aa6a622a0
equal deleted inserted replaced
3:a811597961f0 7:1a73e8f1b64d
    76                 iChargingContextController->iChargerStatusWatchPtr->Cancel();
    76                 iChargingContextController->iChargerStatusWatchPtr->Cancel();
    77                 }
    77                 }
    78             }
    78             }
    79         }
    79         }
    80     // Delete state objects
    80     // Delete state objects
    81     for (TInt i = 1; i <= EChargerContextStateMaxValue; i++ )
    81     for (TInt i = 1; i < EChargerContextStateMaxValue; i++ )
    82         {
    82         {
    83         delete iStateArray[i];
    83         delete iStateArray[i];
    84         iStateArray[i] = NULL;
    84         iStateArray[i] = NULL;
    85         }   
    85         }   
    86     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::~CChargingContextFSMBody" );
    86     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::~CChargingContextFSMBody" );
   109 TBool CChargingContextFSMBody::Transit( TFSMState aNextState )
   109 TBool CChargingContextFSMBody::Transit( TFSMState aNextState )
   110     {
   110     {
   111     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::Transit()" );
   111     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::Transit()" );
   112     TBool retVal(EFalse);
   112     TBool retVal(EFalse);
   113     if ( ( EChargerContextStateUndefined < aNextState ) && 
   113     if ( ( EChargerContextStateUndefined < aNextState ) && 
   114          (  EChargerContextStateMaxValue >= aNextState ) )
   114          (  EChargerContextStateMaxValue > aNextState ) )
   115         {
   115         {
   116         iCurrentStateId = aNextState;
   116         iCurrentStateId = aNextState;
   117         if ( NULL != iStateArray[iCurrentStateId])
   117         if ( NULL != iStateArray[iCurrentStateId])
   118             {
   118             {
   119             retVal = ETrue;
   119             retVal = ETrue;
   171 MFSMState* CChargingContextFSMBody::CurrentState()
   171 MFSMState* CChargingContextFSMBody::CurrentState()
   172     {
   172     {
   173     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentState()" );
   173     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentState()" );
   174     MFSMState* currentState( NULL );
   174     MFSMState* currentState( NULL );
   175     if ( ( EChargerContextStateUndefined < iCurrentStateId ) && 
   175     if ( ( EChargerContextStateUndefined < iCurrentStateId ) && 
   176             ( EChargerContextStateMaxValue >= iCurrentStateId ))
   176             ( EChargerContextStateMaxValue > iCurrentStateId ))
   177         {
   177         {
   178         currentState = iStateArray[iCurrentStateId];
   178         currentState = iStateArray[iCurrentStateId];
   179         }
   179         }
   180     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentState" );
   180     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentState" );
   181     return currentState;
   181     return currentState;
   189     {
   189     {
   190     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentStateName()" );
   190     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentStateName()" );
   191     TPtrC currentStateName;
   191     TPtrC currentStateName;
   192     currentStateName.Set( KNullDesC );
   192     currentStateName.Set( KNullDesC );
   193     if ( ( EChargerContextStateUndefined < iCurrentStateId ) && 
   193     if ( ( EChargerContextStateUndefined < iCurrentStateId ) && 
   194          ( EChargerContextStateMaxValue >= iCurrentStateId ))
   194          ( EChargerContextStateMaxValue > iCurrentStateId ))
   195         {
   195         {
   196         currentStateName.Set( iStateArray[iCurrentStateId]->Name() );
   196         currentStateName.Set( iStateArray[iCurrentStateId]->Name() );
   197         }
   197         }
   198     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentStateName" );
   198     COM_TRACE_( "[AccFW:AccServer] CChargingContextFSMBody::CurrentStateName" );
   199     return currentStateName;
   199     return currentStateName;