/// <summary> /// Updates the status node. /// </summary> protected override bool UpdateStatus() { // get the status from the server. ComDaClient client = DefaultClient; OPCSERVERSTATUS?status = client.GetStatus(); // check the client has been abandoned. if (!Object.ReferenceEquals(client, DefaultClient)) { return(false); } // update the server status. lock (StatusNodeLock) { if (status != null) { StatusNode.SetStatusCode(DefaultSystemContext, StatusCodes.Good, DateTime.UtcNow); StatusNode.ServerState.Value = Utils.Format("{0}", status.Value.dwServerState); StatusNode.CurrentTime.Value = ComUtils.GetDateTime(status.Value.ftCurrentTime); StatusNode.LastUpdateTime.Value = ComUtils.GetDateTime(status.Value.ftLastUpdateTime); StatusNode.StartTime.Value = ComUtils.GetDateTime(status.Value.ftStartTime); StatusNode.VendorInfo.Value = status.Value.szVendorInfo; StatusNode.SoftwareVersion.Value = Utils.Format("{0}.{1}.{2}", status.Value.wMajorVersion, status.Value.wMinorVersion, status.Value.wBuildNumber); } else { StatusNode.SetStatusCode(DefaultSystemContext, StatusCodes.BadOutOfService, DateTime.UtcNow); } StatusNode.ClearChangeMasks(DefaultSystemContext, true); return(status != null); } }
/// <summary> /// Updates the status node. /// </summary> protected override bool UpdateStatus() { // get the status from the server. ComHdaClient client = DefaultClient; ComHdaClient.ServerStatus?status = client.GetStatus(); // check the client has been abandoned. if (!Object.ReferenceEquals(client, DefaultClient)) { return(false); } // update the server status. lock (StatusNodeLock) { StatusNode.ServerUrl.Value = Configuration.ServerUrl; if (status != null) { StatusNode.SetStatusCode(DefaultSystemContext, StatusCodes.Good, DateTime.UtcNow); if (String.IsNullOrEmpty(status.Value.szStatusString)) { StatusNode.ServerState.Value = Utils.Format("{0}", status.Value.wStatus); } else { StatusNode.ServerState.Value = Utils.Format("{0} '{1}'", status.Value.wStatus, status.Value.szStatusString); } StatusNode.CurrentTime.Value = status.Value.ftCurrentTime; StatusNode.LastUpdateTime.Value = DateTime.MinValue; StatusNode.StartTime.Value = status.Value.ftStartTime; StatusNode.VendorInfo.Value = status.Value.szVendorInfo; StatusNode.SoftwareVersion.Value = Utils.Format("{0}.{1}.{2}", status.Value.wMajorVersion, status.Value.wMinorVersion, status.Value.wBuildNumber); } else { StatusNode.SetStatusCode(DefaultSystemContext, StatusCodes.BadOutOfService, DateTime.UtcNow); } StatusNode.ClearChangeMasks(DefaultSystemContext, true); return(status != null); } }