コード例 #1
0
        // 历史报警信息
        public void GetHisAlarmInfo()
        {
            Int32 index = 0;
            Int32 ret   = HncApi.HNC_AlarmGetHistoryData(index, ref count, historyData, HNCCollector.ActiveClientNo);

            if (ret != 0)
            {
                MessageBox.Show("failing to get the history alarmNum!");
            }
            // 注意报警信息有很多,这种表达方式需要验证。  historyData[i]
        }
コード例 #2
0
ファイル: Partialmachine.cs プロジェクト: 0000duck/software
        public Int32 HNC_AlarmGetHistoryData(Int32 index, ref Int32 count, AlarmHisData[] data)
        {
            Int32  MAX_ALARM_HISDATA_LEN = HncApi.ALARM_HISTORY_MAX_NUM * Marshal.SizeOf(typeof(AlarmHisData));
            IntPtr ptr = Marshal.AllocHGlobal(MAX_ALARM_HISDATA_LEN);
            Int32  ret = HncApi.HNC_AlarmGetHistoryData(index, ref count, ptr, _ClientNo);

            if (ret == 0)
            {
                for (Int32 i = 0; i < count; i++)
                {
                    data[i] = (AlarmHisData)Marshal.PtrToStructure((IntPtr)(ptr.ToInt32() + i * Marshal.SizeOf(typeof(AlarmHisData))), typeof(AlarmHisData));
                }
            }

            Marshal.FreeHGlobal(ptr);

            return(ret);
        }