bluetoothengine/btsap/src/BTSapStateATR.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 setting up connection with BTSap client
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "BTSapSocketHandler.h"
       
    23 #include "BTSapServerState.h"
       
    24 #include "debug.h"
       
    25 
       
    26 CBTSapServerState::TStateATR::TStateATR(CBTSapServerState& aServerState)
       
    27     : TStateIdle(aServerState)
       
    28     {
       
    29     }
       
    30 
       
    31 // ---------------------------------------------------------
       
    32 // Enter
       
    33 // ---------------------------------------------------------
       
    34 void CBTSapServerState::TStateATR:: Enter(TRequestStatus& aStatus)
       
    35     {
       
    36     BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap]  TStateATR: Enter")));
       
    37 
       
    38     iStatus = &aStatus;
       
    39     iATR.Zero();
       
    40     iServerState.SubscriptionModule().GetATR(aStatus, iATR);
       
    41     }
       
    42 
       
    43 // --------------------------------------------------------------------------------------------
       
    44 // Complete
       
    45 // set next state
       
    46 // --------------------------------------------------------------------------------------------
       
    47 //
       
    48 TBTSapServerState CBTSapServerState::TStateATR::Complete(TInt aReason)
       
    49     {
       
    50     BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap]  TStateATR: Complete")));
       
    51 
       
    52     iResponseMessage.SetMsgID(ETransferATRResponse);
       
    53     iResponseMessage.AddParameter(EParaResultCode, iResponseMessage.ToResultCode(aReason));
       
    54 
       
    55     if (aReason == EResultCodeOK)
       
    56         {
       
    57         iResponseMessage.AddParameter(EParaATR, iATR);
       
    58         }
       
    59 
       
    60     iServerState.BTSapSocketHandler().Send(iResponseMessage.Data());
       
    61     return EStateIdle;
       
    62     }
       
    63 
       
    64 void CBTSapServerState::TStateATR::Cancel()
       
    65     {
       
    66     BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap]  TStateATR: Cancel")));
       
    67 
       
    68     iServerState.SubscriptionModule().CancelAsyncRequest(ECustomGetATRIPC);
       
    69     TStateIdle::Cancel();
       
    70     }
       
    71 
       
    72 TInt CBTSapServerState::TStateATR::ChangeState(TBTSapServerState& aNextState)
       
    73     {
       
    74     return TState::ChangeState(aNextState);
       
    75     }
       
    76 
       
    77 //  End of File