|
1 // Copyright (c) 2002-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 #include <comms-infras/nifagt.h> |
|
17 #include <comms-infras/nifif.h> |
|
18 #include "CSelectionRequest.h" |
|
19 #include "CNetworkController.h" |
|
20 #include "NetConPanic.h" |
|
21 #include "NetConLog.h" |
|
22 #include "NetConError.h" |
|
23 |
|
24 CSelectionRequest* CSelectionRequest::NewL(MNetConEnv* aController, MNetworkControllerObserver* aObserver, TConnStartType aConnStartType, const TConnPref& aPrefs, TInt aConnectionAttempt, TInt aLastConnectionError) |
|
25 { |
|
26 CSelectionRequest* self = new(ELeave) CSelectionRequest(aController, aObserver, aConnStartType, aPrefs, aConnectionAttempt, aLastConnectionError); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(); |
|
29 CleanupStack::Pop(); // self |
|
30 return self; |
|
31 } |
|
32 |
|
33 CSelectionRequest::CSelectionRequest(MNetConEnv* aController, MNetworkControllerObserver* aObserver, TConnStartType aConnStartType, const TConnPref& aPrefs, TInt aConnectionAttempt, TInt aLastConnectionError) |
|
34 : CNetConRequestBase(aController, aObserver, NULL), iConnStartType(aConnStartType), iConnPrefs(aPrefs), iConnectionAttempt(aConnectionAttempt), iLastConnectionError(aLastConnectionError) |
|
35 { } |
|
36 |
|
37 void CSelectionRequest::ConstructL() |
|
38 { |
|
39 |
|
40 TCallBack callback(AsyncCb, this); |
|
41 iAsyncCb = new(ELeave) CAsyncCallBack(callback, CActive::EPriorityStandard); |
|
42 } |
|
43 |
|
44 CSelectionRequest::~CSelectionRequest() |
|
45 { |
|
46 |
|
47 if(iAsyncCb) |
|
48 delete iAsyncCb; |
|
49 } |
|
50 |
|
51 TInt CSelectionRequest::AsyncCb(TAny* aThisPtr) |
|
52 { |
|
53 CSelectionRequest* self = (CSelectionRequest*)aThisPtr; |
|
54 self->AsyncCbComplete(); |
|
55 return KErrNone; |
|
56 } |
|
57 |
|
58 void CSelectionRequest::AsyncCbComplete() |
|
59 { |
|
60 |
|
61 RequestComplete(KErrNone); |
|
62 } |
|
63 |
|
64 void CSelectionRequest::StartRequest() |
|
65 { |
|
66 |
|
67 // if iConnectionAttempt > 100 then it is used to indicate the test number and hence the behaviour! |
|
68 switch(iConnectionAttempt) |
|
69 { |
|
70 case 100: |
|
71 case 300: |
|
72 case 900: |
|
73 case 1000: |
|
74 RequestComplete(KErrNone); |
|
75 break; |
|
76 case 200: |
|
77 case 1100: |
|
78 RequestComplete(KErrBadPower); |
|
79 break; |
|
80 case 600: |
|
81 iAsyncCb->CallBack(); |
|
82 break; |
|
83 default: |
|
84 User::Invariant(); |
|
85 } |
|
86 } |
|
87 |
|
88 void CSelectionRequest::RequestComplete(TInt aError) |
|
89 { |
|
90 |
|
91 iController->RequestComplete(this, aError); |
|
92 } |
|
93 |
|
94 void CSelectionRequest::CancelRequest() |
|
95 { |
|
96 } |
|
97 |
|
98 void CSelectionRequest::SetAvailableBearers(const TUint32) |
|
99 { |
|
100 |
|
101 User::Invariant(); |
|
102 } |
|
103 |
|
104 const TDesC& CSelectionRequest::AgentName() const |
|
105 { |
|
106 |
|
107 _LIT(KAgentName, "An Agent Name"); |
|
108 return KAgentName(); |
|
109 } |
|
110 |
|
111 const TPckgBuf<TSoIfConnectionInfo>& CSelectionRequest::AgentConnectionInfo() const |
|
112 { |
|
113 |
|
114 return iAgentConnInfo; |
|
115 } |
|
116 |
|
117 const TConnStartType& CSelectionRequest::ConnectionStartType() const |
|
118 { |
|
119 return iConnStartType; |
|
120 } |
|
121 |
|
122 const TConnPref& CSelectionRequest::ConnPrefs() const |
|
123 { |
|
124 |
|
125 return iConnPrefs; |
|
126 } |
|
127 |