|
0
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2009 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 the License "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 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
#ifndef ISCAPI_H
|
|
|
21 |
#define ISCAPI_H
|
|
|
22 |
|
|
|
23 |
// includes
|
|
|
24 |
#include <e32std.h>
|
|
|
25 |
|
|
|
26 |
// panic codes
|
|
|
27 |
enum TIscApiPanics
|
|
|
28 |
{
|
|
|
29 |
EIscApiChannelNumberOutOfRange = 1,
|
|
|
30 |
EIscApiChannelNotOpen,
|
|
|
31 |
EIscApiCustomFunctionUndefined,
|
|
|
32 |
EIscApiFalseIniFile,
|
|
|
33 |
EIscApiDriverLoadFail,
|
|
|
34 |
EIscApiChannelCreateFail,
|
|
|
35 |
EIscApiMemoryAllocationFailure
|
|
|
36 |
};
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* Class RIscApi defines an interface for sending and receiving data
|
|
|
40 |
* from Domestic OS.
|
|
|
41 |
*
|
|
|
42 |
* @lib IscApi.LIB
|
|
|
43 |
* @since 2.8
|
|
|
44 |
*/
|
|
|
45 |
class RIscApi : public RBusLogicalChannel
|
|
|
46 |
{
|
|
|
47 |
public: // Constructors and destructor
|
|
|
48 |
|
|
|
49 |
//C++ default constructor.
|
|
|
50 |
IMPORT_C RIscApi();
|
|
|
51 |
|
|
|
52 |
//Destructor.
|
|
|
53 |
IMPORT_C ~RIscApi();
|
|
|
54 |
|
|
|
55 |
public: // New functions
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
Initialize the ISC Interface
|
|
|
59 |
@param aStatus Request status, completed with KErrNone if successful
|
|
|
60 |
*/
|
|
|
61 |
IMPORT_C void InitializeModemInterface( TRequestStatus& aStatus );
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
Cancel ISC Initialization sequence
|
|
|
65 |
*/
|
|
|
66 |
IMPORT_C void InitializeCancel();
|
|
|
67 |
|
|
|
68 |
/**
|
|
|
69 |
Open ISC channel asyncronously.
|
|
|
70 |
@param aChannelNumber Channel id to open. Licensee specific ISC.
|
|
|
71 |
@param aStatus Request status, completed with KErrNone if successful
|
|
|
72 |
@param aHandleType Specifies whether the handle is owned by process or by thread
|
|
|
73 |
@param aOpenParams Optional parameters given for the ISC implementation
|
|
|
74 |
@capability CommDD
|
|
|
75 |
*/
|
|
|
76 |
IMPORT_C void Open( const TUint16 aChannelNumber,
|
|
|
77 |
TRequestStatus& aStatus,
|
|
|
78 |
TOwnerType aHandleType = EOwnerThread,
|
|
|
79 |
const TDesC8* aOpenParams = NULL );
|
|
|
80 |
|
|
|
81 |
#if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
|
|
|
82 |
|
|
|
83 |
/**
|
|
|
84 |
Loan a channel owned by some other object. After loan messages directed to and from this
|
|
|
85 |
channel number are coming to this client not the one which opened the channel. After channel is not
|
|
|
86 |
needed anymore the loan should be returned.
|
|
|
87 |
Returns KErrNone when ok, KErrNotFound if channel to be loaned is not open or connection is lost,
|
|
|
88 |
KErrAlreadyExist if tried to loan already loaned channel.
|
|
|
89 |
@param aChannelNumber
|
|
|
90 |
@return TInt
|
|
|
91 |
*/
|
|
|
92 |
IMPORT_C TInt Loan( const TUint16 aChannelNumber, TOwnerType aHandleType = EOwnerThread );
|
|
|
93 |
|
|
|
94 |
/**
|
|
|
95 |
Returns a loaned channel owned by some other object. After loan is retuned messages directed to and from this
|
|
|
96 |
channel number are not coming anymore to this client they are directed back to client which opened the channel.
|
|
|
97 |
Does nothing if the channel is not open.
|
|
|
98 |
@param aChannelNumber
|
|
|
99 |
@param TInt
|
|
|
100 |
*/
|
|
|
101 |
IMPORT_C void ReturnLoan( const TUint16 aChannelNumber );
|
|
|
102 |
#endif
|
|
|
103 |
|
|
|
104 |
/**
|
|
|
105 |
Cancel asynchronous channel opening.
|
|
|
106 |
*/
|
|
|
107 |
IMPORT_C void OpenCancel();
|
|
|
108 |
|
|
|
109 |
/**
|
|
|
110 |
Close ISC Channel synchronously.
|
|
|
111 |
*/
|
|
|
112 |
IMPORT_C void Close();
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
/**
|
|
|
116 |
Close ISC Channel asynchronously.
|
|
|
117 |
*/
|
|
|
118 |
IMPORT_C void Close( TRequestStatus& aStatus );
|
|
|
119 |
|
|
|
120 |
/**
|
|
|
121 |
Empties the receive buffers of the channel.
|
|
|
122 |
*/
|
|
|
123 |
IMPORT_C void ResetBuffers();
|
|
|
124 |
|
|
|
125 |
/**
|
|
|
126 |
Send data to baseband modem (synchronous).
|
|
|
127 |
@param aData Data to be sent
|
|
|
128 |
@return TInt KErrNone if successful
|
|
|
129 |
*/
|
|
|
130 |
IMPORT_C TInt Send( const TDesC8& aData );
|
|
|
131 |
|
|
|
132 |
/**
|
|
|
133 |
Send data to baseband modem (asynchronous).
|
|
|
134 |
@param aStatus Request status, completed with KErrNone if successful
|
|
|
135 |
@param aData Data to be sent
|
|
|
136 |
*/
|
|
|
137 |
IMPORT_C void Send( TRequestStatus& aStatus, const TDesC8& aData );
|
|
|
138 |
|
|
|
139 |
/**
|
|
|
140 |
Cancel asynchronous Send request
|
|
|
141 |
*/
|
|
|
142 |
IMPORT_C void SendCancel();
|
|
|
143 |
|
|
|
144 |
/**
|
|
|
145 |
Send data to baseband modem (synchronous).
|
|
|
146 |
@param aData Data to be sent
|
|
|
147 |
@return TInt KErrNone is successful
|
|
|
148 |
*/
|
|
|
149 |
IMPORT_C TInt DataSend( const TDesC8& aData );
|
|
|
150 |
|
|
|
151 |
/**
|
|
|
152 |
Send data to baseband modem (asynchronous).
|
|
|
153 |
@param aStatus Request status, completed with KErrNone is successful
|
|
|
154 |
@param aData Data to be sent
|
|
|
155 |
*/
|
|
|
156 |
IMPORT_C void DataSend( TRequestStatus& aStatus,
|
|
|
157 |
const TDesC8& aData );
|
|
|
158 |
|
|
|
159 |
/**
|
|
|
160 |
Cancel asynchronous DataSend request.
|
|
|
161 |
*/
|
|
|
162 |
IMPORT_C void DataSendCancel();
|
|
|
163 |
|
|
|
164 |
/**
|
|
|
165 |
Receive data from baseband modem.
|
|
|
166 |
@param aStatus Request status, completed with KErrNone when data has arrived
|
|
|
167 |
@param aData A buffer in the client address space where to write the incoming data
|
|
|
168 |
@param aNeededBufLen If incoming data is too big to fit into client buffer in this variable the correct size is found
|
|
|
169 |
*/
|
|
|
170 |
IMPORT_C void Receive( TRequestStatus& aStatus,
|
|
|
171 |
TDes8& aData,
|
|
|
172 |
TUint16& aNeededBufLen );
|
|
|
173 |
|
|
|
174 |
/**
|
|
|
175 |
Cancel data receiving from baseband modem
|
|
|
176 |
*/
|
|
|
177 |
IMPORT_C void ReceiveCancel();
|
|
|
178 |
|
|
|
179 |
/**
|
|
|
180 |
Receive data from baseband modem.
|
|
|
181 |
@param aStatus Request status, completed with KErrNone when data has arrived
|
|
|
182 |
@param aData A buffer in the client address space where to write the incoming data
|
|
|
183 |
@param aNeededBufLen If incoming data is too big to fit into client buffer in this variable the correct size is found
|
|
|
184 |
*/
|
|
|
185 |
IMPORT_C void DataReceive( TRequestStatus& aStatus,
|
|
|
186 |
TDes8& aData,
|
|
|
187 |
TUint16& aNeededBufLen );
|
|
|
188 |
|
|
|
189 |
/**
|
|
|
190 |
Cancel data receiving from baseband modem
|
|
|
191 |
*/
|
|
|
192 |
IMPORT_C void DataReceiveCancel();
|
|
|
193 |
|
|
|
194 |
/**
|
|
|
195 |
Get the current connection status.
|
|
|
196 |
@return TInt status of connection either EIscConnectionOk or EIscConnectionNotOk.
|
|
|
197 |
@see TIscConnectionStatus
|
|
|
198 |
*/
|
|
|
199 |
IMPORT_C TInt ConnectionStatus();
|
|
|
200 |
|
|
|
201 |
/**
|
|
|
202 |
Listen for connection status changes.
|
|
|
203 |
@param aStatus Request status, completed with KErrNone when status changes
|
|
|
204 |
@param aConnectionStatus new connection status either EIscConnectionOk or EIscConnectionNotOk
|
|
|
205 |
@see TIscConnectionStatus
|
|
|
206 |
*/
|
|
|
207 |
IMPORT_C void NotifyConnectionStatus( TRequestStatus& aStatus,
|
|
|
208 |
TInt& aConnectionStatus );
|
|
|
209 |
|
|
|
210 |
/**
|
|
|
211 |
Stop listening for connection status changes.
|
|
|
212 |
*/
|
|
|
213 |
IMPORT_C void NotifyConnectionStatusCancel();
|
|
|
214 |
|
|
|
215 |
/**
|
|
|
216 |
Get the current flow control status (in uplink-direction).
|
|
|
217 |
@return TInt flow control status. Either EIscFlowControlOn or EIscFlowControlOff
|
|
|
218 |
@see TIscFlowControlStatus
|
|
|
219 |
*/
|
|
|
220 |
IMPORT_C TInt FlowControlStatus();
|
|
|
221 |
|
|
|
222 |
/**
|
|
|
223 |
Listen for flow control status changes.
|
|
|
224 |
@param aStatus Request status, completed with KErrNone when status changes
|
|
|
225 |
@param aFlowControlStatus new flow control status. Either EIscFlowControlOn or EIscFlowControlOff
|
|
|
226 |
@see TIscFlowControlStatus
|
|
|
227 |
*/
|
|
|
228 |
IMPORT_C void NotifyFlowControl( TRequestStatus& aStatus,
|
|
|
229 |
TInt& aFlowControlStatus );
|
|
|
230 |
|
|
|
231 |
/**
|
|
|
232 |
Stop listening for flow control status changes.
|
|
|
233 |
*/
|
|
|
234 |
IMPORT_C void NotifyFlowControlCancel();
|
|
|
235 |
|
|
|
236 |
/**
|
|
|
237 |
Get channel info. The data that is returned depends on the ISC implementation.
|
|
|
238 |
@param aChannel The channel which info is requested
|
|
|
239 |
@param aInfo
|
|
|
240 |
@return TInt KErrNone if successful. KErrNotSupported, if not supported by the ISC implementation.
|
|
|
241 |
*/
|
|
|
242 |
IMPORT_C TInt GetChannelInfo( const TUint16 aChannel,
|
|
|
243 |
TDes8& aInfo );
|
|
|
244 |
|
|
|
245 |
/**
|
|
|
246 |
Get maximun data size (for sending and receiving).
|
|
|
247 |
@return TInt Maximum data size in bytes
|
|
|
248 |
*/
|
|
|
249 |
IMPORT_C TInt MaximumDataSize();
|
|
|
250 |
|
|
|
251 |
/**
|
|
|
252 |
Asynchronous API extension function, functionality has to be specified by the ISC implementation.
|
|
|
253 |
@param aStatus Request status, completed with KErrNone if successful
|
|
|
254 |
@param aOperation Which custom function to execute
|
|
|
255 |
@param aParameters Optional parameters given to the ISC implementation
|
|
|
256 |
*/
|
|
|
257 |
IMPORT_C void CustomFunction( TRequestStatus& aStatus,
|
|
|
258 |
const TUint16 aOperation,
|
|
|
259 |
TAny* aParameters = NULL );
|
|
|
260 |
|
|
|
261 |
/**
|
|
|
262 |
Synchronous API extension function, functionality has to be specified by the ISC implementation.
|
|
|
263 |
@param aOperation Which custom function to execute
|
|
|
264 |
@param aParameters Optional parameters given to the ISC implementation
|
|
|
265 |
@return TInt KErrNone if successful
|
|
|
266 |
*/
|
|
|
267 |
IMPORT_C TInt CustomFunction( const TUint16 aOperation,
|
|
|
268 |
TAny* aParameters = NULL );
|
|
|
269 |
|
|
|
270 |
/**
|
|
|
271 |
Cancel the execution of the asynchronous API extension function.
|
|
|
272 |
@param aOperation Which function to cancel
|
|
|
273 |
*/
|
|
|
274 |
IMPORT_C void CustomFunctionCancel( const TUint16 aOperation );
|
|
|
275 |
|
|
|
276 |
private:
|
|
|
277 |
|
|
|
278 |
/**
|
|
|
279 |
Load all required drivers using Isc_config.ini file.
|
|
|
280 |
@param aMultiplexerInit, descriptor where ISC Multiplexer initialization string is written.
|
|
|
281 |
@param aDataTransmissionInit, descriptor where ISC Data Transmission module initialization string is written
|
|
|
282 |
*/
|
|
|
283 |
void LoadL( const TDesC8& aMultiplexerInit, const TDesC8& aDataTransmissionInit ) const;
|
|
|
284 |
|
|
|
285 |
/**
|
|
|
286 |
Helper function for isc_config.ini parsing.
|
|
|
287 |
@param TDes8& aInifileLine, current line from the .ini file.
|
|
|
288 |
@param TDes8& aDriverName, name of the driver to be searched.
|
|
|
289 |
@return TInt, the position.
|
|
|
290 |
*/
|
|
|
291 |
TInt InifileLineParser( TDes& aInifileLine, TDes& aDriverName )const;
|
|
|
292 |
|
|
|
293 |
/**
|
|
|
294 |
Helper function for isc_config.ini parsing.
|
|
|
295 |
@param TDes& aInitString, the initstring.
|
|
|
296 |
@param TDes8& aDriverName, name of the driver to be searched.
|
|
|
297 |
@param const TDesC8& aString, descriptor for
|
|
|
298 |
@return TInt, the position.
|
|
|
299 |
*/
|
|
|
300 |
void DriverNameParser( TDes& aInitString, TDes& aDriverName, const TDesC8& aString )const;
|
|
|
301 |
|
|
|
302 |
/**
|
|
|
303 |
Panic current thread if channel has not been opened before using IscApi
|
|
|
304 |
*/
|
|
|
305 |
void PanicIfNotOpen() const;
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
private: // Data
|
|
|
309 |
|
|
|
310 |
TPtr8 iNeededLen;
|
|
|
311 |
TPtr8 iNeededDataLen;
|
|
|
312 |
TPtr8 iConnectionStatus;
|
|
|
313 |
TPtr8 iFlowControlStatus;
|
|
|
314 |
TBool iOpen;
|
|
|
315 |
TUint16 iChannelNumber;
|
|
|
316 |
|
|
|
317 |
#ifdef __WINS__
|
|
|
318 |
TBool iInitializing;
|
|
|
319 |
#endif
|
|
|
320 |
|
|
|
321 |
};
|
|
|
322 |
|
|
|
323 |
#endif // ISCAPI_H
|
|
|
324 |
|
|
|
325 |
// End of File
|