Solved

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

Posted on 2004-08-31
3
1,687 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In this article I will describe how to setup a Cisco WLC 5508 to work with Apple's Bonjour protocol across VLANs.  I will also discuss using screen mirroring and Airplay on an AppleTV v3.  This article covers the wireless network only and requires m…
This subject  of securing wireless devices conjures up visions of your PC or mobile phone connecting to the Internet through some hotspot at Starbucks. But it is so much more than that. Let’s look at the facts: devices#sthash.eoFY7dic.
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…

617 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