×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    15

    Bluetooth pairing problem

    Dear All,

    I want to pairing a Bluetooth device by using following code. But I failed the pairing device. Anybody can help me, I have took this piece of code from QBluetooth project.

    <code>

    TBool QBtLocalDevicePrivate::AddNewDevice(const QBtDevice& device)
    {
    try
    {
    CBTDevice* newDev;

    RBTRegServ regServ;

    RBTRegistry view;

    TRequestStatus stat;

    QT_TRAP_THROWING
    (
    newDev = CBTDevice::NewL(device.getAddress().convertToSymbianBtDevAddr()));

    newDev->SetDeviceClass(TBTDeviceClass(device.getType()));

    TBuf8<4> psd(_L8("0000"));

    TPINCodeV10 pinCode10;

    pinCode10.iLength = 4;

    memcpy(pinCode10.iPIN,psd.Ptr(),4);

    TBTPinCode pinCode(pinCode10);

    TPtrC8 name8((const TUint8 *)device.getName().toUtf8().data(),device.getName().toUtf8().size());

    TPtrC16 name16(device.getName().utf16());

    QT_TRAP_THROWING(
    {
    newDev->SetDeviceNameL(name8);

    newDev->SetFriendlyNameL(name16);

    newDev->SetPaired(ETrue);

    newDev->SetPassKey(pinCode);

    regServ.Connect();

    view.Open(regServ);

    view.AddDeviceL(*newDev,stat);
    });

    User::WaitForRequest(stat);

    stat.Int();

    view.Close();

    regServ.Close();

    SafeDelete(newDev);
    }
    catch(char* str)
    {
    return false;
    }

    return true;
    }

    </code>
    Last edited by naimidrees; 2011-10-31 at 06:49.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Bluetooth pairing problem

    what are devices you using ?

    Tell your problem in detail ?

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Bluetooth pairing problem

    Hi,
    For both RFCOMM and L2CAP we need to set the security flags. When you start your server that need to set by this method call.

    QRfcommServer::setSecurityFlags(QBluetooth::SecurityFlags security) // check for L2CAP side also
    See some doc from http://doc.qt.nokia.com/qtmobility-1...#Security-enum
    There could be some example in Qt mobility Bluetooth example (I am not sure though, check it yourself)

  4. #4
    Registered User
    Join Date
    Mar 2008
    Posts
    15

    Re: Bluetooth pairing problem

    I am using a Bluetooth device with serial communication client. Ihave communicated with the device successfully. But I do the pair device manually. But I will have to pairing the Bluetooth device by the code. I have tried the code given blow is not not working. Kindly help me.

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Bluetooth pairing problem

    Hi,
    Could you post related part of your code here?

  6. #6
    Registered User
    Join Date
    May 2009
    Location
    Greece
    Posts
    191

    Re: Bluetooth pairing problem

    @mahbub_s60,

    the pairing is an operation completely different and unrelated with the RFCOMM and L2CAP operations.
    Are you sure we need to take kare of the security flags in order to achieve the pairing?

    @naimidrees Thank you for your post, i have never seen those functions regarding the pairing, that is why the pairing functions are missing from the library that you used. If you keep having troubles with it, try the Qt Mobility 1.2 where is the official Bluetooth API.

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Bluetooth pairing problem

    favoritas37, you are absolutely right. Original post was about pairing device nothing to do with L2CAP or RFCOMM and I jumped to service level, sorry I mislead !

  8. #8
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Bluetooth pairing problem

    Ok with Symbian this is not supported. Qt Mobility on Symbian does not support it either for 3rd party. I shall try to check (in future and publish it as wiki articles if possible) if we could do something for 3rd party developers.
    Last edited by mahbub_s60; 2011-11-15 at 08:46.

Similar Threads

  1. Bluetooth pairing
    By Alex_Polt in forum Near Field Communication
    Replies: 1
    Last Post: 2008-02-13, 13:46
  2. PC Suite Bluetooth Pairing Problem
    By fds_5 in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-05-18, 15:03
  3. Problem with bluetooth pairing
    By poda53 in forum Bluetooth Technology
    Replies: 3
    Last Post: 2004-12-08, 18:21
  4. Bluetooth pairing ...
    By chris3388 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-02-08, 15:24

Posting Permissions

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