/// <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; }
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)); }
/// <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)); }
/// <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)); }
/// <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); }
public NodeAddress(LongAddress longAddress) : this(longAddress, ShortAddress.Broadcast) { }
public NodeAddress(LongAddress longAddress, ShortAddress shortAddress) { LongAddress = longAddress; ShortAddress = shortAddress; }
public override int GetHashCode() { return(LongAddress != null?LongAddress.GetHashCode() : 0); }
public NodeAddress(LongAddress longAddress) : this(longAddress, ShortAddress.Disabled) { }
public async Task SetDestinationAddress(LongAddress address) { await SetDestinationAddressAsync(address); }