|
1 /* |
|
2 * Copyright (c) 2002-2005 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: In this state, BTSAC is listening for remote connection |
|
15 * from a stereo audio accessory |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "btsacStateIdle.h" |
|
24 #include "btsacactive.h" |
|
25 #include "btsacStateListening.h" |
|
26 #include "btsacGavdp.h" |
|
27 #include "btsacSEPManager.h" |
|
28 #include "btsacStreamerController.h" |
|
29 #include "debug.h" |
|
30 |
|
31 // A2DP codec-specific element definitions |
|
32 // in bluetoothAV.h |
|
33 using namespace SymbianBluetoothAV; |
|
34 |
|
35 // Subband codec-specific values |
|
36 // in bluetoothAV.h |
|
37 using namespace SymbianSBC; |
|
38 |
|
39 |
|
40 // ================= MEMBER FUNCTIONS ======================= |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CBtsacIdle::NewL |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CBtsacIdle* CBtsacIdle::NewL(CBTSAController& aParent) |
|
47 { |
|
48 CBtsacIdle* self = new( ELeave ) CBtsacIdle(aParent); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CBtsacIdle::TStateIdle |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CBtsacIdle::CBtsacIdle(CBTSAController& aParent) |
|
57 : CBtsacState(aParent, EStateIdle) |
|
58 { |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CBtsacIdle::TStateIdle |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CBtsacIdle::~CBtsacIdle() |
|
66 { |
|
67 TRACE_FUNC |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CBtsacIdle::EnterL |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 void CBtsacIdle::EnterL() |
|
75 { |
|
76 TRACE_STATE(_L("[BTSAC State] Idle")) |
|
77 _LIT(KName, "CBtsacStateIdle"); |
|
78 const TDesC& Name = KName; |
|
79 Parent().iGavdp->RegisterObserver(this, Name); |
|
80 |
|
81 TSBCCodecCapabilities sbc; |
|
82 TInt err = Parent().iStreamer->FillCapabilities(sbc); |
|
83 if ( err ) |
|
84 { |
|
85 TRACE_INFO((_L("CBtsacIdle::EnterL() Couldn't fill capabilities. Error: %d"), err)) |
|
86 User::Leave(KErrAvdtpBaseError); |
|
87 } |
|
88 // start with registering sdp, open gavdp and registering local SEPs |
|
89 err = Parent().iGavdp->StartSrc(*Parent().iLocalSEPs, sbc); |
|
90 if ( err ) |
|
91 { |
|
92 TRACE_INFO((_L("CBtsacIdle::EnterL() Couldn't start Gavdp. Error: %d"), err)) |
|
93 User::Leave(KErrAvdtpBaseError); |
|
94 } |
|
95 // Let's wait GAVDP_ConfigurationConfirm callback |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CBtsacIdle::GAVDP_ConfigurationConfirm |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CBtsacIdle::GAVDP_ConfigurationConfirm() |
|
103 { |
|
104 TRACE_INFO((_L("CBtsacIdle::GAVDP_ConfigurationConfirm() Local SEPs registered successfully."))) |
|
105 TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonNone, KErrNone))); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CBtsacIdle::GAVDP_Error |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CBtsacIdle::GAVDP_Error(TInt aError, const TDesC8& /*aErrorData*/) |
|
113 { |
|
114 TRACE_INFO((_L("CBtsacIdle::GAVDP_Error(%d)"), aError)) |
|
115 (void)aError; |
|
116 } |
|
117 |
|
118 // End of File |