Exemplo n.º 1
0
        public void PdlNonHackProtocolId_Avctp()
        {
            //const UInt16 SvcClass16Avcrp = 0x110E;
            const UInt16 SvcClass16AvcrpController_ = 0x110F;
            Guid         SvcClass128AvcrpController = BluetoothService.CreateBluetoothUuid(SvcClass16AvcrpController_);
            //
            const UInt16 SvcClass16ProtocolL2CAP = 0x0100;
            //Debug_Assert_CorrectShortUuid(SvcClass16ProtocolL2CAP, BluetoothService.L2CapProtocol);
            const UInt16 SvcClass16ProtocolAvctp = 0x0017;
            //Debug_Assert_CorrectShortUuid(SvcClass16ProtocolAvctp, BluetoothService.AvctpProtocol);
            //
            const UInt16 PsmAvcrp = 0x0017;
            //const UInt16 PsmAvcrpBrowsing = 0x001B;
            //
            const UInt16 Version = 0x0103; // 1.3.......
            //
            var layer0 = new ServiceElement(ElementType.ElementSequence,
                                            new ServiceElement(ElementType.Uuid16, SvcClass16ProtocolL2CAP),
                                            new ServiceElement(ElementType.UInt16, PsmAvcrp));
            var layer1 = new ServiceElement(ElementType.ElementSequence,
                                            new ServiceElement(ElementType.Uuid16, SvcClass16ProtocolAvctp),
                                            new ServiceElement(ElementType.UInt16, Version));
            ServiceElement pdl = new ServiceElement(ElementType.ElementSequence,
                                                    layer0, layer1);

            ServiceRecord record = new ServiceRecord(
                new ServiceAttribute(UniversalAttributeId.ProtocolDescriptorList, pdl));

            DumpCompleteThirdPartyRecords.DoTestSmart(PdlNonHackProtocolId_Dump, record);
        }
Exemplo n.º 2
0
        public void OneInt128_Raw()
        {
            byte[]       recordBytes = Data_SimpleRecords.OneInt128_F123_E987;
            const string expectedDump
                = "AttrId: 0xF123" + CrLf
                  + "Int128: E9-87-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10" + CrLf;

            DumpCompleteThirdPartyRecords.DoTestRaw(expectedDump, recordBytes);
        }
Exemplo n.º 3
0
        public void OneUuid32()
        {
            byte[]       recordBytes = OneUuid32Bytes;
            const string expectedDump
                = "AttrId: 0x1234" + CrLf
                  + "Uuid32: 0xFF234001" + CrLf;

            DumpCompleteThirdPartyRecords.DoTestSmart(expectedDump, recordBytes);
        }
Exemplo n.º 4
0
        public void BadUtf8String()
        {
            const string expectedDump
                = "AttrId: 0x1234" + CrLf
                  + "TextString (Unknown/bad encoding):" + CrLf
                  + "Length: 4, >>FF-61-62-FF<<" + CrLf;

            DumpCompleteThirdPartyRecords.DoTestSmart(expectedDump, BadUtf8StringBytes);
        }
Exemplo n.º 5
0
        public void OneUnknownType()
        {
            byte[]       recordBytes = OneUnknownTypeBytes;
            const string expectedDump
                = "AttrId: 0x1234" + CrLf
                  + "Unknown: unknown" + CrLf;

            DumpCompleteThirdPartyRecords.DoTestSmart(expectedDump, recordBytes);
        }
Exemplo n.º 6
0
        public void AttrIdTopBitSet_Raw()
        {
            byte[]       recordBytes = OneNilBytes_AttrIdTopBitSet;
            const string expectedDump
                = "AttrId: 0x9234" + CrLf
                  + "Nil:" + CrLf;

            DumpCompleteThirdPartyRecords.DoTestRaw(expectedDump, recordBytes);
        }
Exemplo n.º 7
0
        public void OneNil()
        {
            byte[]       recordBytes = OneNilBytes;
            const string expectedDump
                = "AttrId: 0x1234" + CrLf
                  + "Nil:" + CrLf;

            DumpCompleteThirdPartyRecords.DoTestSmart(expectedDump, recordBytes);
        }
