locked
Write Gatt Characteristic with custom UUID RRS feed

  • Question

  • I want to write to a Characteristic within a Service which has UUID 0xFFF0

    However this is the problem:

    Class

    GattServiceUuids

    doesn't have the option to "Set" the Uuid, it's only a list of common Uuid's.  So I can't get the service out of the device because it is not a standard service.

    So I see that the only Services that can have characteristics changed on a peripheral are services in the common list.

    E.g.:


                    GattCharacteristic characteristic = linkLossService.GetCharacteristics(GattCharacteristicUuids.AlertLevel)[0];
    
                    await characteristic.WriteValueAsync(data.AsBuffer(), GattWriteOption.WriteWithResponse);
    



    Could you please correct me if I am wrong, and provide example code to set a characteristic in a service which has a non-standard UUID??

    Thanks for your help

    Saturday, November 22, 2014 9:23 AM

Answers

  • Hi,

    So your main question should be how to get the custom service. right?

    If so, try the following:

                var devices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromShortId(0xFFF0));
                var service = GattDeviceService.FromIdAsync(devices[0].Id);
    Let me know if it works for you.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 24, 2014 8:50 AM