示例#1
0
        public void TestGetEvent()
        {
            int[]      data  = GetPacketData("00 1A 91 00 17 88 01 02 13 65 36 F7 7B 02 01 00 01 01 04 41 18 7C 01 21 00 00 20 C8 C4");
            IXBeeEvent frame = XBeeEventFactory.GetXBeeFrame(data);

            Assert.True(frame is XBeeReceivePacketExplicitEvent);
            _output.WriteLine(frame.ToString());

            XBeeReceivePacketExplicitEvent xbeeEvent = (XBeeReceivePacketExplicitEvent)frame;

            Assert.Equal(1, xbeeEvent.GetClusterId());
            Assert.Equal(1, xbeeEvent.GetDestinationEndpoint());
            Assert.Equal(63355, xbeeEvent.GetNetworkAddress());
            Assert.Equal(0x104, xbeeEvent.GetProfileId());
        }
        public void Test()
        {
            XBeeReceivePacketExplicitEvent responseEvent = new XBeeReceivePacketExplicitEvent();

            responseEvent.Deserialize(
                GetPacketData("00 18 91 00 13 A2 00 40 52 2B AA 7D 84 E0 E0 22 11 C1 05 02 52 78 44 61 74 61 52"));
            _output.WriteLine(responseEvent.ToString());
            Assert.Equal(0x91, responseEvent.GetFrameType());
            Assert.Equal(0x7D84, responseEvent.GetNetworkAddress());
            Assert.Equal(224, responseEvent.GetSourceEndpoint());
            Assert.Equal(224, responseEvent.GetDestinationEndpoint());
            Assert.Equal(0x2211, responseEvent.GetClusterId());
            Assert.Equal(0xC105, responseEvent.GetProfileId());
            Assert.Equal(ReceiveOptions.PACKET_BROADCAST, responseEvent.GetReceiveOptions());
            Assert.Equal(new IeeeAddress(BigInteger.Parse("0013A20040522BAA", System.Globalization.NumberStyles.HexNumber)), responseEvent.GetIeeeAddress());

            int[] arrayToTestAgainst = GetPacketData("52 78 44 61 74 61");
            int[] getDataResult      = responseEvent.GetData();

            Assert.True(arrayToTestAgainst.SequenceEqual(getDataResult));
        }