Solved

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

Posted on 2004-08-31
3
1,661 Views
Last Modified: 2013-12-14
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
Comment
Question by:piesoft
3 Comments
 
LVL 1

Expert Comment

by:jorlopez
ID: 11961860
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
 
LVL 1

Accepted Solution

by:
benrennais earned 500 total points
ID: 11964053
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
 

Author Comment

by:piesoft
ID: 11970710
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

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Tired of waiting for your show or movie to load?  Are buffering issues a constant problem with your internet connection?  Check this article out to see if these simple adjustments are the solution for you.
This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question