×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Zanjan
    Posts
    183

    problem with bluetooth (what is TUUID)

    hi all
    We work on bluetooth codes
    we define a server in this face:
    RSocketServ socketServ;
    TUUID aUUID;
    socketServ.Connect();
    _LIT(RFCOMM, "RFCOMM");
    //Open a socket
    /RSocket listen;
    listen.Open(socketServ,RFCOMM);
    //Create the Bluetooth socket address
    TInt channel;
    TBTSockAddr addr;
    User::LeaveIfError(listen.GetOpt(KRFCOMMGetAvailableServerChannel,KSolBtRFCOMM,channel));
    addr.SetPort(channel);
    User::LeaveIfError(listen.Bind(addr));
    //Register with the Bluetooth security manager Add the connection //to the Bluetooth security manager
    TBTServiceSecurity serviceSecurity;
    serviceSecurity.SetUid(KUiddfshApp);
    serviceSecurity.SetAuthentication(EFalse);
    serviceSecurity.SetEncryption(EFalse);
    serviceSecurity.SetAuthorisation(EFalse);
    serviceSecurity.SetDenied(EFalse);
    RSdpDatabase sdprec;
    TSdpServRecordHandle recordHandle = 0;
    sdprec.CreateServiceRecordL(aUUID, recordHandle);
    User::LeaveIfError(listen.Listen(2));
    //Start listening for data over a connection
    RSocket accept;
    TRequestStatus status;
    User::LeaveIfError(accept.Open(socketServ));
    listen.Accept(accept,status);
    User::WaitForRequest(status);
    //Shutdown remote Bluetooth connection
    accept.Close();
    listen.Close();
    //secset.UnregisterService(KSolBtL2CAP, status);
    socketServ.Close();
    when this codes run it face on an error in line that it be has red & bold.

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

    Re: problem with bluetooth (what is TUUID)

    Some value for that UUID might be handy. Read the related documents/specifications. You can search for bluetooth uuid in Google for example.

  3. #3
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Zanjan
    Posts
    183

    Re: problem with bluetooth (what is TUUID)

    thanks wizard but we don't know how we can set handy uuid.
    we do any way it, dont work & face on error.

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

    Re: problem with bluetooth (what is TUUID)

    TUUID has constructors for accepting up to 4 32-bit values. What have you tried so far? Google lists an UUID generator amongst the very first hits for example.
    Am I right if I remember that you actually want to communicate with a PC? In that case you can also try borrowing UUID from the PC-based examples.

  5. #5
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Zanjan
    Posts
    183

    Re: problem with bluetooth (what is TUUID)

    wizard we modifed our codes in this face
    TInt channel;

    TBuf8<1> channels;

    RSocketServ socketServ;

    socketServ.Connect();

    _LIT(RFCOMM, "RFCOMM");

    RSocket listen;

    listen.Open(socketServ,RFCOMM);

    //Create the Bluetooth socket address

    TBTSockAddr addr;
    User::LeaveIfError(listen.GetOpt(KRFCOMMGetAvailableServerChannel,KSolBtRFCOMM,channel));
    addr.SetPort(channel);

    channels.Append( ( TChar )channel);
    CSdpAttrValueDES* aProtocolDescriptor = CSdpAttrValueDES::NewDESL(NULL);
    aProtocolDescriptor
    ->StartListL()
    ->BuildDESL()
    ->StartListL() // Details of lowest level protocol
    ->BuildUUIDL( KL2CAP )
    ->EndListL()

    ->BuildDESL()
    ->StartListL()
    ->BuildUUIDL( KRFCOMM )
    ->BuildUintL( channels )
    ->EndListL()
    ->EndListL();

    User::LeaveIfError(listen.Bind(addr));

    TBTServiceSecurity serviceSecurity;

    serviceSecurity.SetUid(KUiddfshApp);
    serviceSecurity.SetAuthentication(EFalse);
    serviceSecurity.SetEncryption(EFalse);
    serviceSecurity.SetAuthorisation(EFalse);
    serviceSecurity.SetDenied(EFalse);

    RSdpDatabase sdprec;
    TSdpServRecordHandle recordHandle = 0;

    sdprec.CreateServiceRecordL(*aProtocolDescriptor, recordHandle);

    User::LeaveIfError(listen.Listen(2));

    //Start listening for data over a connection

    RSocket accept;
    TRequestStatus status;
    User::LeaveIfError(accept.Open(socketServ));
    listen.Accept(accept,status);
    User::WaitForRequest(status);

    //Shutdown remote Bluetooth connection

    accept.Close();
    listen.Close();
    socketServ.Close();
    but it still not work.
    Too about our goal from this code:
    We try to create a server on mobile device that it is server
    & listen to message clients.

  6. #6
    Regular Contributor
    Join Date
    Mar 2004
    Posts
    130

    Re: problem with bluetooth (what is TUUID)

    If you wanna create bluetooth serial port server, use UUID = 0x1101 like this.

    TUUID serviceUUID(0x1101);
    Actually there are 2 parts you have to do with:
    1. Add Service Record to SDP Database
    2. Listen for Incoming connection (using RSocketServ)

    Please leave message if you get stuck at any point.

    -Sittiphol

  7. #7
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Zanjan
    Posts
    183

    Re: problem with bluetooth (what is TUUID)

    hi neois
    Quote Originally Posted by neois View Post
    If you wanna create bluetooth serial port server, use UUID = 0x1101 like this.



    Actually there are 2 parts you have to do with:
    1. Add Service Record to SDP Database
    2. Listen for Incoming connection (using RSocketServ)

    Please leave message if you get stuck at any point.

    -Sittiphol
    we modified part of our code that create service record in this face:
    TUUID serviceUUID(KSerialPortUUID);

    RSdpDatabase sdprec;
    TSdpServRecordHandle recordHandle = 0;

    sdprec.CreateServiceRecordL(serviceUUID, recordHandle);
    but it have runtime error still.

  8. #8
    Regular Contributor
    Join Date
    Mar 2004
    Posts
    130

    Re: problem with bluetooth (what is TUUID)

    Hi Masoud,

    Please try the code snippet in this wiki page. I write it for you.

    http://wiki.forum.nokia.com/index.ph...ice_in_Symbian

    Cheers,
    Sittiphol

  9. #9
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Zanjan
    Posts
    183

    Re: problem with bluetooth (what is TUUID)

    thanks neois
    we will do it & advertise result it for you.

  10. #10
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Zanjan
    Posts
    183

    Re: problem with bluetooth (what is TUUID)

    Dear neois
    we used your codes.
    but now we dont know where use initilize section
    iSocketServ.Connect();
    TInt tChannel = 1;
    iListener = CListener::NewL(*this, iSocketServ);
    TRAPD(err, iListener->StartListenerL(tChannel));
    iServiceAdvertiser = CServiceAdvertiser::NewL();
    iServiceAdvertiser->StartAdvertiserL(tChannel);
    we use it in appview constructL (this : class Cdfshappview: public CAknView ) that face of error.
    thanks
    thanks

  11. #11
    Regular Contributor
    Join Date
    Mar 2004
    Posts
    130

    Re: problem with bluetooth (what is TUUID)

    Quote Originally Posted by masoud_bayat View Post
    Dear neois
    we used your codes.
    but now we dont know where use initilize section

    we use it in appview constructL (this : class Cdfshappview: public CAknView ) that face of error.
    thanks
    thanks
    What was the error you get? Make sure that you try it on real device and you add all needed capabilites (LocalServices and NetworkServices).

Similar Threads

  1. Bluetooth Service Discovery Problem
    By rwan067 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-03-18, 14:32
  2. Q: Problem with Nokia PC Suite and Bluetooth
    By Juha_74 in forum General Development Questions
    Replies: 0
    Last Post: 2007-03-13, 13:32
  3. Strange Problem with Bluetooth Connection
    By bigbadwolf in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-12-06, 09:51
  4. Bluetooth serviceDiscover problem Device Not Reachable
    By kashifqazi in forum Bluetooth Technology
    Replies: 1
    Last Post: 2006-10-13, 12:31
  5. Nokia SDK Bluetooth service re-discovery problem, Help Me!:(
    By tomsonxu in forum Bluetooth Technology
    Replies: 0
    Last Post: 2005-11-08, 07:51

Posting Permissions

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