// 测试获取当前警报信息 public void GetAlarmInfo() { Int32 index = 0; string errTxt = string.Empty; Int32 ret = 0; ret = HncApi.HNC_AlarmGetNum((Int32)AlarmType.ALARM_TYPE_ALL, (Int32)AlarmLevel.ALARM_LEVEL_ALL, ref alarmNum, ActiveClientNo); if (ret != 0) { Console.WriteLine("获取警报失败"); } else { Console.WriteLine($"当前警报数量为{alarmNum}"); } for (int i = 0; i < alarmNum; i++) { ret = HncApi.HNC_AlarmGetData((int)AlarmType.ALARM_TYPE_ALL, (int)AlarmLevel.ALARM_ERR, index, ref alarmNo, ref errTxt, ActiveClientNo); if (ret == 0) { alarmInfo = index.ToString() + alarmNo.ToString() + errTxt + "\n"; Console.WriteLine(alarmInfo); } else { Console.WriteLine(" 无法读取警报信息!"); } } }
// 报警数目 private void GetAlarmNum() { Int32 curAlarmNum = 0; Int32 ret = HncApi.HNC_AlarmGetNum((int)AlarmType.ALARM_TYPE_ALL, (int)AlarmLevel.ALARM_ERR, ref curAlarmNum, HNCCollector.ActiveClientNo); if (ret == 0) { NumLabel.Text = curAlarmNum.ToString(); } else { MessageBox.Show("failing to get the alarm number!"); } }
//采样 public Int32 HNC_AlarmGetNum(Int32 type, Int32 level, ref Int32 num) { return(HncApi.HNC_AlarmGetNum(type, level, ref num, _ClientNo)); }