|
1 /** |
|
2 * Copyright (c) 2010 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 * Header file TunDriver Agent |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 /** |
|
21 @file tundriveragent.h |
|
22 @internalTechnology |
|
23 */ |
|
24 |
|
25 |
|
26 #if !defined __TUNDRIVERAGT_H__ |
|
27 #define __TUNDRIVERAGT_H__ |
|
28 |
|
29 #include <comms-infras/cagentbase.h> |
|
30 #include <comms-infras/agentmessages.h> |
|
31 #include "tundriveragtprog.h" |
|
32 |
|
33 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
34 #include <comms-infras/nifprvar_internal.h> |
|
35 #include <nifman_internal.h> |
|
36 #endif |
|
37 |
|
38 const TInt KMajorVersionNumber=1; //< TunDriver Agent MajorVersionNumber |
|
39 const TInt KMinorVersionNumber=0; //< TunDriver Agent MinorVersionNumber |
|
40 const TInt KBuildVersionNumber=1; //< TunDriver Agent BuildVersionNumber |
|
41 |
|
42 _LIT(KTunDriverAgentName,"tundriveragt"); //< Name of the TunDriver Agent |
|
43 |
|
44 |
|
45 class CTunDriverAgentFactory : public CNifAgentFactory |
|
46 /** |
|
47 A Factory for creating a TunDriverAgent |
|
48 |
|
49 @internalComponent |
|
50 */ |
|
51 { |
|
52 protected: |
|
53 void InstallL(); |
|
54 CNifAgentBase *NewAgentL(const TDesC& aName); |
|
55 TInt Info(TNifAgentInfo& aInfo, TInt aIndex) const; |
|
56 }; |
|
57 |
|
58 class CTunDriverAgent : public CAgentBase |
|
59 /** |
|
60 The CTunDriverAgent class owns a CAsyncCallback , which is used to control the asynchronous |
|
61 ServiceStarted() and DisconnectComplete() call from the Agent to Nifman. |
|
62 |
|
63 @internalComponent |
|
64 */ |
|
65 { |
|
66 public: |
|
67 static CTunDriverAgent* NewL(); |
|
68 virtual ~CTunDriverAgent(); |
|
69 protected: |
|
70 void ConstructL(); |
|
71 CTunDriverAgent(); |
|
72 public: |
|
73 |
|
74 // from CNifAgentBase |
|
75 void Info(TNifAgentInfo& aInfo) const; |
|
76 void Connect(TAgentConnectType aType); |
|
77 void Connect(TAgentConnectType aType, CStoreableOverrideSettings* aOverrideSettings); |
|
78 void CancelConnect(); |
|
79 void Disconnect(TInt aReason); |
|
80 void ServiceStarted(TInt aError); |
|
81 void ConnectionComplete(TInt aError); |
|
82 void DisconnectionComplete(); |
|
83 |
|
84 TInt GetExcessData(TDes8& aBuffer); |
|
85 TInt Notification(TNifToAgentEventType aEvent, TAny* aInfo); |
|
86 void GetLastError(TInt& aError); |
|
87 TBool IsReconnect() const {return (ETrue);}; |
|
88 |
|
89 TInt IncomingConnectionReceived(); |
|
90 |
|
91 private: |
|
92 static TInt ServiceStartedCb(TAny* aThisPtr); |
|
93 static TInt ConnectCompleteCb(TAny* aThisPtr); |
|
94 static TInt DisconnectCompleteCb(TAny* aThisPtr); |
|
95 |
|
96 private: |
|
97 CAsyncCallBack iServiceStartedCallback; |
|
98 CAsyncCallBack iConnectCompleteCallback; |
|
99 CAsyncCallBack iDisconnectCallback; |
|
100 TBool iConnected; |
|
101 TBool iCancelled; |
|
102 |
|
103 /** An integer to keep last error code in memory. */ |
|
104 TInt iLastErrorCode; |
|
105 |
|
106 /** Boolean to define wether disconnecting operation is ongoing */ |
|
107 TBool iDisconnecting; |
|
108 TTunDriverAgentProgress iAgentProgress; |
|
109 }; |
|
110 |
|
111 #endif // _TUNDRIVERAGT_H |