|
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: |
|
15 * Server class creates the session. This class then recieves the messages from |
|
16 * client and forward them to server class to be handled. Messages are completed |
|
17 * with return values recieved from server. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef BTACCSESSION_H |
|
23 #define BTACCSESSION_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32svr.h> // access CSession2 declaration |
|
27 #include <bttypes.h> |
|
28 #include "btaccTypes.h" |
|
29 |
|
30 // CLASS DECLARATION |
|
31 class CBTAccServer; |
|
32 class CBasrvAccMan; |
|
33 class TAccInfo; |
|
34 class CBasrvAudio4Dos; |
|
35 |
|
36 /** |
|
37 * CBTSession class represent session on server side |
|
38 * |
|
39 */ |
|
40 NONSHARABLE_CLASS(CBTAccSession) : public CSession2 |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 /** |
|
44 * Constructor. |
|
45 */ |
|
46 static CBTAccSession* NewL(CBasrvAccMan& aAccMan); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 ~CBTAccSession(); |
|
52 |
|
53 void ConnectCompleted(TInt aErr, TInt aProfile, const RArray<TBTDevAddr>* aConflicts); |
|
54 |
|
55 void DisconnectCompleted(TInt aProfile, TInt aErr); |
|
56 |
|
57 void DisconnectAllCompleted(TInt aErr); |
|
58 |
|
59 void NotifyClientNewProfile(TInt aProfile, const TBTDevAddr& aAddr); |
|
60 void NotifyClientNoProfile(TInt aProfile, const TBTDevAddr& aAddr); |
|
61 |
|
62 // For DosServer version only |
|
63 void AudioToPhone(const RMessage2& aMessage); |
|
64 void AudioToAccessory(const RMessage2& aMessage); |
|
65 void CancelAudioToAccessory(); |
|
66 void AudioToPhoneComplete(); |
|
67 void AudioToAccessoryComplete(TInt aErr); |
|
68 |
|
69 private: |
|
70 /** |
|
71 * connect an accessory |
|
72 * @param aMessage Message from client containing BT Device address |
|
73 * @return KErrNone if successful otherwise one of the system wide error cdes |
|
74 */ |
|
75 void ConnectToAccessory(const RMessage2& aMessage); |
|
76 |
|
77 /** |
|
78 * cancel connecting |
|
79 */ |
|
80 void CancelConnectToAccessory(); |
|
81 |
|
82 /** |
|
83 * disconnect an accessory |
|
84 * @param aMessage Message from client containing BT Device address |
|
85 * @return KErrNone if successful otherwise one of the system wide error cdes |
|
86 */ |
|
87 void DisconnectAccessory(const RMessage2& aMessage); |
|
88 |
|
89 void GetConnections(const RMessage2& aMessage); |
|
90 |
|
91 void DisconnectAllGracefully(const RMessage2& aMessage); |
|
92 |
|
93 void NotifyProfileStatus(const RMessage2& aMessage); |
|
94 |
|
95 /** |
|
96 * |
|
97 * @param |
|
98 * @return |
|
99 */ |
|
100 void GetInfoOfConnectedAcc(const RMessage2& aMessage); |
|
101 |
|
102 void IsConnected(const RMessage2& aMessage); |
|
103 |
|
104 private: // Functions from base classes |
|
105 void ServiceL(const RMessage2 &aMessage); |
|
106 |
|
107 CBTAccServer& Server(); |
|
108 |
|
109 void CreateL(); |
|
110 |
|
111 private: |
|
112 /** |
|
113 * C++ default constructor. |
|
114 */ |
|
115 CBTAccSession(CBasrvAccMan& aAccMan); |
|
116 |
|
117 void HandleAudio4DosRequest(const RMessage2 &aMessage); |
|
118 |
|
119 void DestructVariant(); |
|
120 |
|
121 void UpdateProfileStatusCache(const TProfileStatus& aStatus); |
|
122 |
|
123 private: // Data |
|
124 CBasrvAccMan& iAccMan; // not own |
|
125 |
|
126 TBTDevAddr iConnectingAddr; |
|
127 RMessagePtr2 iConnectMsg; |
|
128 RMessagePtr2 iDisconnectMsg; |
|
129 RMessagePtr2 iDisconnectAllMsg; |
|
130 |
|
131 RArray<TProfileStatus> iProfileStatusCache; |
|
132 RMessagePtr2 iNotifyProfileMsg; |
|
133 |
|
134 CBasrvAudio4Dos* iAudio4Dos; |
|
135 }; |
|
136 |
|
137 #endif // BTACCSESSION_H |
|
138 |
|
139 // End of File |