예제 #1
0
        internal static ushort?GetAsClassId16(Guid service)
        {
            var    barr      = service.ToByteArray();
            UInt16 classId16 = BitConverter.ToUInt16(barr, 0);
            var    recreated = BluetoothService.CreateBluetoothUuid(classId16);

            if (service == recreated)
            {
                return(classId16);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public Guid GetValueAsUuid()
        {
            if (m_etd != ElementTypeDescriptor.Uuid)
            {
                throw new InvalidOperationException(ErrorMsgNotUuidType);
            }
            //
            Guid result;

            if (m_type == ElementType.Uuid16)
            {
                result = BluetoothService.CreateBluetoothUuid((UInt16)Value);
                return(result);
            }
            else if (m_type == ElementType.Uuid32)
            {
                result = BluetoothService.CreateBluetoothUuid((UInt32)Value);
                return(result);
            }
            else
            {
                return((Guid)Value);
            }
        }