Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User gracy's Avatar
    Join Date
    Nov 2010
    Posts
    43
    I downloaded a sample bluetooth s/w and try to study that.

    As far as I understand, when we have found the bluetooth enabled devices, we search the devices with the service we want.
    For that we use UUID.

    In that sample s/w, in the deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) method , it writes like that

    Code:
     public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
    UUID uuidSet[] = new UUID[1];     
          uuidSet[0] =  RFCOMM_UUID;      
          int searchID = m_DscrAgent.searchServices(null,uuidSet,btDevice,this);      //////////When we will use the id that return from the searchServices() ////method?
    so by giving the second parameter of searchServices() method, we have specified the sevice we need.

    But in the servicesDiscovered(int transID, ServiceRecord[] records) method, he test again like that

    Code:
    public void servicesDiscovered(int transID, ServiceRecord[] records)
      {
        
        for (int i = 0; i < records.length; i++)
        {
            m_strUrl = records[i].getConnectionURL(ServiceRecord.AUTHENTICATE_ENCRYPT, false); 
             
            System.out.println(m_strUrl);
            if(m_strUrl.startsWith("btspp")) //we have found our service protocol 
            {
                m_bServerFound = true;
                m_bInitClient=true;
               break;
            }
           
        } 
        
      }
    Why we need to test whether the url starts with btspp?
    Is it necessary?
    We have specified the servies we need in the bluetooth devices we found by setting the second parameter of searchServices() method?
    is it not enough?

    What is the service record????

  2. #2
    Super Contributor grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    Quote Originally Posted by gracy View Post
    What is the service record????
    Each service record contains information about one of the services that have been found during the service discovery process.

    Quote Originally Posted by gracy View Post
    Why we need to test whether the url starts with btspp?
    It's a safe practice, and avoids any confusing results if service discovery returns something you don't expect.

    Graham.

  3. #3
    Nokia Developer Champion traud's Avatar
    Join Date
    Mar 2003
    Posts
    3,863
    Instead of using code examples, I do not understand, I would go for a book.
    Quote Originally Posted by gracy View Post
    uuidSet[0] = RFCOMM_UUID;
    A RFCOMM_UUID variable (I fear, it‘s value is 0x0003) is generic and could lead to an OBEX based service.
    Quote Originally Posted by gracy View Post
    When we will use the id that return from the searchServices() method?
    Theoretically, you could have several service searches in parallel.

Similar Threads

  1. Static Variable- Shoud be used or not?
    By kalshukla in forum Symbian C++
    Replies: 2
    Last Post: 2010-04-23, 14:56
  2. Replies: 7
    Last Post: 2009-01-13, 06:54
  3. What is contained in the data packet of a WAP redirect method result
    By xiddesign in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2004-10-03, 15:23
  4. What can be saved to the phone out of the MMS content
    By Micfaber in forum General Messaging
    Replies: 1
    Last Post: 2002-08-12, 04:42
  5. Replies: 1
    Last Post: 2002-05-13, 21:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved