Results 1 to 8 of 8

Thread: Setup Internet connection on Windows Mobile device.

  1. #1
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    6
    Thanks
    3

    Default Setup Internet connection on Windows Mobile device.

    Hi!

    I’m trying to setup Internet connection on Windows Mobile device. But have no success.

    I’m trying this code:

    Qt Code:
    1. // Set Internet Access Point
    2. QNetworkConfigurationManager manager;
    3. const bool canStartIAP = (manager.capabilities()
    4. & QNetworkConfigurationManager::CanStartAndStopInterfaces);
    5. // Is there default access point, use it
    6. QNetworkConfiguration cfg = manager.defaultConfiguration();
    7. if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
    8. QMessageBox::information(this, tr("Network"), tr(
    9. "No Access Point found."));
    10. return;
    11. }
    12.  
    13. session = new QNetworkSession(cfg, this);
    14. session->open();
    15. session->waitForOpened(-1);
    To copy to clipboard, switch view to plain text mode 

    code from http://doc.qt.nokia.com/4.7-snapshot...anagement.html

    I don’t have CanStartAndStopInterfaces capabilities, default config is empty. I also tryed to get list of congigurations but it’s also empty….

    What is the problem? Hope it’s a known issue.

    TIA!

    Sergey

  2. #2
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Setup Internet connection on Windows Mobile device.

    Copy QTDIR/plugins/bearer qgenericbearer.dll to your_app_dir/bearer on your device . QNetworkConfigurationManager doesnt work without this plugin

  3. The following user says thank you to grublik for this useful post:

    sergey_m (6th January 2011)

  4. #3
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    6
    Thanks
    3

    Default Re: Setup Internet connection on Windows Mobile device.

    Thanks for that.

    capabilities now - 0x00000010 (ForcedRoaming)

    Now I can get list of Defined configurations but they all have Unknown type, still can't start it.

  5. #4
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    6
    Thanks
    3

    Default Re: Setup Internet connection on Windows Mobile device.

    Still can't start connection. I added qgenericbearerd4.dll into my application folder\bearer and now can see configurations.

    I have capabilities - 0x10, so seems that I can't start connection.

    Also I have list with 3 configurations:

    TNETW12511 - I guess wifi
    Automatic Tunneling Pseudo-Interface
    6to4 Pseudo-Interface

    when I'm trying to start I have error "The specified configuration cannot be used"

    When I switched on edge I've got one more connection - Cellular Line

    Anybody tryed to start internet connection from WinMobile with qt 4.7 application?

  6. #5
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Setup Internet connection on Windows Mobile device.

    i've tried to start such connection. But i found it difficult to do this. Maybe qt on win ce could not deal with this. I managed to do this using visual c++ , but qt failed

  7. The following user says thank you to grublik for this useful post:

    sergey_m (6th January 2011)

  8. #6
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    6
    Thanks
    3

    Default Re: Setup Internet connection on Windows Mobile device.

    Quote Originally Posted by grublik View Post
    i've tried to start such connection. But i found it difficult to do this. Maybe qt on win ce could not deal with this. I managed to do this using visual c++ , but qt failed
    Thanks.

    You did it in some other way? I guess it's possible to do it with windows functions... but I was hoping on cross platform solution.

  9. #7
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Setup Internet connection on Windows Mobile device.

    I've managed to do it with windows functions. At first you must prepare a cellular line connection in conections menu.
    Next you should do something like this :

    Qt Code:
    1. #include <aygshell.h>
    2. #include <initguid.h>
    3. #include <connmgr.h>
    4.  
    5. bool connectHSDPANetwork()
    6. {
    7. CONNMGR_CONNECTIONINFO cci = {0};
    8. cci.cbSize = sizeof(CONNMGR_CONNECTIONINFO);
    9. cci.dwParams = CONNMGR_PARAM_GUIDDESTNET;
    10. cci.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
    11. cci.guidDestNet = IID_DestNetCorp;
    12.  
    13. DWORD dwResult;
    14.  
    15. HRESULT hr = ConnMgrEstablishConnectionSync( &cci, &cHandle, 0, &dwResult ) ;
    16. if (hr == S_OK)
    17. return true;
    18. else
    19. return false;
    20. }
    To copy to clipboard, switch view to plain text mode 

  10. The following user says thank you to grublik for this useful post:

    sergey_m (7th January 2011)

  11. #8
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    6
    Thanks
    3

    Default Re: Setup Internet connection on Windows Mobile device.

    Thanks for your answer.

    I also implemented it with connection manager. hust tested it.

    Now will remove all unnecessary code.

    Qt Code:
    1. GUID guid;
    2. LPCTSTR url = L"http://www.msn.com";
    3. HRESULT hresult = ConnMgrMapURL((LPCTSTR)url,&guid,NULL);
    4. if (!SUCCEEDED(hresult))
    5. {
    6. delete [] url;
    7. return NULL;
    8. }
    9.  
    10. // Get a connection.
    11. CONNMGR_CONNECTIONINFO cinfo;
    12. memset(&cinfo,0,sizeof(cinfo));
    13. cinfo.cbSize = sizeof(cinfo);
    14. cinfo.bDisabled = FALSE;
    15. cinfo.bExclusive = FALSE;
    16. cinfo.guidDestNet = guid;
    17. cinfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
    18. cinfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
    19. cinfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
    20. DWORD status;
    21. hresult = ConnMgrEstablishConnectionSync(&cinfo,&iConnectionHandle,15000,&status);
    22.  
    23. timer->start(5000);
    24.  
    25. if (!SUCCEEDED(iConnectionHandle))
    26. {
    27. QMessageBox::information(0, tr("N"), tr("Connection opened"));
    28. emit connectionFound();
    29. bIsConnectionEnabled = true;
    30. return true;
    31. }
    32. QMessageBox::information(0, tr("N"), tr("Connection closed"));
    33. emit connectionLost();
    34. return false;
    To copy to clipboard, switch view to plain text mode 
    Last edited by sergey_m; 7th January 2011 at 08:35.

Similar Threads

  1. Detection usb device connection/disconnection
    By binaural in forum Qt Programming
    Replies: 9
    Last Post: 18th September 2012, 10:59
  2. setup QTcreator and carbide C++ for S60 5th on windows 7
    By nhs_0702 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 29th May 2011, 18:55
  3. How to detect an internet connection ?
    By ouekah in forum Newbie
    Replies: 1
    Last Post: 29th March 2010, 22:08
  4. Windows SDK setup fails (required for phonon)
    By pospiech in forum Installation and Deployment
    Replies: 14
    Last Post: 28th January 2010, 13:37
  5. Getting windows internet proxy settings
    By jdd81 in forum Qt Programming
    Replies: 2
    Last Post: 10th June 2009, 22:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.