bluetoothengine/btsap/src/BTSapStateNotConnected.cpp
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2004 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: 
       
    15 *     This class is a BTSapServer's state for NotConnected state
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "BTSapServerState.h"
       
    23 #include "BTSapSocketHandler.h"
       
    24 #include "BTSapSimCardStatusNotifier.h"
       
    25 #include "debug.h"
       
    26 
       
    27 CBTSapServerState::TStateNotConnected::TStateNotConnected(CBTSapServerState& aServerState)
       
    28     : TState(aServerState)
       
    29     {
       
    30     }
       
    31 
       
    32 // ---------------------------------------------------------
       
    33 // Enter
       
    34 // ---------------------------------------------------------
       
    35 void CBTSapServerState::TStateNotConnected:: Enter(TRequestStatus& aStatus)
       
    36     {
       
    37     BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap]  SM: TStateNotConnected: Enter")));
       
    38     iStatus = &aStatus;
       
    39     aStatus = KRequestPending;
       
    40 
       
    41     NotifySapState(ESapNotConnected);
       
    42 
       
    43     iServerState.BTSapSimCardStatusNotifier().Cancel();
       
    44     iServerState.BTSapSocketHandler().Listen();
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------------------------
       
    48 // Complete
       
    49 // set next state
       
    50 // --------------------------------------------------------------------------------------------
       
    51 //
       
    52 TBTSapServerState CBTSapServerState::TStateNotConnected::Complete(TInt /*aReason*/)
       
    53     {
       
    54     BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap]  SM: TStateNotConnected: Complete")));
       
    55     return EStateConnect;
       
    56     }
       
    57 
       
    58 void CBTSapServerState::TStateNotConnected::Cancel()
       
    59     {
       
    60     BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap]  SM: TStateNotConnected: Cancel")));
       
    61 
       
    62     //iServerState.BTSapSocketHandler().Cancel();
       
    63     User::RequestComplete(iStatus, KErrCancel);
       
    64     }
       
    65 
       
    66 TInt CBTSapServerState::TStateNotConnected::ChangeState(TBTSapServerState& aNextState)
       
    67     {
       
    68     TInt retVal = KErrNone;
       
    69 
       
    70     if (aNextState != EStateConnect)
       
    71         {
       
    72         aNextState = EStateNotConnected;
       
    73         retVal = KErrNotSupported;
       
    74         }
       
    75 
       
    76     return retVal;
       
    77     }
       
    78 
       
    79 //  End of File