internal static HackProtocolId GetAsUuid16Value(Guid protocolGuid) //BluetoothGuidHelper. { UInt16 u16 = GetAsUuid16Value_(protocolGuid); Int16 i16 = unchecked ((Int16)u16); HackProtocolId pid = (HackProtocolId)i16; return(pid); }
internal static HackProtocolId GetAsUuid16Value(Guid protocolGuid) //BluetoothGuidHelper. { ushort u16 = GetAsUuid16Value_(protocolGuid); short i16 = unchecked ((short)u16); HackProtocolId pid = (HackProtocolId)i16; return(pid); }
private static void DumpProtocolDescriptorListList(System.IO.TextWriter writer, int depth, ServiceElement element) { // The list. System.Diagnostics.Debug.Assert(element.ElementType == ElementType.ElementSequence); WritePrefix(writer, depth); writer.Write("( "); bool firstLayer = true; foreach (ServiceElement layer in element.GetValueAsElementList()) { ServiceElement[] items = layer.GetValueAsElementArray(); int used = 0; System.Diagnostics.Debug.Assert(items[used].ElementTypeDescriptor == ElementTypeDescriptor.Uuid); Guid protoGuid = items[used].GetValueAsUuid(); String protoStr; HackProtocolId proto = GuidToHackProtocolId(protoGuid, out protoStr); // used++; writer.Write("{0}( {1}", (firstLayer ? string.Empty : ", "), protoStr); if (proto == HackProtocolId.L2Cap) { if (used < items.Length) { System.Diagnostics.Debug.Assert(items[used].ElementType == ElementType.UInt16); UInt16 u16 = (UInt16)items[used].Value; HackProtocolServiceMultiplexer psm = unchecked ((HackProtocolServiceMultiplexer)u16); used++; writer.Write(", PSM={0}", Enum_ToStringNameOrHex(psm)); } } else if (proto == HackProtocolId.Rfcomm) { if (used < items.Length) { System.Diagnostics.Debug.Assert(items[used].ElementType == ElementType.UInt8); byte channelNumber = (byte)items[used].Value; used++; writer.Write(", ChannelNumber={0}", channelNumber); } } // Others include BNEP for instance, which isn't defined in the base SDP spec. if (used < items.Length) { writer.Write(", ..."); } writer.Write(" )"); firstLayer = false; }//foreach layer writer.WriteLine(" )"); }