|
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: SIMPLE engine core connection |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef simpleconnection_H |
|
22 #define simpleconnection_H |
|
23 |
|
24 #include <e32std.h> |
|
25 #include "simplecommon.h" |
|
26 #include "msimpleconnection.h" |
|
27 #include "msimpleowncallback.h" |
|
28 |
|
29 // FORWARD DECLARATION |
|
30 class CSimpleSipConnection; |
|
31 class CSimpleEngineRequest; |
|
32 class MSimpleConnectionObserver; |
|
33 |
|
34 /** |
|
35 * CSimpleConnection |
|
36 * |
|
37 * SIMPLE Engine core connection. |
|
38 * |
|
39 * @lib simpleengine |
|
40 * @since S60 3.2 |
|
41 */ |
|
42 class CSimpleConnection : public CBase, public MSimpleConnection, public MSimpleOwnCallback |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * |
|
50 * @since S60 3.2 |
|
51 * @param aObserver callback observer |
|
52 * @return CSimpleConnection |
|
53 */ |
|
54 static CSimpleConnection* NewL( MSimpleConnectionObserver& aObserver ); |
|
55 |
|
56 static CSimpleConnection* NewL( MSimpleConnectionObserver& aObserver, TInt32 aServiceId ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 virtual ~CSimpleConnection(); |
|
62 |
|
63 /** |
|
64 * SIP connction accessor from siputils. |
|
65 * |
|
66 * @since S60 3.2 |
|
67 * @return SIP utils connection |
|
68 */ |
|
69 CSimpleSipConnection* Connection(); |
|
70 |
|
71 |
|
72 // from base class MSimpleConnection |
|
73 |
|
74 /** |
|
75 * Destroy this entity |
|
76 * |
|
77 * @since S60 3.2 |
|
78 */ |
|
79 void Close(); |
|
80 |
|
81 /** |
|
82 * Login using default SIP settings |
|
83 * |
|
84 * @since S60 3.2 |
|
85 * @return operation id |
|
86 */ |
|
87 TInt LoginL(); |
|
88 |
|
89 /** |
|
90 * Login using specified SIP settings |
|
91 * |
|
92 * @since S60 3.2 |
|
93 * @param aId SIP profile id |
|
94 * @return operation id |
|
95 */ |
|
96 TInt LoginL( TInt aId ); |
|
97 |
|
98 /** |
|
99 * Getter for the connection staus. |
|
100 * |
|
101 * @since S60 3.2 |
|
102 * @return connection staus |
|
103 */ |
|
104 TSimpleState ConnectionStatus(); |
|
105 |
|
106 /** |
|
107 * Current SIP identity accessor |
|
108 * @return SIP identity |
|
109 */ |
|
110 TPtrC8 CurrentSIPIdentityL(); |
|
111 |
|
112 // from base class MSimpleOwnCallback |
|
113 |
|
114 /** |
|
115 * Complete the open client request |
|
116 * @since S60 3.2 |
|
117 * @param aOpId operation id |
|
118 * @param aStatus result status |
|
119 */ |
|
120 void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq ); |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * Count new operation id |
|
126 * @since S60 3.2 |
|
127 */ |
|
128 void IncreaseOpId( ); |
|
129 |
|
130 /** |
|
131 * Delete pending requests |
|
132 * @since S60 3.2 |
|
133 */ |
|
134 void DeleteRequests(); |
|
135 |
|
136 /** |
|
137 * Two-phase constructor |
|
138 */ |
|
139 void ConstructL( TInt32 aServiceId ); |
|
140 |
|
141 /** |
|
142 * constructor |
|
143 */ |
|
144 CSimpleConnection( MSimpleConnectionObserver& aObserver ); |
|
145 |
|
146 /** |
|
147 * State type converter |
|
148 * |
|
149 * @since S60 3.2 |
|
150 * @param aState TSimpleSipState |
|
151 * @return MSimpleConnection::TSimpleState |
|
152 */ |
|
153 MSimpleConnection::TSimpleState ConvertState( TSimpleSipState aState ); |
|
154 |
|
155 /** |
|
156 * Set SIP Connection status |
|
157 * |
|
158 * @since S60 3.2 |
|
159 * @param aState connection state |
|
160 */ |
|
161 void SetConnectionStatus( TSimpleState aState ); |
|
162 |
|
163 private: // data |
|
164 |
|
165 /** |
|
166 * Engine state |
|
167 */ |
|
168 TSimpleState iState; |
|
169 |
|
170 /** |
|
171 * SIMPLE engine core |
|
172 * Own. |
|
173 */ |
|
174 CSimpleSipConnection* iConnection; |
|
175 |
|
176 /** |
|
177 * Client API observer for events |
|
178 */ |
|
179 MSimpleConnectionObserver& iObserver; |
|
180 |
|
181 /** |
|
182 * next operation id |
|
183 */ |
|
184 TInt iOpId; |
|
185 |
|
186 /** |
|
187 * Buffer for client requests |
|
188 */ |
|
189 TDblQue<CSimpleEngineRequest> iRequestList; |
|
190 |
|
191 /** |
|
192 * Lower limit of opid |
|
193 */ |
|
194 TInt iLimitLowerValue; |
|
195 |
|
196 /** |
|
197 * Upper limit of opid |
|
198 */ |
|
199 TInt iLimitUpperValue; |
|
200 |
|
201 }; |
|
202 |
|
203 #endif |
|
204 |
|
205 // End of File |