public void CommandReceived(ZigBeeCommand command) { // This gets called for all received commands // Check if it's our address if (command.SourceAddress.Address != NetworkAddress) { return; } if (!(command is ZclCommand)) { return; } ZclCommand zclCommand = (ZclCommand)command; ZigBeeEndpointAddress endpointAddress = (ZigBeeEndpointAddress)zclCommand.SourceAddress; if (endpointAddress.Endpoint == BROADCAST_ENDPOINT) { foreach (ZigBeeEndpoint endpoint in Endpoints.Values) { endpoint.CommandReceived(zclCommand); } } else if (Endpoints.TryGetValue(endpointAddress.Endpoint, out ZigBeeEndpoint endpoint)) { endpoint.CommandReceived(zclCommand); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (!typeof(ZigBeeEndpointAddress).IsAssignableFrom(obj.GetType())) { return(false); } ZigBeeEndpointAddress other = (ZigBeeEndpointAddress)obj; return(other.Address == Address && other.Endpoint == Endpoint); }
public int CompareTo(IZigBeeAddress that) { if (this == that) { return(0); } ZigBeeEndpointAddress thatAddr = (ZigBeeEndpointAddress)that; if (thatAddr.Address == Address && thatAddr.Endpoint == Endpoint) { return(0); } if (thatAddr.Endpoint == Endpoint) { return(Endpoint - thatAddr.Endpoint); } return(Address - thatAddr.Address); }