private void OnSchemeReport(ActionCompletedUnit ou) { if (requestScheme.Result.State == ActionStates.Completed) { SecurityManagerInfo.Network.SetSecuritySchemes(SpecificResult.Id, SecuritySchemeSet.S0); COMMAND_CLASS_SECURITY.SECURITY_SCHEME_REPORT command = requestScheme.SpecificResult.Command; //TO# 07122 accourding to SDS12652-11 section 3.29.2.3, an including controller must not verify the reported scheme. sendNetworkKeySet.NodeId = SpecificResult.Id; expectNetworkKeyVerify.SrcNodeId = SpecificResult.Id; var networkKey = SecurityManagerInfo.GetActualNetworkKey(SecuritySchemes.S0); if (SecurityManagerInfo.TestNetworkKeyS0InSet != null) { networkKey = SecurityManagerInfo.TestNetworkKeyS0InSet; } sendNetworkKeySet.Data = new COMMAND_CLASS_SECURITY.NETWORK_KEY_SET() { networkKeyByte = new List <byte>(networkKey) }; SecurityManagerInfo.ActivateNetworkKeyS0Temp(); if (SecurityManagerInfo.DelaysS0.ContainsKey(SecurityS0Delays.NetworkKeySet)) { sendNetworkKeySet.DataDelay = SecurityManagerInfo.DelaysS0[SecurityS0Delays.NetworkKeySet]; } } else { SetStateCompletedSecurityFailed(ou); } }
private void PrepareRequestNetworkKey(StartActionUnit ou) { if (SupportedSecuritySchemes == 0) { _securityManagerInfo.ActivateNetworkKeyS0Temp(); requestNetworkKey.DestNodeId = NodeId; requestNetworkKey.SrcNodeId = VirtualNodeId; ou.SetNextActionItems(requestNetworkKey); if (_securityManagerInfo.DelaysS0.ContainsKey(SecurityS0Delays.SchemeReport)) { Thread.Sleep(_securityManagerInfo.DelaysS0[SecurityS0Delays.SchemeReport]); } } else { SpecificResult.SubstituteStatus = SubstituteStatuses.Failed; SetStateCompletedSecurityFailed(ou); } }