コード例 #1
0
        public static async void checkTemp(XBeeController controller, NodeData node, PictureBox pic, int index, int status, int tempmax)
        {
            var         address = node.getAddress(index);
            LongAddress x       = new LongAddress(Convert.ToUInt32(address.Substring(0, 8), 16), Convert.ToUInt32(address.Substring(8, 8), 16));
            NodeAddress a       = new NodeAddress(x);
            //NodeAddress x = new NodeAddress(serialNumber1);
            var remoteNode = await controller.GetRemoteAsync(a);

            var serialNumber2 = await remoteNode.GetTemperature();

            /*if (!checkOver9(serialNumber2.ToString()))
             * {*/
            if (Convert.ToInt32(serialNumber2.ToString(), 16) >= tempmax)
            {
                node.statusUpdate(index, status);
            }

            /*}
             * else
             * {
             *  node.statusUpdate(index, 3);
             * }*/
            pic.Invalidate();
            //MessageBox.Show(x.ToString());
        }
コード例 #2
0
ファイル: LongAddressTests.cs プロジェクト: splitice/XBee
        public void RoundtripLong()
        {
            var address = new LongAddress(0x1000000000000000UL);

            Assert.AreEqual(0x1000000000000000UL, address.Value);
            Assert.AreEqual(0U, address.Low);
            Assert.AreEqual(0x10000000U, address.High);
        }
コード例 #3
0
ファイル: LongAddressTests.cs プロジェクト: splitice/XBee
        public void RoundtripShort()
        {
            var address = new LongAddress(1);

            Assert.AreEqual(1UL, address.Value);
            Assert.AreEqual(1U, address.Low);
            Assert.AreEqual(0U, address.High);
        }
コード例 #4
0
        public override async Task <NodeAddress> GetAddressAsync()
        {
            var high = await ExecuteAtQueryAsync <PrimitiveResponseData <uint> >(new DestinationAddressHighCommand());

            var low = await ExecuteAtQueryAsync <PrimitiveResponseData <uint> >(new DestinationAddressLowCommand());

            var address = new LongAddress(high.Value, low.Value);

            return(new NodeAddress(address));
        }
コード例 #5
0
        public void ShouldFailIfIndexIsHigherFourOrLessZero()
        {
            byte manufacturerIdentificationCode = 0xDE;
            byte manufacturerDeviceTypeCode     = 0x17;

            byte[] deviceIdentificationNumber = new byte[] { 0x00, 0x00, 0x01 };

            LongAddress address = new LongAddress(manufacturerIdentificationCode, manufacturerDeviceTypeCode, deviceIdentificationNumber);

            Assert.Throws <IndexOutOfRangeException>(() => Console.WriteLine(address[5]));
            Assert.Throws <IndexOutOfRangeException>(() => Console.WriteLine(address[-1]));
        }
コード例 #6
0
        public void Usage()
        {
            HartCommunicationLite communication = new HartCommunicationLite("COM1");

            Assert.That(communication.Address, Is.Null);

            LongAddress newAddress = new LongAddress(22, 22, new byte[] { 11, 22, 33 });

            communication.SwitchAddressTo(newAddress);

            Assert.That(communication.Address.ToByteArray(), Is.EqualTo(newAddress.ToByteArray()));
        }
コード例 #7
0
        public void Usage()
        {
            byte manufacturerIdentificationCode = 0xDE;
            byte manufacturerDeviceTypeCode     = 0x17;

            byte[] deviceIdentificationNumber = new byte[] { 0x00, 0x00, 0x01 };

            byte[] address = new LongAddress(manufacturerIdentificationCode, manufacturerDeviceTypeCode, deviceIdentificationNumber).ToByteArray();

            Assert.That(address[0], Is.EqualTo(0x9E));
            Assert.That(address[1], Is.EqualTo(0x17));
            Assert.That(address[2], Is.EqualTo(0x00));
            Assert.That(address[3], Is.EqualTo(0x00));
            Assert.That(address[4], Is.EqualTo(0x01));
        }
コード例 #8
0
ファイル: TxRequestFrame.cs プロジェクト: pmmcmullen94/XBee
 public TxRequestFrame(LongAddress destination, byte[] data)
 {
     Destination = destination;
     Data        = data;
 }
コード例 #9
0
 /// <summary>
 ///     Not supported on XBee Cellular.
 /// </summary>
 public override Task SetDestinationAddressAsync(LongAddress address)
 {
     throw new NotSupportedException(NotSupportedMessage);
 }
コード例 #10
0
 public override int GetHashCode()
 {
     return(LongAddress != null?LongAddress.GetHashCode() : 0);
 }
コード例 #11
0
 public NodeAddress(LongAddress longAddress) : this(longAddress, ShortAddress.Disabled)
 {
 }
コード例 #12
0
 public NodeAddress(LongAddress longAddress, ShortAddress shortAddress)
 {
     LongAddress  = longAddress;
     ShortAddress = shortAddress;
 }
コード例 #13
0
 public TxRequestExtFrame(LongAddress destination, ShortAddress shortDestination, byte[] data)
 {
     Destination      = destination;
     ShortDestination = shortDestination;
     Data             = data;
 }
コード例 #14
0
ファイル: LongAddress.cs プロジェクト: mdarlea/DDD-Seedwork
 protected bool Equals(LongAddress other)
 {
     return base.Equals(other) && string.Equals(StreetAddress2, other.StreetAddress2) && string.Equals(County, other.County) && string.Equals(Country, other.Country);
 }
コード例 #15
0
 protected bool Equals(LongAddress other)
 {
     return(base.Equals(other) && string.Equals(StreetAddress2, other.StreetAddress2) && string.Equals(County, other.County) && string.Equals(Country, other.Country));
 }