|
1 /* |
|
2 * Copyright (c) 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: BTEng server session header definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef BTENGSRVSESSION_H |
|
21 #define BTENGSRVSESSION_H |
|
22 |
|
23 #include <badesca.h> |
|
24 #include "btengclientserver.h" |
|
25 |
|
26 class CSession2; |
|
27 class RMessage; |
|
28 class CBTEngServer; |
|
29 typedef RArray<TBTDevAddr> RBTDevAddrArray; |
|
30 |
|
31 |
|
32 /** |
|
33 * Class CBTEngSrvSession, server-side session class. |
|
34 * |
|
35 * An instance of this class is created for every client session, |
|
36 * and handles client messages (commands). It also handles informing |
|
37 * clients of connection events. |
|
38 * |
|
39 * @lib bteng.lib |
|
40 * @since S60 v3.2 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CBTEngSrvSession ): public CSession2 |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phase constructor |
|
49 * |
|
50 * @since S60 v3.2 |
|
51 * @return Pointer to the constructed CBTEngSrvSession object. |
|
52 */ |
|
53 static CBTEngSrvSession* NewL(); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CBTEngSrvSession(); |
|
59 |
|
60 /** |
|
61 * Notify the client of the connection event. |
|
62 * |
|
63 * @since S60 v3.2 |
|
64 * @param aAddr The address of the remote Bluetooth device |
|
65 * @param aConnStatus Status of the connection. |
|
66 * @param aArray Contains the bluetooth device addresses of the remote |
|
67 * devices for which profile connections exist for an |
|
68 * outgoing connection request. |
|
69 * @param aErr The error code indicating the result of the connection |
|
70 * request. |
|
71 */ |
|
72 void NotifyConnectionEvent( const TBTDevAddr aAddr, |
|
73 TBTEngConnectionStatus aConnStatus, |
|
74 RBTDevAddrArray* aArray, TInt aErr ); |
|
75 |
|
76 /** |
|
77 * Completes client's pairing request. |
|
78 * @param aResult the resultof pairing the client will receive. |
|
79 */ |
|
80 TInt CompletePairRequest( TInt aResult ); |
|
81 |
|
82 private: // from base class CSession2 |
|
83 |
|
84 /** |
|
85 * From CSession2. |
|
86 * Processes a message from a client. |
|
87 * |
|
88 * @since S60 v3.2 |
|
89 * @param aMessage The message containing the details of the client request. |
|
90 */ |
|
91 virtual void ServiceL( const RMessage2& aMessage ); |
|
92 |
|
93 /** |
|
94 * From CSession2. |
|
95 * Completes construction of the session. |
|
96 * |
|
97 * @since S60 v3.2 |
|
98 */ |
|
99 virtual void CreateL(); |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * C++ default constructor |
|
105 * |
|
106 * @since S60 v3.2 |
|
107 */ |
|
108 CBTEngSrvSession(); |
|
109 |
|
110 /** |
|
111 * Symbian 2nd-phase constructor |
|
112 * |
|
113 * @since S60 v3.2 |
|
114 */ |
|
115 void ConstructL(); |
|
116 |
|
117 /** |
|
118 * Returns a handle to the server object. |
|
119 * |
|
120 * @since S60 v3.2 |
|
121 * @return Pointer to the server object. |
|
122 */ |
|
123 CBTEngServer* Server(); |
|
124 |
|
125 /** |
|
126 * Processes a message from a client. |
|
127 * |
|
128 * @since S60 v3.2 |
|
129 * @param aMessage The message containing the details of the client request. |
|
130 */ |
|
131 void DispatchMessageL( const RMessage2& aMessage ); |
|
132 |
|
133 /** |
|
134 * Cancels outstanding pairing request. |
|
135 */ |
|
136 void CancelPairRequest(); |
|
137 |
|
138 private: // data |
|
139 /** |
|
140 * Client-server message containing the thread handle of the client. |
|
141 * For connection notifications. |
|
142 */ |
|
143 RMessage2 iNotifyConnMessage; |
|
144 |
|
145 /** |
|
146 * For connection notifications. |
|
147 * For outgoing pairing request. |
|
148 */ |
|
149 RMessage2 iPairMessage; |
|
150 |
|
151 /** |
|
152 * Flag indicating if this client requested BT to be switched on temporarily. |
|
153 */ |
|
154 TBool iAutoSwitchOff; |
|
155 |
|
156 /** |
|
157 * Required for queuing connection events to send to the client |
|
158 */ |
|
159 CDesC8ArraySeg* iConnectionEventQueue; |
|
160 }; |
|
161 |
|
162 #endif // BTENGSRVSESSION |