Solved

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

Posted on 2004-08-31
3
1,642 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article is a step by step guide on how to create a basic PTP link using Ubiquiti airOS devices. This guide can be used on the following Ubiquiti AirMAX devices. Nanostation, Bullets, AirBridge, Nanobeam, NanoBridge to name a few. Please review …
DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now