|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __SIMNTRAS_H__ |
|
17 #define __SIMNTRAS_H__ |
|
18 |
|
19 /** |
|
20 * @file |
|
21 * Header for NTRAS access class. |
|
22 * @internalAll |
|
23 */ |
|
24 |
|
25 #include "CSimSerComm.h" |
|
26 #include "csimtimer.h" |
|
27 #include "CSimPhone.h" |
|
28 |
|
29 _LIT(KDefaultCsyName,"ECUART.CSY"); //< Default CSY |
|
30 _LIT(KDefaultPortName,"COMM::0"); //< Default port name |
|
31 _LIT(KDefaultSetting,"DEF"); //< Default commSettings (context independent) |
|
32 |
|
33 const TBps KDefaultCommPortRate=EBps115200; //< Default data rate |
|
34 const TUint KDefaultHandshake=20; //< Default handshaking |
|
35 |
|
36 const TInt KReadBufferSize=10; // < Read buffer size - used for storing the results from a single read request. |
|
37 const TInt KInputBufferSize=100; // < Input buffer size - used for accumulating the received data from the NTRas server. |
|
38 |
|
39 class MNTRasCallBack; |
|
40 |
|
41 /** |
|
42 * This class attempts an NTRas connection given a set of port and configuration settings. |
|
43 */ |
|
44 class CSimNtRas : public CBase, MComm, MTimerCallBack |
|
45 { |
|
46 public: |
|
47 static CSimNtRas* NewL(CSimPhone* aPhone); |
|
48 ~CSimNtRas(); |
|
49 TInt Connect(const TDesC& aCsyName, const TDesC& aPort, |
|
50 const TCommConfigV01& aConfig, MNTRasCallBack* aCallback); |
|
51 void Cancel(); |
|
52 void Terminate(); |
|
53 |
|
54 private: |
|
55 CSimNtRas(CSimPhone* aPhone); |
|
56 void ConstructL(); |
|
57 void TimerCallBack(TInt aId); |
|
58 void CommReadComplete(TInt aStatus); |
|
59 void CommWriteComplete(TInt aStatus); |
|
60 void AttemptConnect(); |
|
61 |
|
62 private: |
|
63 CSimPhone* iPhone; |
|
64 MComm* iComm; // < Pointer to Comm Port read/write class |
|
65 CSimTimer* iTimer; // < Pointer to timer class |
|
66 MNTRasCallBack* iCallback; // < Pointer to callback class to be used when connection attempt has completed. |
|
67 TBuf8<KReadBufferSize> iReadBuf; // < Read buffer - used to store the results from a single read request. |
|
68 TBuf8<KInputBufferSize> iInputBuf; // < Input buffer - used to accumulate the received data from the NTRas server. |
|
69 TBool iPortOpen; // < Flag indicating the open status of the port. |
|
70 TInt iAttemptCnt; // < Transmission retry counter |
|
71 }; |
|
72 |
|
73 /** |
|
74 * This mixin class contains the pure virtual function that is used when the NTRas |
|
75 * connection attempt completes. |
|
76 */ |
|
77 class MNTRasCallBack |
|
78 { |
|
79 public: |
|
80 virtual void NTRasCallBack(TInt aStatus)=0; |
|
81 }; |
|
82 |
|
83 #endif |