×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    May 2009
    Posts
    201

    Connect Internet using WiFi or GPRS by high preference to WiFi

    Hi to all.
    I m developing one application where i need to connect GPRS or wifi.
    I m using HTTP example of SDK. where i m able to connect GPRS.

    What i want :
    If WiFi is present then my application should automatically detect that connection and start WiFi and if WiFi is not present then it should connect to the GPRS. and it should not prompt me to choose to select any access point.

    How can i do it. I m getting All access points through below code but i could not decide that which access point of wifi or which are of GPRS.

    // open the IAP communications database
    CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(commDB);

    TFileName iapName;
    TInt err;
    // Open the IAP table
    CCommsDbTableView* view = commDB->OpenTableLC(TPtrC(IAP));

    // Point to the first entry
    if (view->GotoFirstRecord() == KErrNone)
    {
    do
    {

    view->ReadTextL(TPtrC(COMMDB_NAME), iapName);
    view->ReadUintL(TPtrC(COMMDB_ID), iapID);

    // Store name and ID to where you want to
    } while (err = view->GotoNextRecord(), err == KErrNone);
    }

    CleanupStack::PopAndDestroy(); // view

    // pop and destroy the database object
    CleanupStack::PopAndDestroy(commDB);

    i have also visited one post to detect WIFI is ON or OFF.
    http://wiki.forum.nokia.com/index.php/WLAN_Info_API

    but i m not reaching at the Concrete solution.

    If any buddy can show me right path.
    Thanks

  2. #2
    Regular Contributor
    Join Date
    May 2009
    Posts
    201

    Re: Connect Internet using WiFi or GPRS by high preference to WiFi

    Hi to all,
    No one can give any idea of my above post.

    What i have got here
    Case 1 :
    i m getting connected WIFI access point name using below code :
    void CCheckWIFIAppUi::NetworkNameL()
    {
    TPckgBuf<TConnMonNetworkNames> networks;
    RConnectionMonitor monitor;
    monitor.ConnectL();
    CleanupClosePushL(monitor);
    TRequestStatus status;
    monitor.GetPckgAttribute(EBearerIdWLAN, 0, KNetworkNames , networks, status); // EBearerIdWLAN KNetworkNames
    User::WaitForRequest(status ) ;
    User::LeaveIfError(status.Int());
    TBuf<20> ibuff;
    TInt count = networks().iCount;
    ibuff.Zero();
    ibuff.AppendNum(count);
    CEikonEnv::InfoWinL(ibuff,_L("Total Network found"));

    for(TInt i=0;i<count;i++)
    {
    TBuf8<32> ssid;
    ssid.Copy( networks().iNetwork[i].iName );
    ibuff.Zero();
    ibuff.Copy(ssid);
    CEikonEnv::InfoWinL(_L("Network Name"),ibuff);
    TUint8 iSignal = networks().iNetwork[i].iSignalStrength;
    ibuff.Zero();
    ibuff.AppendNum(iSignal);
    CEikonEnv::InfoWinL(_L("Network Signal"),ibuff);

    }
    CleanupStack::PopAndDestroy();

    }
    Case 2 :
    I m getting Total Access Point using this code


    // open the IAP communications database
    CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(commDB);

    TFileName iapName;
    TInt err;
    // Open the IAP table
    CCommsDbTableView* view = commDB->OpenTableLC(TPtrC(IAP));

    // Point to the first entry
    if (view->GotoFirstRecord() == KErrNone)
    {
    do
    {

    view->ReadTextL(TPtrC(COMMDB_NAME), iapName);
    view->ReadUintL(TPtrC(COMMDB_ID), iapID);

    // Store name and ID to where you want to
    } while (err = view->GotoNextRecord(), err == KErrNone);
    }

    CleanupStack::PopAndDestroy(); // view

    // pop and destroy the database object
    CleanupStack::PopAndDestroy(commDB);

    So if i search connected WIFI Access point in Total List then i can find "iapID" and using this i m able to connect WIFI using HTTP Example.

    Now if WIFI is not connected then i need to connect with GPRS and in that case i m getting the Whole list.
    It is not possible to connect each and every Access point in the "for" loop.

    so how can i detect which access point for GPRS is set as default by the user. ......IS IT POSSIBLE.
    (NO SELECTION DIALOG NEEDED AT ANY POINT).

    The process i have described is the right process or something else in symbian to over come this problem.

    Please do some comment............
    Thanks
    Last edited by sid_diu; 2011-04-15 at 06:10.

  3. #3
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Connect Internet using WiFi or GPRS by high preference to WiFi

    just check the examples section, there is better example for this use case, here's the direct link: http://www.forum.nokia.com/info/sw.n..._0_en.zip.html

Similar Threads

  1. Wifi or GPRS
    By lubom in forum Symbian C++
    Replies: 2
    Last Post: 2010-12-14, 12:25
  2. How to show a *.jpg/*.png/*.bmp from ftp (or http) using 3G/WiFi?
    By ba2010 in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2010-12-01, 12:45
  3. Help connect to internet using gprs
    By picuser in forum Python
    Replies: 2
    Last Post: 2010-11-16, 04:53
  4. Getting location cordinates using cell id or wifi
    By Dipakbaviskar in forum Symbian C++
    Replies: 4
    Last Post: 2009-11-05, 13:34
  5. java MIDlet wont connect via 3G but will connect to internet via WiFi
    By jpedwards in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2009-09-04, 13:37

Posting Permissions

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