• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1771
  • Last Modified:

How to get type of Bluetooth Device (Such as Computer,PPC,Headset,Mobile)?

i'm developping Bluetooth App by EVC++ 4.0 and PPC 2003 on XDA II
i'm use microsoft BT Stack to Discover Bluetooth device. i can found other bluetooth device's name
but i don't know How to get type of Bluetooth Device (Such as Computer,PPC,Headset,Mobile)?
and i would like to know how to detect the "intensity of BTsignal"


                                                                              Thank you

0
piesoft
Asked:
piesoft
1 Solution
 
jorlopezCommented:
Hi,

One possibility is to call the function 'BluetoothGetDeviceInfo' that retrieves information about a remote Bluetooth device. In the BLUETOOTH_DEVICE_INFO structure you can find the  'ULONG ulClassofDevice' field. I suppose that is you're looking for.

You can get the description of that field at https://www.bluetooth.org/foundry/assignnumb/document/baseband.

About intensity of BT signal, I'm afraid there is no way to get it yet.....

Luck!

Jorge

0
 
benrennaisCommented:
Hi. I'd like to know how you manage to search for bluetooth devices (with EVC4++). As for me, I use vainely the following code :

       WSACleanup();

      WSADATA wsaData;
      ZeroMemory(&wsaData, sizeof(wsaData));
      if(WSAStartup(MAKEWORD(2,2),&wsaData) != 0) return(0);


      //Vérification de la version
      if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 )
      {
            ::MessageBox(NULL,_T("Probleme de dll winsock"),NULL,MB_OK);
            WSACleanup( );
            return(0);
      }
      
 

      //======================================================      
      //==== Recherche des périphériques BLUETOOTH ===========
      //======================================================


      //===========CRITERES DE RECHERCHE =====================

      //Structure contenant les critères de recherche
      WSAQUERYSET wsaq;                        

      ZeroMemory(&wsaq, sizeof(wsaq));

      wsaq.dwSize                  = sizeof(wsaq);      //Obligatoire
      wsaq.lpszServiceInstanceName = NULL;                  //Optional
      wsaq.lpServiceClassId        = NULL;
      wsaq.lpVersion               = NULL;                  //Optional
      wsaq.lpszComment             = NULL;                  //Ignored
      wsaq.dwNameSpace             = NS_BTH;                  //Obligatoire
      wsaq.lpNSProviderId          = NULL;                  //Optional
      wsaq.lpszContext             = NULL;                  //Optional
      wsaq.dwNumberOfProtocols     = 0;    
      wsaq.lpafpProtocols          = NULL;                  //Optional
      wsaq.lpszQueryString         = NULL;                  //Optional
      wsaq.dwNumberOfCsAddrs       = 0;                        //Ignored ??
      wsaq.lpcsaBuffer             = NULL;                  //Ignored
      wsaq.dwOutputFlags           = 0   ;                  //Ignored
      wsaq.lpBlob                  = NULL;                  //Optional
   

      
      //===========LANCEMENT DE LA RECHERCHE =================

      //Handle contenant les résultats du discovery
      HANDLE hLookup = 0;
      

      //...........................................................
      // LUP_CONTAINERS active le Service Discovery Protocol (SDP)
      // afin d'effectuer une recherche de périph. bluetooth
      //...........................................................


      if(WSALookupServiceBegin(&wsaq,LUP_CONTAINERS, &hLookup) != 0 )
      {
            ::MessageBox(NULL,_T("Probleme WSA"),NULL,MB_OK);
            return(0);
      }

      
      //======EXPLOITATION DES RESULTATS DE RECHERCHE ========
      
      //Buffer de sortie
      CHAR buf[4096];
      LPWSAQUERYSET pwsaResults = (LPWSAQUERYSET) buf;
      ZeroMemory(pwsaResults, sizeof(WSAQUERYSET));
      pwsaResults->dwSize = sizeof(WSAQUERYSET);
      pwsaResults->dwNameSpace = NS_BTH;
      pwsaResults->lpBlob = NULL;

      //Taille buffer de sortie
      DWORD dwSize = sizeof(buf);
      int Val_ret=0;

      do
      {                  
            Val_ret = WSALookupServiceNext(hLookup, LUP_RETURN_NAME, &dwSize,pwsaResults);            
            if(Val_ret == ERROR_SUCCESS)
                  ::MessageBox(NULL,pwsaResults->lpszServiceInstanceName,NULL,MB_OK);

      }while( (Val_ret != SOCKET_ERROR) && (Val_ret != WSA_E_NO_MORE) );


      if(Val_ret == SOCKET_ERROR)    {}
      if(Val_ret == WSA_E_NO_MORE) {}

      WSALookupServiceEnd(hLookup);


Do you have any idea ? I would add I use an HHP Doplhin 9500 (with a MS bluetooth stack...). Thanking you in advance.

Benoît PICHOT
0
 
piesoftAuthor Commented:
Thank For Reply

if you have some Example to Get  "lpServiceClassId" in WSALookupServiceNext()

please show me Because i'm try to get it but i'm have "Socket error 10014"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now