locked
Bluetooth Low Energy - Services Changed RRS feed

  • Question

  • Hello,

    I am using the Windows Bluetooth API (Windows.Devices.Bluetooth.GenericAttributeProfile) in an WPF Application. Everything works fine, which means i can Read and Write characteristics and subscribe to notifications.

    But i have the following problem:

    Our device offers different services. One service (firmware update service) is only offered at certain times (has to be enabled via other service first). Since it looks like services are stored when pairing happens and you cannot scan for offered services, I cannot access this one service which has not been offered while pairing.

    Here is the process:

    1. Retrieve devices with uuid of a service which is always available - works
    2. Select one device and doing configurations (write characteristics) on the service retrieved in step 1 - works
    3. Device now offers a new service - works (tested with android le scanner)
    4. Trying to retrieve devices which offer this new service - does not work

    Just for completion, the firmware update process is the standard CSR OTA (enable OTA mode - new service gets offered - do firmware update via this new service).

    Is there any way to get the GattDeviceService-Instance of this new service on the selected device? Is there any way to update pairing information (services) programmatically to reload offered services?

    Best regards,

    Dominik

    • Moved by Kristin Xie Wednesday, June 17, 2015 2:12 AM move to the right forum
    Tuesday, June 16, 2015 2:23 PM

All replies

  • Hi Dominik,

    Based on your description, your case related to Windows Bluetooth API, I will move your case

    Windows Desktop Development > Windows Hardware WDK and Driver Development  forum for better support.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Wednesday, June 17, 2015 2:12 AM
    Wednesday, June 17, 2015 2:11 AM
  • A call to FindAllAsync() does not re-query the supported services cached. In order to force Windows to re-query the GATT Database, you will have to set the Service Changed characteristic on your device correctly.  Windows will then re-query the GATT Database and FindAllAsync() should work as expected. 

     

    Thanks,

    Kiran


    Tuesday, June 23, 2015 1:53 AM
  • Thanks for your answer.

    Could you please provide me some sample code on how to set Service Changed characterstic correctly?

    I tried with following code:

    public async Task IndicateCharacteristic(GattCharacteristic characteristic)
    {
    	if (characteristic != null)
    	{
    		GattCommunicationStatus status = await characteristic.WriteClientCharacteristicConfigurationDescriptorAsync(
    											GattClientCharacteristicConfigurationDescriptorValue.Indicate);
    
    		if (status == GattCommunicationStatus.Unreachable)
    		{
    			// Do something..
    		}
    	}
    }

    but following exception gets thrown

    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

    when trying to write CharactersticConfigurationDescriptor. Device is reachable because other characteristics can be read. Same problem with demo firmware from csr (hr_sensor).

    Best regards,

    Dominik


    Monday, June 29, 2015 1:15 PM
  • Hi, I am having the same problem as Dominik. Is there any update on this?

    I get the same error message when trying to configure the Service Changed characterstic.

    Reading the documentation, it seems unclear if the service changed feature really is supported in Windows 8.1?

    The definition of the Service changed characteristic is not supported by W8.1, only W10:
    https://msdn.microsoft.com/en-us/library/windows.devices.bluetooth.genericattributeprofile.gattcharacteristicuuids.gattservicechanged.aspx

    BluetoothLEDevice GattServicesChanged event is not supported in W8.1, only W10:
    https://msdn.microsoft.com/en-us/library/windows.devices.bluetooth.bluetoothledevice.gattserviceschanged.aspx

    Any help is greatly appreciated!

    Environment:
    *Note that I am using the WinRT API from a desktop (console) application and not an app
    *Windows 8.1
    *Visual Studio 2013
    • Edited by ned_zeppelin Thursday, September 24, 2015 3:35 PM
    Thursday, September 24, 2015 3:33 PM