×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Karachi, Pakistan
    Posts
    98

    Data transfer via WLAN while Bluetooth device scanning

    Hi,

    I am facing problem with WLAN connection while scanning for Bluetooth devices. The data transfer of WLAN paused when the application starts scanning for bluetooth devices. We need to scan bluetooth devices form time to time. Therefore in this scenario the WLAN data transfer is paused remaining the connection remains Active, but with no data transfer. After a time when the scanning completes the data transfer again started. According to our scenario, we need to scan bluetooth devices from time to time, and therefore this is causing the problem.

    Any suggestions and ideas why this is happening and how it can be fixed.

    Thanks,

    Jawad.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Data transfer via WLAN while Bluetooth device scanning

    Do you have any User::WaitForRequest calls in your code (especially in the BT-discovery part)? If yes, they are the most probable cause.

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Karachi, Pakistan
    Posts
    98

    Re: Data transfer via WLAN while Bluetooth device scanning

    No, I checked the code and there is no call to User::WaitForRequest. Here is the code for device discovery. The problem is only with the discovery process because once we have successful connection with the pair device the data transfer has no issues.

    class MBtDiscovery
    {
    public :
    virtual void DeviceServiceDiscoveryCompleted() = 0;
    virtual void DevicesDiscoveryCompleted() = 0;
    virtual void DeviceDiscovered(TDeviceData& aDeviceFound) = 0;
    virtual void ErrorServiceDiscovery(TInt aError) = 0;
    };

    //CLogFile is for logging
    //aDeviceName is for BT device name we need to scan for connection
    void CBlueDiscoverer:iscoverL(const THostName *aDeviceName, MBtDiscovery* aDiscoveryCallback, CLogFile* aLogger)
    {
    if (IsActive())
    return;

    iDeviceName.Zero();
    iDiscoveryCallback = aDiscoveryCallback;
    iLogger = aLogger;

    if (aDeviceName != NULL)
    iDeviceName.Copy(*aDeviceName);

    //RArray to contain all searched devices
    iDevicesList.Reset();

    //find protocol
    TProtocolDesc pd;
    TProtocolName pname;
    pname.Copy(_L("BTLinkManager"));
    User::LeaveIfError(iSockServ.FindProtocol(pname, pd));

    //open to resolve host
    TInt err = iHResolver.Open(iSockServ, pd.iAddrFamily, pd.iProtocol);

    if (err != KErrNone)
    {
    if (iLogger)
    iLogger->Log(_L("Error occured. Error : ") , err);
    }

    iAddr.SetIAC(KGIAC); //KLIAC is not configured on connectblue
    iAddr.SetAction(KHostResInquiry|KHostResName|KHostResIgnoreCache);

    iStatus = KRequestPending;
    //RHostResolver
    iHResolver.GetByAddress(iAddr, iEntry, iStatus);

    SetActive();

    }


    void CBlueDiscoverer::RunL()
    {
    AsyncRequestProcessor(iStatus);
    }


    void CBlueDiscoverer::AsyncRequestProcessor(TRequestStatus aStatus)
    {
    if (iStatus == KErrNone )
    {

    if (iLogger)
    iLogger->Log(_L("Bluetooth device found."));

    //cast the socket address to Blue Tooth address
    TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr );

    TDeviceData devData;
    devData.iDeviceName = iEntry().iName;
    devData.iDeviceAddr = sa.BTAddr();
    devData.iDeviceServicePort[0] = sa.Port();
    iDevicesList.Insert(devData, 0);

    if (iDiscoveryCallback)
    {
    iDiscoveryCallback->DeviceDiscovered(devData);
    }

    if(iDeviceName.Length() > 0)
    {
    if (iDeviceName.Find(iEntry().iName) != KErrNotFound)
    {
    if (iDiscoveryCallback)
    iDiscoveryCallback->DevicesDiscoveryCompleted();
    }
    else //not found, we need to query next device
    {
    if (iLogger)
    iLogger->Log(_L("Query next available device ..."));

    //RHostResolver
    iHResolver.Next(iEntry, iStatus);
    SetActive();
    }
    }
    else
    {

    if (iLogger)
    iLogger->Log(_L("Query next available device ..."));

    //RHostResolver
    iHResolver.Next(iEntry, iStatus);
    SetActive();

    }


    }
    else if (iStatus == KErrHostResNoMoreResults)
    {
    if (iDiscoveryCallback)
    iDiscoveryCallback->DevicesDiscoveryCompleted();
    }
    }

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Data transfer via WLAN while Bluetooth device scanning

    Yes, it seems to be harmless.
    For testing if it is some kind of platform/hardware restriction, you can try using completely independent applications (like downloading something in the browser and doing BT discovery).

  5. #5
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: Data transfer via WLAN while Bluetooth device scanning

    Speculating a little bit: It may be a deliberate feature.

    Both WLAN and Bluetooth operate on the same 2.4GHz ISM band. The protocols are designed to coexist nicely and handle collisions etc. gracefully. Bluetooth device discovery works basically by going through the frequency range, sending "anyone here?" inquiry packets and listening for replies from discoverable devices. To make the discovery process more reliable it makes sense to silence some unrelated activity on the frequency band. It could also be a resource issue that the specs simply don't allow Bluetooth inquiry to coexist with WLAN in the same device. (Cannot remember the exact time-slotting schemes for Bluetooth inquiry and I'm too lazy to check.)

    Lauri

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Data transfer via WLAN while Bluetooth device scanning

    Yes, that is all true, however it may still worth a try, especially since Jawadakhtar already has an application doing WLAN transfer (tracking that one may be easier than checking with the browser), so basically the test could be a simple switch to the BT application and initiating a search (for pairing for example).

Similar Threads

  1. Java Bluetooth Data transfer problems
    By cosminr in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2009-05-20, 15:08
  2. How to transfer data (not multimedia) via bluetooth?
    By machobowa17 in forum Mobile Java General
    Replies: 0
    Last Post: 2007-02-26, 15:23
  3. PC Suite ConnAPI data transfer rate
    By raymondxie in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-01-08, 23:06
  4. Is there any example for connecting to a bluetooth gps device and get data?
    By kingofrp in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-12-14, 03:02

Posting Permissions

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