コード例 #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
ファイル: ServiceElement.cs プロジェクト: zhubin-12/32feet
        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);
            }
        }