summaryrefslogtreecommitdiffstats
path: root/examples/network
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-06-30 14:05:35 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-06-30 14:10:46 (GMT)
commita884c4d9e1cd6e1258802e4406a17ff16d3b8e66 (patch)
tree5ba1461423464be79b6e4d26a49a60aed49b1299 /examples/network
parentc84ac698d29cb2317af5f478b02da6bfb5673716 (diff)
downloadQt-a884c4d9e1cd6e1258802e4406a17ff16d3b8e66.zip
Qt-a884c4d9e1cd6e1258802e4406a17ff16d3b8e66.tar.gz
Qt-a884c4d9e1cd6e1258802e4406a17ff16d3b8e66.tar.bz2
RConnectionManager is not used any more.
We dont need to link agains 'connmon' library any more. With this we depend only on Symbina and not S60 (Avkon).
Diffstat (limited to 'examples/network')
-rw-r--r--examples/network/ftp/ftp.pro2
-rw-r--r--examples/network/ftp/sym_iap_util.h69
2 files changed, 30 insertions, 41 deletions
diff --git a/examples/network/ftp/ftp.pro b/examples/network/ftp/ftp.pro
index c70b812..6b0f2ca 100644
--- a/examples/network/ftp/ftp.pro
+++ b/examples/network/ftp/ftp.pro
@@ -17,5 +17,5 @@ symbian {
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
TARGET.CAPABILITY="NetworkServices"
TARGET.UID3 = 0xA000A648
- LIBS+=-lesock -lconnmon # For IAP selection
+ LIBS+=-lesock # For IAP selection
} \ No newline at end of file
diff --git a/examples/network/ftp/sym_iap_util.h b/examples/network/ftp/sym_iap_util.h
index 14df5af..928b46e 100644
--- a/examples/network/ftp/sym_iap_util.h
+++ b/examples/network/ftp/sym_iap_util.h
@@ -42,9 +42,9 @@
#define QSYM_IAP_UTIL_H
#include <es_sock.h>
+#include <es_enum.h>
#include <sys/socket.h>
#include <net/if.h>
-#include <rconnmon.h>
QString qt_TDesC2QStringL(const TDesC& aDescriptor)
{
@@ -59,7 +59,6 @@ static void qt_SetDefaultIapL()
{
TUint count;
TRequestStatus status;
- TUint ids[15];
RSocketServ serv;
CleanupClosePushL(serv);
@@ -67,57 +66,47 @@ static void qt_SetDefaultIapL()
RConnection conn;
CleanupClosePushL(conn);
- RConnectionMonitor monitor;
- CleanupClosePushL(monitor);
+ User::LeaveIfError(serv.Connect());
+ User::LeaveIfError(conn.Open(serv));
- monitor.ConnectL();
- monitor.GetConnectionCount(count, status);
- User::WaitForRequest(status);
- if(status.Int() != KErrNone) {
- User::Leave(status.Int());
- }
+ TConnectionInfoBuf connInfo;
- TUint numSubConnections;
+ _LIT(KIapNameSetting, "IAP\\Name");
+ TBuf8<256> iap8Name;
- if(count > 0) {
- for (TInt i = 1; i <= count; i++) {
- User::LeaveIfError(monitor.GetConnectionInfo(i, ids[i-1], numSubConnections));
- }
- /*
- * get IAP value for first active connection
- */
- TBuf< 50 > iapName;
- monitor.GetStringAttribute(ids[0], 0, KIAPName, iapName, status);
- User::WaitForRequest(status);
- if (status.Int() != KErrNone) {
- User::Leave(status.Int());
+ if (conn.EnumerateConnections(count) == KErrNone) {
+ if(count > 0) {
+ for (TUint i = 1; i <= count; i++) {
+ // Note: GetConnectionInfo expects 1-based index.
+ if (conn.GetConnectionInfo(i, connInfo) == KErrNone) {
+ if (conn.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) {
+ conn.GetDesSetting(TPtrC(KIapNameSetting), iap8Name);
+ break;
+ }
+ }
+ }
} else {
- QString strIapName = qt_TDesC2QStringL(iapName);
- struct ifreq ifReq;
- strcpy(ifReq.ifr_name, strIapName.toLatin1().data());
- User::LeaveIfError(setdefaultif(&ifReq));
+ /*
+ * no active connections yet
+ * use IAP dialog to select one
+ */
+ User::LeaveIfError(conn.Start());
+ User::LeaveIfError(conn.GetDesSetting(TPtrC(KIapNameSetting), iap8Name));
}
- } else {
- /*
- * no active connections yet
- * use IAP dialog to select one
- */
- User::LeaveIfError(serv.Connect());
- User::LeaveIfError(conn.Open(serv));
- User::LeaveIfError(conn.Start());
-
- _LIT(KIapNameSetting, "IAP\\Name");
- TBuf8<50> iap8Name;
- User::LeaveIfError(conn.GetDesSetting(TPtrC(KIapNameSetting), iap8Name));
+
iap8Name.ZeroTerminate();
conn.Stop();
struct ifreq ifReq;
strcpy(ifReq.ifr_name, (char*)iap8Name.Ptr());
+
User::LeaveIfError(setdefaultif(&ifReq));
+
+ conn.Close();
+ serv.Close();
}
- CleanupStack::PopAndDestroy(&monitor);
+
CleanupStack::PopAndDestroy(&conn);
CleanupStack::PopAndDestroy(&serv);
}