|
1 /* |
|
2 * Copyright (c) 2005-2006 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: The base accessory state declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_BTASRVACCSTATE_H |
|
20 #define C_BTASRVACCSTATE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <bttypes.h> |
|
24 #include <btengconstants.h> |
|
25 #include "basrvactive.h" |
|
26 #include "basrvacc.h" |
|
27 #include "basrvaccman.h" |
|
28 #include "basrvpluginman.h" |
|
29 #include "btaccPlugin.h" |
|
30 #include "btaccTypes.h" |
|
31 #include "BTAccInfo.h" |
|
32 #include "BTAccFwIf.h" |
|
33 |
|
34 class CBasrvAccState : public CBase, public MBasrvActiveObserver |
|
35 { |
|
36 public: |
|
37 |
|
38 virtual ~CBasrvAccState(); |
|
39 |
|
40 /** |
|
41 * Entry of this state. |
|
42 * |
|
43 * @since S60 v3.1 |
|
44 */ |
|
45 virtual void EnterL() = 0; |
|
46 |
|
47 /** |
|
48 * Returns the next state if EnterL leaves. |
|
49 * |
|
50 * @since S60 v3.1 |
|
51 * @return the next state |
|
52 */ |
|
53 virtual CBasrvAccState* ErrorOnEntry(TInt aReason); |
|
54 |
|
55 virtual TBTEngConnectionStatus ConnectionStatus() const = 0; |
|
56 |
|
57 /** |
|
58 * Connect to an accessory. Default inplementation returns KErrInUse. |
|
59 * @param aAddr BD address of the accessory to be connected |
|
60 * @return an error |
|
61 */ |
|
62 virtual void ConnectL(const TBTDevAddr& aAddr); |
|
63 |
|
64 /** |
|
65 * Cancel connecting to accessory |
|
66 */ |
|
67 virtual void CancelConnect(); |
|
68 |
|
69 /** |
|
70 * Disconnect accessory. Default implementation returns KErrNotFound. |
|
71 * @param aAddr BD address of the accessory to be connected |
|
72 * @return an error |
|
73 */ |
|
74 virtual void DisconnectL(); |
|
75 |
|
76 /** |
|
77 * |
|
78 * @return an error. Default implementation returns KErrNotFound |
|
79 */ |
|
80 virtual void AccessoryConnected(TProfiles aProfile); |
|
81 |
|
82 /** |
|
83 * |
|
84 * @return an error. Default implementation returns KErrNotFound |
|
85 */ |
|
86 virtual void AccOpenedAudio(TProfiles aProfile); |
|
87 |
|
88 /** |
|
89 * |
|
90 * @return an error. Default implementation returns KErrNotFound |
|
91 */ |
|
92 virtual void AccClosedAudio(TProfiles aProfile); |
|
93 |
|
94 /** |
|
95 * Called when the connection is disconnected from remote side or there |
|
96 * is error on reading/writing data packet. |
|
97 * @param aErr the error code of event |
|
98 */ |
|
99 virtual void AccessoryDisconnectedL(TProfiles aProfile); |
|
100 |
|
101 /** |
|
102 * Called when an audio open request comes from Acc FW. |
|
103 */ |
|
104 virtual void OpenAudioL(TAccAudioType aType); |
|
105 |
|
106 /** |
|
107 * Called when an audio close request comes from Acc FW. |
|
108 */ |
|
109 virtual void CloseAudioL(TAccAudioType aType); |
|
110 |
|
111 protected: |
|
112 // From MBasrvActiveObserver |
|
113 |
|
114 /** |
|
115 * Handles the request completion event. |
|
116 * |
|
117 * @since S60 v3.1 |
|
118 * @param aActive the Active Object to which the request is assigned to. |
|
119 */ |
|
120 virtual void RequestCompletedL(CBasrvActive& aActive); |
|
121 |
|
122 /** |
|
123 * Handles the cancellation of an outstanding request. |
|
124 * |
|
125 * @since S60 v3.1 |
|
126 * @param aActive the Active Object to which the request is assigned to. |
|
127 */ |
|
128 virtual void CancelRequest(CBasrvActive& aActive); |
|
129 |
|
130 protected: |
|
131 |
|
132 /** |
|
133 * Default constructor |
|
134 */ |
|
135 CBasrvAccState(CBasrvAcc& aParent, TRequestStatus* aRequest); |
|
136 |
|
137 /** |
|
138 * Gets the owner of the state machine |
|
139 * |
|
140 * @since S60 v3.1 |
|
141 * @return the state machine owner |
|
142 */ |
|
143 CBasrvAcc& Parent(); |
|
144 |
|
145 /** |
|
146 * Completes the pending request in this state with specified error code |
|
147 * and then zero the pointer. |
|
148 * |
|
149 * @since S60 v3.1 |
|
150 * @param aErr the completion error code |
|
151 */ |
|
152 void CompleteStateRequest(TInt aErr); |
|
153 |
|
154 /** |
|
155 * Completes the give pending request with specified error code.. |
|
156 * |
|
157 * @since S60 v3.1 |
|
158 * @param aRequest the request to be completed |
|
159 * @param aErr the completion error code |
|
160 */ |
|
161 void CompleteRequest(TRequestStatus* aRequest, TInt aErr); |
|
162 |
|
163 void StatePrint(const TDesC& aStateName); |
|
164 |
|
165 TAccInfo& AccInfo(); |
|
166 |
|
167 void NewProfileConnection(TProfiles aProfile); |
|
168 |
|
169 void ProfileDisconnected(TProfiles aProfile); |
|
170 |
|
171 TBool IsAvrcpTGCat2SupportedByRemote(); |
|
172 |
|
173 protected: |
|
174 |
|
175 CBasrvAcc& iParent; |
|
176 |
|
177 /** |
|
178 * Possible to be NULL. |
|
179 * The async request performed in this state if it is not NULL. |
|
180 */ |
|
181 TRequestStatus* iRequest; |
|
182 }; |
|
183 |
|
184 #endif // C_BTASRVACCSTATE_H |
|
185 |
|
186 // End of File |