private bool UpdateServerDiagnosticsSummary()
{
// get the latest snapshot.
object value = null;
ServiceResult result = m_serverDiagnosticsCallback(
SystemContext,
m_serverDiagnostics.Variable,
ref value);
ServerDiagnosticsSummaryDataType newValue = value as ServerDiagnosticsSummaryDataType;
// check for changes.
if (Utils.IsEqual(newValue, m_serverDiagnostics.Value))
{
return false;
}
m_serverDiagnostics.Error = null;
// check for bad value.
if (ServiceResult.IsNotBad(result) && newValue == null)
{
result = StatusCodes.BadOutOfService;
}
// check for bad result.
if (ServiceResult.IsBad(result))
{
m_serverDiagnostics.Error = result;
newValue = null;
}
// update the value.
m_serverDiagnostics.Value = newValue;
m_serverDiagnostics.Timestamp = DateTime.UtcNow;
// notify any monitored items.
m_serverDiagnostics.ChangesComplete(SystemContext);
return true;
}