private static void DeviceStatusCallBackPro(int nethandle, int devhandle, int alive_status, int status_handle) { string ip = string.Empty; ip = DevInstanceMgr.DevFindDevIP(devhandle); DeviceStateChangedEventArgs args = new DeviceStateChangedEventArgs(alive_status, ip); if (DevInstanceMgr.dicIPDevInfo.ContainsKey(ip)) { if (DevInstanceMgr.dicIPDevInfo[ip].type == 1) { LNK_BARRIER_ISDK_X64.ExuteDelegate(1, args); } if (DevInstanceMgr.dicIPDevInfo[ip].type == 2) { LNK_LED_ISDK_X64.ExuteDelegate(1, args); } } }
private static unsafe int gate_event_callbackPro(int nethandle, int devhandle, int gate_id, IntPtr pevent, int event_cnt, int event_handle) { int num; DataArrivedEventArgs args; ROADGATE_INFO_STRUCT roadgate_info_struct = new ROADGATE_INFO_STRUCT(); if (devhandle >= 0) { byte[] source = new byte[] { 0, 4, 0, 0 }; IntPtr ptr = Marshal.AllocHGlobal(0x400); IntPtr valuetype = Marshal.AllocHGlobal(4); IntPtr destination = Marshal.AllocHGlobal(4); Marshal.Copy(source, 0, destination, 4); lnk_sdk_interface.LNX_SDK_Interface_X64.read_device_handle(devhandle, 3, valuetype, ptr, destination); num = Marshal.ReadInt32(destination); byte[] buffer2 = new byte[num]; Marshal.Copy(ptr, buffer2, 0, num); roadgate_info_struct.ip = Encoding.Default.GetString(buffer2).Trim(); Marshal.FreeHGlobal(ptr); Marshal.FreeHGlobal(valuetype); Marshal.FreeHGlobal(destination); } if (event_cnt > 0) { int[] numArray = new int[event_cnt]; Marshal.Copy(pevent, numArray, 0, event_cnt); for (int i = 0; i < event_cnt; i++) { DeviceMonitorEventArgs args2; if ((numArray[i] == 4) || (numArray[i] == 5)) { roadgate_info_struct.isManual = true; args = new DataArrivedEventArgs(roadgate_info_struct); LNK_BARRIER_ISDK_X64.ExuteDelegate(3, args); } if (numArray[i] == 14) { args2 = DevInstanceMgr.DevFindDeviceMonitorEventArgs(roadgate_info_struct.ip); args2.IP = roadgate_info_struct.ip; args2.IsPressed = true; LNK_BARRIER_ISDK_X64.ExuteDelegate(2, args2); } if (numArray[i] == 15) { args2 = DevInstanceMgr.DevFindDeviceMonitorEventArgs(roadgate_info_struct.ip); args2.IP = roadgate_info_struct.ip; args2.IsPressed = false; LNK_BARRIER_ISDK_X64.ExuteDelegate(2, args2); } if (numArray[i] == 0x18) { args2 = DevInstanceMgr.DevFindDeviceMonitorEventArgs(roadgate_info_struct.ip); args2.IP = roadgate_info_struct.ip; args2.State = 0; LNK_BARRIER_ISDK_X64.ExuteDelegate(2, args2); } if (numArray[i] == 0x1c) { args2 = DevInstanceMgr.DevFindDeviceMonitorEventArgs(roadgate_info_struct.ip); args2.IP = roadgate_info_struct.ip; args2.State = 1; LNK_BARRIER_ISDK_X64.ExuteDelegate(2, args2); } } } if (event_handle >= 0) { int num4; int num3 = 0; num = 4; if ((lnk_sdk_interface.LNX_SDK_Interface_X64.read_gate_event(nethandle, devhandle, gate_id, event_handle, 11, &num3, (void *)&num4, &num) == 0) && ((num3 == 1) && (num == 4))) { roadgate_info_struct.Counter = num4; args = new DataArrivedEventArgs(roadgate_info_struct); LNK_BARRIER_ISDK_X64.ExuteDelegate(3, args); } } return(0); }