|
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 "BTSapServerState.h" |
|
23 #include "BTSapSocketHandler.h" |
|
24 #include "debug.h" |
|
25 |
|
26 CBTSapServerState::TStatePowerOff::TStatePowerOff(CBTSapServerState& aServerState) |
|
27 : TStateIdle(aServerState) |
|
28 { |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------- |
|
32 // Enter |
|
33 // --------------------------------------------------------- |
|
34 void CBTSapServerState::TStatePowerOff:: Enter(TRequestStatus& aStatus) |
|
35 { |
|
36 BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap] SM: TStatePowerOff: Enter"))); |
|
37 |
|
38 iStatus = &aStatus; |
|
39 |
|
40 iServerState.SubscriptionModule().PowerSimOff(aStatus); |
|
41 } |
|
42 |
|
43 // -------------------------------------------------------------------------------------------- |
|
44 // Complete |
|
45 // set next state |
|
46 // -------------------------------------------------------------------------------------------- |
|
47 // |
|
48 TBTSapServerState CBTSapServerState::TStatePowerOff::Complete(TInt aReason) |
|
49 { |
|
50 BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap] SM: TStatePowerOff: Complete: %d"), aReason)); |
|
51 |
|
52 iResponseMessage.SetMsgID(EPowerSimOffResponse); |
|
53 TResultCode resultCode = iResponseMessage.ToResultCode(aReason); |
|
54 |
|
55 // SubscriptionModule always send the same error code: KErrAlreadyExists when powered on/off already |
|
56 if (resultCode == EResultCodeAlreadyPowerOn) |
|
57 { |
|
58 resultCode = EResultCodePowerOff; |
|
59 } |
|
60 |
|
61 iResponseMessage.AddParameter(EParaResultCode, resultCode); |
|
62 iServerState.BTSapSocketHandler().Send(iResponseMessage.Data()); |
|
63 return EStateIdle; |
|
64 } |
|
65 |
|
66 void CBTSapServerState::TStatePowerOff::Cancel() |
|
67 { |
|
68 BTSAP_TRACE_OPT(KBTSAP_TRACE_STM, BTSapPrintTrace(_L("[BTSap] SM: TStatePowerOff: Cancel"))); |
|
69 |
|
70 iServerState.SubscriptionModule().CancelAsyncRequest(ECustomPowerSimOffIPC); |
|
71 |
|
72 TStateIdle::Cancel(); |
|
73 } |
|
74 |
|
75 TInt CBTSapServerState::TStatePowerOff::ChangeState(TBTSapServerState& aNextState) |
|
76 { |
|
77 TInt retVal = KErrNone; |
|
78 |
|
79 if (aNextState != EStateDisconnect) |
|
80 { |
|
81 aNextState = EStateIdle; |
|
82 retVal = KErrNotSupported; |
|
83 } |
|
84 |
|
85 return retVal; |
|
86 } |
|
87 |
|
88 // End of File |