Exemplo n.º 1
0
        /// <summary>
        /// Used to determine if encryption is enabled on this node.
        /// </summary>
        /// <returns>True if encryption is enabled</returns>
        public async Task <bool> IsEncryptionEnabledAsync()
        {
            PrimitiveResponseData <bool> response =
                await ExecuteAtQueryAsync <PrimitiveResponseData <bool> >(new EncryptionEnableCommand());

            return(response.Value);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the configured sleep mode for this node.
        /// </summary>
        /// <returns>The sleep mode</returns>
        public virtual async Task <SleepMode> GetSleepModeAsync()
        {
            PrimitiveResponseData <SleepMode> response =
                await ExecuteAtQueryAsync <PrimitiveResponseData <SleepMode> >(new SleepModeCommand());

            return(response.Value);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the operating channel used between nodes.
        /// </summary>
        /// <returns></returns>
        public virtual async Task <byte> GetChannelAsync()
        {
            PrimitiveResponseData <byte> response =
                await ExecuteAtQueryAsync <PrimitiveResponseData <byte> >(new OperatingChannelCommand());

            return(response.Value);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the network association state for this node.
        /// </summary>
        public async Task <AssociationIndicator> GetAssociationAsync()
        {
            PrimitiveResponseData <AssociationIndicator> response = await
                                                                    Controller.ExecuteAtQueryAsync <PrimitiveResponseData <AssociationIndicator> >(
                new AssociationIndicationCommand());

            return(response.Value);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the static serial number of this node.
        /// </summary>
        /// <returns>The serial number</returns>
        public async Task <LongAddress> GetSerialNumberAsync()
        {
            PrimitiveResponseData <uint> highAddress =
                await ExecuteAtQueryAsync <PrimitiveResponseData <UInt32> >(new SerialNumberHighCommand());

            PrimitiveResponseData <uint> lowAddress =
                await ExecuteAtQueryAsync <PrimitiveResponseData <UInt32> >(new SerialNumberLowCommand());

            return(new LongAddress(highAddress.Value, lowAddress.Value));
        }
Exemplo n.º 6
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));
        }
Exemplo n.º 7
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));
        }