/// <summary> /// Syntax sugar to create a new <see cref="KnownAttributes" /> with adopted attributes added by calling /// <see cref="AdoptedServices.AddAdoptedServices" />, <see cref="AdoptedCharacteristics.AddAdoptedCharacteristics" />, and /// <see cref="AdoptedDescriptors.AddAdoptedDescriptors" /> /// </summary> public static KnownAttributes CreateWithAdoptedAttributes() { var result = new KnownAttributes(); result.AddAdoptedServices(); result.AddAdoptedCharacteristics(); result.AddAdoptedDescriptors(); return(result); }
/// <summary> /// Add the Bluetooth SIG adopted descriptors to <paramref name="attributes" /> /// <remarks> /// <see href="https://www.bluetooth.com/specifications/gatt/descriptors" /> /// </remarks> /// </summary> public static void AddTo(KnownAttributes attributes) { attributes.Add(CharacteristicExtendedProperties); attributes.Add(CharacteristicUserDescription); attributes.Add(ClientCharacteristicConfiguration); attributes.Add(ServerCharacteristicConfiguration); attributes.Add(CharacteristicPresentationFormat); attributes.Add(CharacteristicAggregateFormat); attributes.AddDescriptor(0x2906, "Valid Range"); attributes.AddDescriptor(0x2907, "External Report Reference"); attributes.AddDescriptor(0x2908, "Export Reference"); attributes.AddDescriptor(0x290B, "Environmental Sensing Configuration"); attributes.AddDescriptor(0x290C, "Environmental Sensing Measurement"); attributes.AddDescriptor(0x290D, "Environmental Sensing Trigger Setting"); attributes.AddDescriptor(0x2909, "Number of Digitals"); attributes.AddDescriptor(0x290E, "Time Trigger Setting"); attributes.AddDescriptor(0x290A, "Value Trigger Setting"); }
/// <summary> /// Returns the description of the known GUID value if it is known, else the GUID formatted according to /// <paramref name="guidFormatString" /> /// </summary> public static String GetDescriptionOrGuid(this KnownAttributes known, Guid id, String guidFormatString = null) { return(known.Get(id)?.Description ?? id.ToString(guidFormatString)); }
/// <inheritdoc cref="AddTo" /> public static void AddAdoptedDescriptors(this KnownAttributes attributes) { AddTo(attributes); }