1 /* |
|
2 * Copyright (c) 2009-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 * This is a source file for connmon library stub functions for UT. |
|
16 */ |
|
17 |
|
18 #include <QString> |
|
19 #include <QObject> |
|
20 #include <QVariant> |
|
21 #include <rconnmon.h> |
|
22 #include <nifvar.h> |
|
23 #include <cmmanager_shim.h> |
|
24 |
|
25 #include "wlanqtutilsap.h" |
|
26 |
|
27 #ifdef __WINS__ |
|
28 |
|
29 #include "wlanqtutilstestcontext.h" |
|
30 |
|
31 extern WlanQtUtilsTestContext testContext; |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CConnMonEventBase::CConnMonEventBase |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CConnMonEventBase::CConnMonEventBase( const TInt aEventType, const TUint aConnectionId ) |
|
38 { |
|
39 iEventType = aEventType; |
|
40 iConnectionId = aConnectionId; |
|
41 } |
|
42 |
|
43 // Destructor |
|
44 CConnMonEventBase::~CConnMonEventBase() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CConnMonEventBase::EventType |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 TInt CConnMonEventBase::EventType() const |
|
53 { |
|
54 return iEventType; |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CConnMonConnectionStatusChange::CConnMonConnectionStatusChange |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CConnMonConnectionStatusChange::CConnMonConnectionStatusChange( |
|
62 const TUint aConnectionId, |
|
63 const TUint aSubConnectionId, |
|
64 const TInt aConnectionStatus ) : |
|
65 CConnMonEventBase(EConnMonConnectionStatusChange, aConnectionId) |
|
66 { |
|
67 iSubConnectionId = aSubConnectionId; |
|
68 iConnectionStatus = aConnectionStatus; |
|
69 } |
|
70 |
|
71 // Destructor |
|
72 CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange() |
|
73 { |
|
74 } |
|
75 |
|
76 // Request status for canceling stubbed async request |
|
77 TRequestStatus* iStubRequestStatus = 0; |
|
78 |
|
79 void RConnectionMonitor::CancelAsyncRequest( |
|
80 TInt aReqToCancel) |
|
81 { |
|
82 (void)aReqToCancel; |
|
83 User::RequestComplete(iStubRequestStatus, KErrCancel); |
|
84 iStubRequestStatus = 0; |
|
85 } |
|
86 |
|
87 void RConnectionMonitor::GetConnectionCount( |
|
88 TUint& aConnectionCount, |
|
89 TRequestStatus& aStatus) |
|
90 { |
|
91 aConnectionCount = testContext.connMon_.activeConnections_.activeConnList_.count(); |
|
92 User::RequestComplete(&aStatus, KErrNone); |
|
93 } |
|
94 |
|
95 TInt RConnectionMonitor::GetConnectionInfo( |
|
96 const TUint aIndex, |
|
97 TUint& aConnectionId, |
|
98 TUint& aSubConnectionCount ) const |
|
99 { |
|
100 aConnectionId = testContext.connMon_.activeConnections_.activeConnList_[aIndex - 1]->connectionId(); |
|
101 aSubConnectionCount = 0; |
|
102 return KErrNone; // TODO: put return value into context. |
|
103 } |
|
104 |
|
105 void RConnectionMonitor::GetIntAttribute( |
|
106 const TUint aConnectionId, |
|
107 const TUint /* aSubConnectionId */, |
|
108 const TUint aAttribute, |
|
109 TInt& aValue, |
|
110 TRequestStatus& aStatus ) |
|
111 { |
|
112 WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); |
|
113 if (aAttribute == KBearer) { |
|
114 aValue = activeConn->connMonBearerType_; |
|
115 } else if (aAttribute == KConnectionStatus) { |
|
116 aValue = activeConn->connMonConnectionStatus_; |
|
117 } else { |
|
118 Q_ASSERT(false); |
|
119 } |
|
120 User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. |
|
121 } |
|
122 |
|
123 void RConnectionMonitor::GetUintAttribute( |
|
124 const TUint aConnectionId, |
|
125 const TUint /* aSubConnectionId */, |
|
126 const TUint aAttribute, |
|
127 TUint& aValue, |
|
128 TRequestStatus& aStatus ) |
|
129 { |
|
130 WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); |
|
131 if (aAttribute == KIAPId) { |
|
132 aValue = activeConn->iapId(); |
|
133 } else { |
|
134 Q_ASSERT(false); |
|
135 } |
|
136 |
|
137 User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. |
|
138 } |
|
139 |
|
140 #endif // __WINS__ |
|