public static bool SetWakeup(Controller controller, byte nodeId, int configValue) { Common.logger.Info("Set Wakeup - value " + configValue); COMMAND_CLASS_WAKE_UP.WAKE_UP_INTERVAL_SET cmd = new COMMAND_CLASS_WAKE_UP.WAKE_UP_INTERVAL_SET(); cmd.nodeid = nodeId; cmd.seconds = Tools.GetBytes(configValue); Console.WriteLine(cmd.seconds[0]); Console.WriteLine(cmd.seconds[1]); Console.WriteLine(cmd.seconds[2]); Console.WriteLine(cmd.seconds[3]); var setWakeup = controller.SendData(nodeId, cmd, Common.txOptions); return(setWakeup.TransmitStatus == TransmitStatuses.CompleteOk); }
private void OnActionCompleted(ActionBase action, ActionResult result) { if (result is NodeInfoResult && result) { if (!IsFullSetup) { _deleteReturnRoute.Token.SetCancelled(); _assignReturnRoute.Token.SetCancelled(); _sendAssociationCreate.Token.SetCancelled(); _sendMultichannelAssociationCreate.Token.SetCancelled(); _requestWakeUpCapabilities.Token.SetCancelled(); _sendWakeUpInterval.Token.SetCancelled(); } if (_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses.Contains(COMMAND_CLASS_ZWAVEPLUS_INFO_V2.ID)) { _requestRoleType.Token.SetCancelled(); } if (BasicDeviceType == 0) { BasicDeviceType = _requestNodeInfo.SpecificResult.RequestNodeInfo.Basic; } if (BasicDeviceType != 0x04) //BASIC_TYPE_ROUTING_SLAVE { _deleteReturnRoute.Token.SetCancelled(); _assignReturnRoute.Token.SetCancelled(); } if ((_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses.Contains(COMMAND_CLASS_ASSOCIATION.ID)) && (_requestNodeInfo.SpecificResult.RequestNodeInfo.SecureCommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.SecureCommandClasses.Contains(COMMAND_CLASS_ASSOCIATION.ID))) { _sendAssociationCreate.Token.SetCancelled(); } if ((_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses.Contains(COMMAND_CLASS_MULTI_CHANNEL_ASSOCIATION_V3.ID)) && (_requestNodeInfo.SpecificResult.RequestNodeInfo.SecureCommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.SecureCommandClasses.Contains(COMMAND_CLASS_MULTI_CHANNEL_ASSOCIATION_V3.ID))) { _sendMultichannelAssociationCreate.Token.SetCancelled(); } else { _sendAssociationCreate.Token.SetCancelled(); } if ((_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.CommandClasses.Contains(COMMAND_CLASS_WAKE_UP_V2.ID)) && (_requestNodeInfo.SpecificResult.RequestNodeInfo.SecureCommandClasses == null || !_requestNodeInfo.SpecificResult.RequestNodeInfo.SecureCommandClasses.Contains(COMMAND_CLASS_WAKE_UP_V2.ID))) { _requestWakeUpCapabilities.Token.SetCancelled(); _sendWakeUpInterval.Token.SetCancelled(); } } else if (result is RequestDataResult) { var requestRes = (RequestDataResult)result; if (result) { if (requestRes.Command != null && requestRes.Command.Length > 2) { if (requestRes.Command[0] == COMMAND_CLASS_WAKE_UP_V2.ID && requestRes.Command[1] == COMMAND_CLASS_WAKE_UP_V2.WAKE_UP_INTERVAL_CAPABILITIES_REPORT.ID) { var wakeUpCapabilitiesReport = (COMMAND_CLASS_WAKE_UP_V2.WAKE_UP_INTERVAL_CAPABILITIES_REPORT)requestRes.Command; int minVal = Tools.GetInt32(wakeUpCapabilitiesReport.minimumWakeUpIntervalSeconds); if (minVal > WakeUpInterval) { WakeUpInterval = minVal; } COMMAND_CLASS_WAKE_UP.WAKE_UP_INTERVAL_SET cmd = new COMMAND_CLASS_WAKE_UP.WAKE_UP_INTERVAL_SET(); cmd.seconds = Tools.GetBytes(WakeUpInterval).Skip(1).ToArray(); cmd.nodeid = NodeId; _sendWakeUpInterval.Data = cmd; } } } else { COMMAND_CLASS_WAKE_UP.WAKE_UP_INTERVAL_SET cmd = new COMMAND_CLASS_WAKE_UP.WAKE_UP_INTERVAL_SET(); cmd.seconds = Tools.GetBytes(WakeUpInterval).Skip(1).ToArray(); cmd.nodeid = NodeId; _sendWakeUpInterval.Data = cmd; } } }