×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    36

    Exclamation Select Access point for QNetwork S60

    I am creating a twitter-like client using Qt S60 .
    I used QHttp to access to twitter.com. But everytime I request to twitter , I have to select access point (GPRS, Wifi ...) so it make my application not friendly.
    Can you help me reduce times choosing access point (User can choose access point when app start not everytime app connect to internet)

    Thanks in advance

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Posts
    468

    Re: Select Access point for QNetwork S60

    Hi,
    Qt connectivity relies on Open C sockets. For controlling the Open C sockets there's a setdefaultIf function coming in the next Open C release (1.5) that will be bundled with the following Qt for S60 release.

    You can use that functionality directly OR use Bearer Management API from Qt Mobility project.

    Both solutions are expected to be available during next week. Stay tuned for
    http://www.qtsoftware.com/developer/...iew-qt-for-s60
    and
    http://labs.trolltech.com/page/Projects/QtMobility

    Cheers,
    Jack

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    36

    Wink Re: Select Access point for QNetwork S60

    Thank you very much. I will try it.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    40

    Re: Select Access point for QNetwork S60

    Hi TrungThanhMtad,

    I'm trying to access an internet server from my app using a QHttp as well, but it doesn't ask for access point at all and gets stuck. Did you make any additional step to get this "choose Access point" option?

    Thanks in advance

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    36

    Re: Select Access point for QNetwork S60

    you should add these lines to you .pro file :
    symbian {
    TARGET.CAPABILITY = NetworkServices
    }

    It intends to set capability to your apps.

  6. #6
    Registered User
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    40

    Re: Select Access point for QNetwork S60

    Yes!! thanks a lot TrungThanhMtad!! It's working now

    Cheers!

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    2

    Question Re: Select Access point for QNetwork S60

    Does anyone know how to use setdefaultif API? what should I put in include?
    is there a solution in Qt yet?

  8. #8
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

  9. #9
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: Select Access point for QNetwork S60

    I'm trying to do the same: my app makes repeated HTTP requests, but I only want the user to have to confirm an access point on startup.

    My code looks like this:

    Code:
    #include <stdio.h>
    #include <string.h>
    #include <net/if.h>
    
    .
    .
    .
    
    struct ifreq ifReq;
    strcpy(ifReq.ifr_name, "myaccesspoint"); 
    int err = setdefaultif(&ifReq);	
    if (err == -1) 
        debug("setdefaultif err, errno: " + QString(errno));
    ...but I'm getting these errors:

    Code:
    Creation Time	Description	Resource	Path	Location	Type
    1251976483532	error: field `ifru_hwaddr' has incomplete type[/S60/devices/S60_3rd_FP2_SDK_v1.1_2/epoc32/include/stdapis/net/if.h]	myApp		line 281	C/C++ Problem
    1251976483563	error: field `ifra_addr' has incomplete type[/S60/devices/S60_3rd_FP2_SDK_v1.1_2/epoc32/include/stdapis/net/if.h]	myApp		line 317	C/C++ Problem
    1251976483579	error: field `ifra_broadaddr' has incomplete type[/S60/devices/S60_3rd_FP2_SDK_v1.1_2/epoc32/include/stdapis/net/if.h]	myApp		line 318	C/C++ Problem
    1251976483595	error: field `ifra_mask' has incomplete type[/S60/devices/S60_3rd_FP2_SDK_v1.1_2/epoc32/include/stdapis/net/if.h]	myApp		line 319	C/C++ Problem
    1251976483626	error: field `addr' has incomplete type[/S60/devices/S60_3rd_FP2_SDK_v1.1_2/epoc32/include/stdapis/net/if.h]	myApp		line 377	C/C++ Problem
    1251976483642	error: field `dstaddr' has incomplete type[/S60/devices/S60_3rd_FP2_SDK_v1.1_2/epoc32/include/stdapis/net/if.h]	myApp		line 378	C/C++ Problem
    Some questions:

    1. What should I be including to avoid these errors? I've looked at the documentation, but this only refers to if.h, which I've included.

    2. Is my code roughly the 'right' way to set a default access point?

    3. Is there (since the previous post) a Qt way to do it?

    Thanks

    Sam Dutton

  10. #10
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: Select Access point for QNetwork S60

    FWIW...

    Discovered the Mobile Extensions access point manager, but having trouble compiling the example. Created a new thread for this.

  11. #11
    Registered User
    Join Date
    Oct 2007
    Posts
    12

    Re: Select Access point for QNetwork S60

    Quote Originally Posted by samdutton View Post
    I'm trying to do the same: my app makes repeated HTTP requests, but I only want the user to have to confirm an access point on startup.

    .....
    Thanks

    Sam Dutton
    Hey, Sam not sure if this helps at all but ...
    Code:
    #ifdef Q_OS_SYMBIAN
    #include "sym_iap_util.h"
    #endif
    .... and in the code once...
    
    #ifdef Q_OS_SYMBIAN
    	qt_SetDefaultIap();
    #endif
    and in the HEADERS the sym_iap_util.h to your .pro, this is my .pro currently
    Code:
    symbian: { 
        HEADERS += sym_iap_util.h
        TARGET.CAPABILITY += "LocalServices NetworkServices ReadUserData UserEnvironment WriteUserData"
        LIBS += -lesock \
        	-lconnmon
    }

    This worked for me, now user gets asked once in beginning to choose network and not again.

  12. #12
    Nokia Developer Moderator
    Join Date
    May 2007
    Posts
    468

    Re: Select Access point for QNetwork S60

    Hi,
    instead of using the low level open c functions directly I'd use the bearer management API from http://wiki.forum.nokia.com/index.php/Mobile_Extensions

    The examples and documentation show how to use it, it's couple of lines.

    Jack

  13. #13
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: Select Access point for QNetwork S60

    beakesland -- thanks. I've got qt_SetDefaultIap() running, but with this on a phone the app doesn't ask for an IAP choice at all (and HTTP requests don't work). Runs fine in the emulator (with confirmation of connection).

    Jack Torrance -- likewise. I've downloaded the Bearer Management files, though slightly mystified as to how to use the API...

  14. #14
    Nokia Developer Moderator
    Join Date
    May 2007
    Posts
    468

    Re: Select Access point for QNetwork S60

    Howdy,
    the access point manager (sorry I said bearer management can be used as f.ex follows (taken from flickr demo that is in the extensions package:

    if (m_accessPointManager.isSetDefaultAccessPointSupported())
    {
    XQAccessPoint ap = m_accessPointManager.preferredAccessPoint();
    if (!ap.isNull())
    {
    if (m_accessPointManager.setDefaultAccessPoint(ap))
    {
    satellitesLabel->setText(tr("Access Point: %1").arg(ap.name()));
    }
    }
    else
    {
    QMessageBox::information(this, tr("Flickr Demo"),
    tr("Available Access Points not found."));

    return;
    }
    }

    Documentation says:

    "Classes

    An access point is represented by the XQAccessPoint class. This class doesn't provide access to all the details of an access point (e.g. usernames and passwords), but it does provide information such as the name of the access point and the technology type (i.e. the bearer) being used to transmit and receive the data (for example WLAN or 3G/GPRS).
    XQAccessPointManager gives you access to the access points that are configured on the device.
    Usage

    The basic way to use the Access Point Manager API is to retrieve a list of access points, get the user to select which access point to use, and then set the selection as the default access point.
    Alternatively, you can use the preferredAccessPoint() convenience method that chooses an access point according to a set of rules. If the device is already connected to the internet through an access point, then that access point is returned. Then it checks if there are any available WLANs and, if there are none available, it tries for an available phone network (e.g. 3G) connection. See the method documentation for more details about the rules.
    You can also check yourself for available access points with the availableAccessPoints() . This returns a list of access points can actually be used at the moment, i.e. the device is in the coverage area for that access point.
    Once you have an access point, you need to set it as the default access point using the setDefaultAccessPoint() method. Then you can start using the classes from the QtNetwork module and the internet connection will be made through the access point that you set as the default."

    Cheers,
    Jack

  15. #15
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    84

    Re: Select Access point for QNetwork S60

    Just going back to beakesland's suggestion...

    With qt_SetDefaultIap() called in main.cpp, my app runs fine in the emulator -- with Select Connection confirmation (offering Winsock).

    However, on a device, in qt_SetDefaultIapL(), stIapName evaluates to "IPDC" and count is 1.

    The net result is that nothing happens, i.e. there is no request for choice of connections.

    Is there a dependency I'm missing, or something else?

    Sam Dutton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •