예제 #1
0
        /// <summary>
        /// Sets the long network address of this node.
        /// </summary>
        /// <param name="address">The long network address</param>
        public async Task SetDestinationAddressAsync(LongAddress address)
        {
            await ExecuteAtCommandAsync(new DestinationAddressHighCommand(address.High));

            Address.LongAddress.High = address.High;
            await ExecuteAtCommandAsync(new DestinationAddressLowCommand(address.Low));

            Address.LongAddress.Low = address.Low;
        }
예제 #2
0
        public bool Equals(NodeAddress other)
        {
            if (Is16BitDisabled)
            {
                return(LongAddress.Equals(other.LongAddress));
            }

            if (LongAddress.Equals(LongAddress.Broadcast))
            {
                return(ShortAddress.Equals(other.ShortAddress));
            }

            return(LongAddress.Equals(other.LongAddress));
        }
예제 #3
0
        /// <summary>
        /// Queries the long network address for this node.
        /// </summary>
        /// <returns>The long network address</returns>
        public virtual async Task <NodeAddress> GetDestinationAddressAsync()
        {
            PrimitiveResponseData <uint> high =
                await ExecuteAtQueryAsync <PrimitiveResponseData <uint> >(new DestinationAddressHighCommand());

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

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

            PrimitiveResponseData <ShortAddress> source =
                await ExecuteAtQueryAsync <PrimitiveResponseData <ShortAddress> >(new SourceAddressCommand());

            return(new NodeAddress(address, source.Value));
        }
예제 #4
0
        /// <summary>
        /// Queries the long network address for this node.
        /// </summary>
        /// <returns>The long network address</returns>
        public virtual async Task <NodeAddress> GetAddressAsync()
        {
            PrimitiveResponseData <uint> high =
                await ExecuteAtQueryAsync <PrimitiveResponseData <uint> >(new DestinationAddressHighCommand());

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

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

            // we have to do this nonsense because they decided to reuse "MY" for the cellular IP source address
            PrimitiveResponseData <byte[]> source =
                await ExecuteAtQueryAsync <PrimitiveResponseData <byte[]> >(new SourceAddressCommand());

            var leValue            = source.Value.Reverse().ToArray();
            var sourceAddressValue = BitConverter.ToUInt16(leValue, 0);
            var sourceAddress      = new ShortAddress(sourceAddressValue);

            return(new NodeAddress(address, sourceAddress));
        }
예제 #5
0
파일: XBeeNode.cs 프로젝트: alamus/XBee
 /// <summary>
 ///     Sets the long network address of this node.
 /// </summary>
 /// <param name="address">The long network address</param>
 public virtual async Task SetDestinationAddressAsync(LongAddress address)
 {
     await ExecuteAtCommandAsync(new DestinationAddressHighCommand(address.High)).ConfigureAwait(false);
     await ExecuteAtCommandAsync(new DestinationAddressLowCommand(address.Low)).ConfigureAwait(false);
 }
예제 #6
0
 public NodeAddress(LongAddress longAddress) : this(longAddress, ShortAddress.Broadcast)
 {
 }
예제 #7
0
 public NodeAddress(LongAddress longAddress, ShortAddress shortAddress)
 {
     LongAddress  = longAddress;
     ShortAddress = shortAddress;
 }
예제 #8
0
 public override int GetHashCode()
 {
     return(LongAddress != null?LongAddress.GetHashCode() : 0);
 }
예제 #9
0
 public NodeAddress(LongAddress longAddress) : this(longAddress, ShortAddress.Disabled)
 {
 }
예제 #10
0
 public async Task SetDestinationAddress(LongAddress address)
 {
     await SetDestinationAddressAsync(address);
 }