Example #1
0
 private String ShowUuid(wclGattUuid Uuid)
 {
     if (Uuid.IsShortUuid)
     {
         return(Uuid.ShortUuid.ToString("X4"));
     }
     return(Uuid.LongUuid.ToString());
 }
Example #2
0
        /// <summary> Converts <see cref="wclGattUuid"/> type to standard system <see cref="Guid"/>. </summary>
        /// <param name="Uuid"> The <see cref="wclGattUuid"/> that should be converted. </param>
        /// <returns> The <see cref="Guid"/> composed from the <c>Uuid</c>. </returns>
        /// <seealso cref="Guid"/>
        /// <seealso cref="wclGattUuid"/>
        protected Guid ToGuid(wclGattUuid Uuid)
        {
            if (!Uuid.IsShortUuid)
            {
                return(Uuid.LongUuid);
            }

            Byte[] Bytes = wclUUIDs.Bluetooth_Base_UUID.ToByteArray();
            Int16  Data2 = BitConverter.ToInt16(Bytes, 4);
            Int16  Data3 = BitConverter.ToInt16(Bytes, 6);

            Byte[] Data4 = new Byte[8];
            Buffer.BlockCopy(Bytes, 8, Data4, 0, 8);
            return(new Guid(Uuid.ShortUuid, Data2, Data3, Data4));
        }
Example #3
0
 /// <summary> Compares the attribute's <see cref="wclGattUuid"/> with given standard
 ///   system <see cref="Guid"/>. </summary>
 /// <param name="GattUuid"> The attribute's <see cref="wclGattUuid"/>. </param>
 /// <param name="Uuid">The system <see cref="Guid"/>. </param>
 /// <returns> Returns <c>true</c> if the attribute's UUID is equals to the GUID.
 ///   Returns <c>false</c> otherwise. </returns>
 /// <seealso cref="Guid"/>
 /// <seealso cref="wclGattUuid"/>
 protected Boolean CompareGuid(wclGattUuid GattUuid, Guid Uuid)
 {
     return(ToGuid(GattUuid) == Uuid);
 }