Example #1
0
        /// <summary>
        /// Constructor
        ///
        /// @param networkManager the {@link ZigBeeNetworkManager}
        /// @param ieeeAddress the {@link IeeeAddress} of the node
        /// @throws {@link IllegalArgumentException} if ieeeAddress is null
        /// </summary>
        public ZigBeeNode(IZigBeeNetwork network, IeeeAddress ieeeAddress)
        {
            this._network    = network;
            this.IeeeAddress = ieeeAddress ?? throw new ArgumentException("IeeeAddress can't be null when creating ZigBeeNode");
            //this._serviceDiscoverer = new ZigBeeNodeServiceDiscoverer(networkManager, this);

            network.AddCommandListener(this);
        }
Example #2
0
        public void SetDao(ZigBeeNodeDao dao)
        {
            IeeeAddress     = new IeeeAddress(dao.IeeeAddress);
            NetworkAddress  = dao.NetworkAddress;
            NodeDescriptor  = dao.NodeDescriptor;
            PowerDescriptor = dao.PowerDescriptor;
            if (dao.BindingTable != null)
            {
                BindingTable.AddRange(dao.BindingTable);
            }

            foreach (ZigBeeEndpointDao endpointDao in dao.Endpoints)
            {
                ZigBeeEndpoint endpoint = new ZigBeeEndpoint(this, endpointDao.EndpointId);
                endpoint.SetDao(endpointDao);
                Endpoints[endpoint.EndpointId] = endpoint;
            }
        }
Example #3
0
        /// <summary>
        /// Gets a {@link ZigBeeNodeDao} representing the node
        ///
        /// @return the {@link ZigBeeNodeDao}
        /// </summary>
        public ZigBeeNodeDao GetDao()
        {
            ZigBeeNodeDao dao = new ZigBeeNodeDao();

            dao.IeeeAddress     = IeeeAddress.ToString();
            dao.NetworkAddress  = NetworkAddress;
            dao.NodeDescriptor  = NodeDescriptor;
            dao.PowerDescriptor = PowerDescriptor;
            dao.BindingTable    = BindingTable;

            List <ZigBeeEndpointDao> endpointDaoList = new List <ZigBeeEndpointDao>();

            foreach (ZigBeeEndpoint endpoint in Endpoints.Values)
            {
                endpointDaoList.Add(endpoint.GetDao());
            }
            dao.Endpoints = endpointDaoList;

            return(dao);
        }
Example #4
0
 /// <summary>
 /// Constructor
 ///
 /// <param name="networkr">the <see cref="IZigBeeNetwork"></param>
 /// <param name="ieeeAddress">the <see cref="IeeeAddress"> of the node</param>
 /// <param name="networkAddress">the network address of the node</param>
 /// </summary>
 public ZigBeeNode(IZigBeeNetwork network, IeeeAddress ieeeAddress, ushort networkAddress)
     : this(network, ieeeAddress)
 {
     NetworkAddress = networkAddress;
 }