Bluetooth Low Energy (LE) Generic Attribute (GATT) Profile Drivers

The purpose of each respective GATT sample is to demonstrate how to implement a basic Windows Portable Device (WPD) driver that will work with a blood pressure monitor, a heart rate monitor, thermometer, and the Texas Instrument's CC2540 Mini Develop...

C++ (210.2 KB)
 
 
 
 
 
(0)
3,507 times
Add To Favorites
10/26/2012
E-mail Twitter del.icio.us Digg Facebook
Sign in to Ask a Question


  • win32 api problem
    1 Posts | Last Post May 01, 2013
    • Hi,
      I tried to implement BLE into metro app. It works for me even driver certification and meta-data creation is not fun. But generally I haven't problem and I'm able to read heart rate in metro app.
      But now I need add BLE support into our win32 app, there I have problem. 
      -I can create handle for service even for device using SetupDi... functions.
      -I can enumerate all services,characterictics and find characterictic for heart rate with notify flag (using device or direct service handle)
      -I can read values from all charactreistics with read flag using BluetoothGATTGetCharacteristicValue even with BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_DEVICE flag to read actual data directly from device.
      -I can register my callback function with BluetoothGATTRegisterEvent for herat rate characteristic with S_OK result and valid pEventHandle (using service handle)
      -but NO callback events come from device.
      -if I update heart rate service driver with custom driver for metro app, win32 LE functions returns for service handle (ERROR_GEN_FAILURE) : Device connected to device doesn't work.
      -if I rollback driver changes and have original driver like before, after that even callback works and everything is OK. What I'm doing wrong, please any idea? I really need to solve it...
       
      Thanks Jiri
      
      
      
  • General Problem with this EXTREMELY COMPLICATED BLE support
    3 Posts | Last Post April 30, 2013
    • Hi,
      
      I have a stupid question: Why do I need to write a driver with 1000s of lines of code and going through the hassle of all the driver signing crap just to access a GATT profile? In IOS its 10 lines of code to do that.
      Is there any possibiltiy to access BLE devices in a normal C++ exe without all the driver stupidity?
      
      Regards
      Harald
    • The drivers are required because of the restrictions imposed on the API set that can be used from a Windows Store Application. The drivers use the Win32 Bluetooth GATT API, which is available to all Windows Desktop Applications. Currently the drivers are required for all Windows Store Applications that want to use Bluetooth LE devices.
    • @FlorinB I dont get your answer: Is it now possible to use those API in a "normal' .exe or not? If yes can you provide me with a sample. I dont care about "Windows Store Apps".
      Regards
  • Are there existing Bluetooth Low Energy APIs for Application Development?
    4 Posts | Last Post April 26, 2013
    • Hello,
      I'm tasked to create a profile driver for a glucose device, But Windows 8 was not successful in pairing with the device.
      Windows 8 would proceed on adding the device in the list of paired devices, but the device would prompt an error in pairing.
      I was hoping I could create my own Bluetooth application that will discover and pair with the device.
      I tried using the WinSocket and Bluetooth APIs, but neither of them works in discovering the BLE device.
    • Hello Jane,
      
      There are no current Windows Runtime APIs for working with Bluetooth devices for Windows 8, which is why you need a profile driver in the first place.
      
      In order to provide you with the most accurate and up to date information, we need to know more information about your Bluetooth Blood Glucose device. Can you tell us if it is a device that's already shipping, if not, as many details about the device like the Bluetooth firmware and radio manufacturer would also be helpful. In order for you to be able to work with your device, it needs to be paired with Windows, so if pairing failed, then you can't access resources on the device. Which is why the first step would be to figure out why pairing with the device failed.
    • Hi,
      
      Thank you for the quick response.
      We were not able to pair the device with Windows 8 (Acer W510), the device has customize its pairing sequence.
      Part of the pairing sequence requires the Windows 8 side to input the passkey displayed on the device. Windows 8 skips this part and continues with adding the device to its list of paired devices. Hence, the device prompting an error in the pairing sequence.
      Is there a way for me to create my own application that can discover Bluetooth LE devices and has its own custom pairing sequence that complies with device's requirements?
      The company provided us with an iOS App, and it was able to discover and pair with the device.
      
      The chipset used is BlueCore CSR1000 QFN - Single Mode
      
    • Can you change the IO Capabilities reported by the device in it's Pairing Response to NoInputNoOutput and require no Man In The Middle protection. That should allow for a Just Works unauthenticated pairing procedure to complete successfully.
  • GATT server role support
    2 Posts | Last Post April 26, 2013
    • Hi,
      
      I know that Windows 8 provides 13 BLE functions for a GATT client application to access a GATT server.
      Is it possible to define a GATT server role on Windows 8 so that a Bluetooth LE peripheral can access it?
      
      If so, what API's do I need to use in the profile driver to handle requests from the GATT client?
      
      Thanks,
      Chetan
    • Windows 8 does not currently support the server role (other than the mandatory server characteristics required for interoperability). The server role is primarily implemented by low energy devices which act as peripherals and Windows is the central device. As such, there are no APIs which allow Windows to function as a Bluetooth LE server.
  • BluetoothGATTSetCharacteristicValue
    2 Posts | Last Post April 26, 2013
    • Hi i'm trying to set a characteristic and I got this error 0x80070522(ERROR_PRIVILEGE_NOT_HELD)
      Events and the rest of the example works fine. 
      Any ideas?
      Regards
      Jorge
    • That particular error is typically returned when using a device handle instead of a service handle to write a characteristic value. Are you using a handle of the service device interface to write the characteristic value?
  • Documentation of sample code to understand code architecture
    1 Posts | Last Post April 22, 2013
    • Hi
      Can anyone provide design document of sample code, which at least explain basic architecture of codes?
      
      How one can gain insight of codes quickly and start building application around it?
      
      At present, i am able to compile the code and try to learn more about it.
      I have done some BLE application development of iOS and i expected similar framework for Windows surface but it is bit complicated and without documentation it makes more time consuming to learn about it.
      
      Any hint which can help to quickly analyses major requirement of code.
      
      Thanks in advance!
      Suresh
  • source code compile error
    2 Posts | Last Post April 22, 2013
    • Hi
      I am getting following error when i compile it in VS pro 2012 with WDK install on it.
      
      ------------------------
      3>  Stdafxsrc.cpp
      3>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2065: 'SAL_2_Clean_Violation_using__out' : undeclared identifier
      3>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2146: syntax error : missing ')' before identifier 'LPCRITICAL_SECTION'
      3>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2433: '_AtlInitializeCriticalSectionEx' : 'inline' not permitted on data declarations
      3>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2059: syntax error : ')'
      3>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(70): error C2143: syntax error : missing ';' before '{'
      3>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(70): error C2447: '{' : missing function header (old-style formal list?)
      4>ClCompile:
      4>  Stdafxsrc.cpp
      -----------------
      
      4>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2065: 'SAL_2_Clean_Violation_using__out' : undeclared identifier
      4>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2146: syntax error : missing ')' before identifier 'LPCRITICAL_SECTION'
      4>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2433: '_AtlInitializeCriticalSectionEx' : 'inline' not permitted on data declarations
      4>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(69): error C2059: syntax error : ')'
      4>C:\Program Files\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlwinverapi.h(70): error C2143: syntax error : missing ';' before '{'
      ---------------
      
      How to resolve it?
      Do you have any standard document which explain what this sample is doing?
      
    • Resolved compile error by removing macro as stated in thread discussion below
  • Having issue of incompatible package in VS-Express 2012 for Winodws 8
    2 Posts | Last Post April 20, 2013
    • I have installed VS Express 2012 for windows 8 on my Laptop with Windows 8 OS.
      I also install VS Express 2012 update-2 and WDK. 
      But i am unable to fix below error. I can understand that sample code is build in VS 2010 and it has one incompatible package for VS 2012 based on below error message. But i can not find anywhere "Update VC++ Projects..."
      
      Can anyone help to fix this issue?
      OR shall uninstall this 2012 version and use older 2010 version?
      
      
      Error	1	error MSB8020: The builds tools for WindowsUserModeDriver8.0 (Platform Toolset = 'WindowsUserModeDriver8.0') cannot be found. To build using the WindowsUserModeDriver8.0 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install WindowsUserModeDriver8.0 to build using the WindowsUserModeDriver8.0 build tools.	C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets	44	5	WpdHealthThermometerService
      
    • The wdk requires vs pro, it does not work with express. You can install pro for free and use it for a 90 day trial.
  • Device name of the sample
    2 Posts | Last Post March 26, 2013
    • Hi,
      
      I would like to access to the sample driver from desktop application via DeviceIoControl.
      I set "\\\\.\\BTHLEDevice\\{0000180d-0000-1000-8000-00805f9b34fb}" to 1st parameter of CreateFile(), but it returned GetLastError code 3(ERROR_PATH_NOT_FOUND).
      What should I set value to 1st parameter?
    • Since there can be multiple Bluetooth devices implementing the Heart Rate Profile which are paired with Windows at the same time, the device path you specified above is not specific enough to access the device interface you want.
      
      To correctly open the device interface for the heart rate service, you can use the new Windows.Devices.Enumeration.DeviceInformation class' FindAllAsync method with an AQS query of "System.Devices.InterfaceClassGuid:=\"{0000180d-0000-1000-8000-00805f9b34fb\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True". This will return a DeviceInformationCollection with all the Bluetooth Heart Rate Services enumerated on the system. If there's only one you can use the first DeviceInformation object's Id property and call create file on that.
      Alternatively you can use the older SetupDi functions to achieve the same functionality if you prefer.
      
      To quickly check your device's instance path, just open Device Manager, navigate to the heart rate service you're interested in, right-click -> Properties -> Navigate to the Details tab and select Device Instance Path to find out the instance path of your heart rate service.
      
      Please let me know if you need more information to achieve your scenario.
  • When I changed the .cpp file,I can not compile the project.
    3 Posts | Last Post March 20, 2013
    • At first I can compile the project. But once I edited the .cpp files, many mistakes may appear, such as “WPP_INIT_TRACING”: Can not find the identifier,WPP_CALL_HealthHeartRateService_cpp173 can not fid the identifier. I don't know how to us the wpp tracing of vs2012.
    • When modifying the code did you remove the #include "HealthHeartRateService.tmh" from HealthHeartRateService.cpp? Is HealthHeartRateService.tmh present in $(IntDir)? It should be generated during the build, if you build for Win8Debug the file should be generated at  C++\WpdHealthHeartRate\Win8Debug\WpdBluetoothGattServiceDriver.tmh
    • First thank you for answering my question.
      I did not remove the "HealthHeartRateService.tmh".
      And the ".tmh" file was generated in  $(IntDir).
      I just added some comment in the source file.
1 - 10 of 29 Items