public NodeEvent GetEvent(ZWaveNode node, byte[] message) { NodeEvent nodeEvent = null; Command type = (Command)message[1]; if (type == Command.VersionCommandClassReport) { if (!Enum.IsDefined(typeof(CommandClass), message[2])) { return nodeEvent; } CommandClass cmdClass = (CommandClass)message[2]; VersionValue value = new VersionValue(cmdClass, message[3]); // Update node CC data if (cmdClass != CommandClass.NotSet) { var nodeCc = node.GetCommandClass(cmdClass); if (nodeCc != null) nodeCc.Version = value.Version; // Set the VersionCommandClass event nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, value, 0); } else { Utility.logger.Warn("Command Class {0} ({1}) not supported yet", message[3], message[3].ToString("X2")); } } return nodeEvent; }
public NodeEvent GetEvent(ZWaveNode node, byte[] message) { NodeEvent nodeEvent = null; var type = (Command)message[1]; if (type == Command.VersionReport) { var nodeVersion = new NodeVersion { LibraryType = message[2], ProtocolVersion = message[3], ProtocolSubVersion = message[4], ApplicationVersion = message[5], ApplicationSubVersion = message[6] }; node.Version = nodeVersion; nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, nodeVersion, 0); } if (type == Command.VersionCommandClassReport) { var cmdClass = (CommandClass)message[2]; var value = new VersionValue(cmdClass, message[3]); // Update node CC data if (cmdClass != CommandClass.NotSet) { var nodeCc = node.GetCommandClass(cmdClass); if (nodeCc != null) nodeCc.Version = value.Version; // Set the VersionCommandClass event nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, value, 0); } else { Utility.logger.Warn("Command Class {0} ({1}) not supported yet", message[3], message[3].ToString("X2")); } } return nodeEvent; }