Exemplo n.º 8
0
        public void PdlUndefinedHackProtoId()
        {
            // Protocol Descriptor List
            //    Protocol #0 UUID L2CAP
            //    Protocol #1 UUID TCS-BIN-CORDLESS
            const UInt16  SvcClass16ProtocolL2CAP          = 0x000000100;
            const UInt16  SvcClass16ProtocolTcsBinCordless = 0x00000005;
            ServiceRecord record = new ServiceRecord(
                new ServiceAttribute(UniversalAttributeId.ProtocolDescriptorList,
                                     new ServiceElement(ElementType.ElementSequence,
                                                        new ServiceElement(ElementType.ElementSequence,
                                                                           new ServiceElement(ElementType.Uuid16, SvcClass16ProtocolL2CAP)),
                                                        new ServiceElement(ElementType.ElementSequence,
                                                                           new ServiceElement(ElementType.Uuid16, SvcClass16ProtocolTcsBinCordless)))
                                     ));

            DumpCompleteThirdPartyRecords.DoTestSmart(PdlTcsBinCordless_Dump, record);
        }
Exemplo n.º 9
0
        public void PdlDefinedButUnhandledHackProtoId()
        {
            //Protocol Descriptor List                        0x0004          M
            //Protocol Descriptor #0          Data Element Sequence           M
            //    Protocol ID                 L2CAP   UUID    L2CAP, Note 1   M
            //    Parameter #0                PSM     Uint16  HID_Control     M
            //Protocol Descriptor #1          Data Element Sequence           M
            //    ProtocolID                  HID     UUID    HID Protocol, Note 1    M
            const UInt16  SvcClass16ProtocolL2CAP = 0x000000100;
            const UInt16  SvcClass16ProtocolHid   = 0x00000011; //BluetoothService.HidpProtocol
            const UInt16  PsmHidp = 0x69;
            ServiceRecord record  = new ServiceRecord(
                new ServiceAttribute(UniversalAttributeId.ProtocolDescriptorList,
                                     new ServiceElement(ElementType.ElementSequence,
                                                        new ServiceElement(ElementType.ElementSequence,
                                                                           new ServiceElement(ElementType.Uuid16, SvcClass16ProtocolL2CAP),
                                                                           new ServiceElement(ElementType.UInt16, PsmHidp)),
                                                        new ServiceElement(ElementType.ElementSequence,
                                                                           new ServiceElement(ElementType.Uuid16, SvcClass16ProtocolHid))
                                                        )));

            DumpCompleteThirdPartyRecords.DoTestSmart(PdlHid_Dump, record);
        }
Exemplo n.º 10
0
        [Test] // Copied from ServiceRecordBuilderTests.
        public void CustomTwoFromOneWithHighAttrIdAdded()
        {
            // Rfcomm/StdSvcClass/SvcName
            ServiceRecordBuilder bldr = new ServiceRecordBuilder();

            bldr.AddServiceClass(BluetoothService.SerialPort);
            bldr.ServiceName = "Hello World!";
            ServiceAttribute attr2 = new ServiceAttribute(
                0x8000,
                ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, 0x80));

            bldr.AddCustomAttribute(attr2);
            ServiceAttribute attr2b = new ServiceAttribute(
                0xFFFF,
                ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, 255));

            bldr.AddCustomAttribute(attr2b);
            ServiceAttribute attr = new ServiceAttribute(
                UniversalAttributeId.ServiceAvailability,
                ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, 8));

            bldr.AddCustomAttribute(attr);
            DumpCompleteThirdPartyRecords.DoTestSmart(ServiceRecordBuilderTests_Data.CustomTwoFromOneWithHighAttrIdAdded, bldr.ServiceRecord);
        }
Exemplo n.º 11
0
 public void DeepString_GoodUtf16LEString2()
 {
     DumpCompleteThirdPartyRecords.DoTestSmart(ExpectedDump_DeepString2LE_SeenAsBadEncoding, DeepString_GoodUtf16LEStringBytes2);
 }
Exemplo n.º 12
0
 public void DeepString_GoodUtf8String()
 {
     DumpCompleteThirdPartyRecords.DoTestSmart(ExpectedDump_DeepString, DeepString_GoodUtf8StringBytes);
 }
Exemplo n.º 13
0
 public void ProtocolDescriptorListAlternatives()
 {
     DumpCompleteThirdPartyRecords.DoTestSmart(ProtocolDescriptorListAlternatives_Dump, ProtocolDescriptorListAlternativesBytes);
 }
Exemplo n.º 14
0
 public void PdlUuid128_Raw()
 {
     DumpCompleteThirdPartyRecords.DoTestRaw(PdlUuid128_DumpRaw, PdlUuid128_Bytes);
 }
Exemplo n.º 15
0
 public void PdlUuid128()
 {
     DumpCompleteThirdPartyRecords.DoTestSmart(PdlUuid128_Dump, PdlUuid128_Bytes);
 }
Exemplo n.º 16
0
 public void PdlUuid32AlsoTopBitSet()
 {
     DumpCompleteThirdPartyRecords.DoTestSmart(PdlUuid32AlsoTopBitSet_Dump, PdlUuid32AlsoTopBitSet_Bytes);
 }