sensorservices/tiltcompensationssy/src/tcstatetiltclosing.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CTCStateTiltClosing class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "tcstatetiltclosing.h"
       
    20 #include "tctransaction.h"
       
    21 #include "tcstatepool.h"
       
    22 #include "tctransactionhandler.h"
       
    23 #include "tcutil.h"
       
    24 #include "trace.h"
       
    25 
       
    26 CTCStateTiltClosing* CTCStateTiltClosing::NewL( MTCStatePool& aStatePool,
       
    27     MTCTransactionHandler& aTransactionHandler )
       
    28     {
       
    29     FUNC_LOG;
       
    30     
       
    31     CTCStateTiltClosing* self = CTCStateTiltClosing::NewLC( aStatePool,
       
    32         aTransactionHandler );
       
    33     CleanupStack::Pop( self );
       
    34     
       
    35     return self;
       
    36     }
       
    37 
       
    38 CTCStateTiltClosing* CTCStateTiltClosing::NewLC( MTCStatePool& aStatePool,
       
    39     MTCTransactionHandler& aTransactionHandler )
       
    40     {
       
    41     FUNC_LOG;
       
    42     
       
    43     CTCStateTiltClosing* self = new( ELeave ) CTCStateTiltClosing( aStatePool,
       
    44         aTransactionHandler );
       
    45     CleanupStack::PushL( self );
       
    46     
       
    47     return self;
       
    48     }
       
    49 
       
    50 CTCStateTiltClosing::CTCStateTiltClosing( MTCStatePool& aStatePool,
       
    51     MTCTransactionHandler& aTransactionHandler ):
       
    52     CTCStateTilt( CTCState::ETCStateClosing, aStatePool, aTransactionHandler )
       
    53     {
       
    54     FUNC_LOG;
       
    55     }
       
    56 
       
    57 // METHODS
       
    58 
       
    59 // ----------------------------------------------------------------------------------
       
    60 // CTCStateTiltClosing::HandleTransactionL
       
    61 // ----------------------------------------------------------------------------------
       
    62 //
       
    63 void CTCStateTiltClosing::HandleEventL( TTCEventId aId, TTCEvent* /*aEvent */)
       
    64     {
       
    65     FUNC_LOG;
       
    66     
       
    67     INFO_2( "Handling event [%S] in state [%S]",
       
    68         &TCUtil::EventIdAsDesC( aId ),
       
    69         &TCUtil::StateIdAsDesC( this ) );
       
    70     
       
    71     switch( aId )
       
    72         {
       
    73         default:
       
    74             {
       
    75             INFO_2( "Event [%S] not handled in [%S] state",
       
    76                 &TCUtil::EventIdAsDesC( aId ),
       
    77                 &TCUtil::StateIdAsDesC( this ) );
       
    78             break;
       
    79             }
       
    80         }
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------------------------------
       
    84 // CTCStateTiltClosing::HandleTransactionCompletedL
       
    85 // ----------------------------------------------------------------------------------
       
    86 //
       
    87 void CTCStateTiltClosing::HandleTransactionCompletedL( TTCTransactionId aTransactionId,
       
    88     TInt /*aError */)
       
    89     {
       
    90     FUNC_LOG;
       
    91 
       
    92     INFO_2( "Transaction [%S] complete message recieved in [%S] state",
       
    93         &TCUtil::TransactionIdAsDesC( aTransactionId ),
       
    94         &TCUtil::StateIdAsDesC( this ) );
       
    95 
       
    96     // Switch back to data listening state when ETCTransactionIdCloseChannel
       
    97     // transaction has been completed
       
    98     switch( aTransactionId )
       
    99         {
       
   100         case ETCTransactionIdCloseChannel:
       
   101             {
       
   102             // Channel closed, switch to idle state
       
   103             iStatePool.ChangeStateL( CTCState::ETCStateIdle );
       
   104             break;
       
   105             }
       
   106         case ETCTransactionIdStopChannelData:
       
   107             {
       
   108             // Channel data stopped, close the channel
       
   109             iTransactionHandler.ProcessTransactionL( ETCTransactionIdCloseChannel );
       
   110             break;
       
   111             }
       
   112         default:
       
   113             {
       
   114             INFO_2( "Transaction [%S] complete message not handled in [%S] state",
       
   115                 &TCUtil::TransactionIdAsDesC( aTransactionId ),
       
   116                 &TCUtil::StateIdAsDesC( this ) );
       
   117             break;
       
   118             }
       
   119         }
       
   120     }
       
   121 
       
   122 // ----------------------------------------------------------------------------------
       
   123 // CTCStateTiltClosing::HandleStateEntryL
       
   124 // ----------------------------------------------------------------------------------
       
   125 //
       
   126 void CTCStateTiltClosing::HandleStateEntryL()
       
   127     {
       
   128     FUNC_LOG;
       
   129     
       
   130     // Nothing to do
       
   131     }
       
   132 
       
   133 // ----------------------------------------------------------------------------------
       
   134 // CTCStateTiltClosing::HandleStateExitL
       
   135 // ----------------------------------------------------------------------------------
       
   136 //
       
   137 void CTCStateTiltClosing::HandleStateExitL()
       
   138     {
       
   139     FUNC_LOG;
       
   140     
       
   141     // Nothing to do
       
   142     }
       
   143 
       
   144 // End of File