public void Stop() { try { I60X0.SCA_UnRegisterNotification(hNotify); Win32.EventModify(hEvent[0], Win32.EVENT_SET); if (!scanThread.Join(1000)) { scanThread.Abort(); } if (needClose) { I60X0.SCA_DisableModule(); } else { if (isContinuousMode) { I60X0.SCA_SetTriggerMode(I60X0.TriggerMode.Normal); } } } catch (Exception ex) { } }
public bool SwitchTriggerMode() { if (isContinuousMode) { if (I60X0.SCA_SetTriggerMode(I60X0.TriggerMode.Normal)) { isContinuousMode = false; return(true); } } else { if (I60X0.SCA_SetTriggerMode(I60X0.TriggerMode.Continuous)) { isContinuousMode = true; return(true); } } return(false); }
public bool Start() { if (I60X0.SCA_GetPowerStatus() == 0) { I60X0.SCA_EnableModule(); needClose = true; } Win32.MSGQUEUEOPTIONS options = new Win32.MSGQUEUEOPTIONS(); options.dwSize = 20; options.dwFlags = 2; options.dwMaxMessages = 64; options.cbMaxMessage = 32; options.bReadAccess = true; IntPtr hMsgQ = Win32.CreateMsgQueue(null, options); if (hMsgQ == IntPtr.Zero) { return(false); } hNotify = I60X0.SCA_RegisterNotification(hMsgQ); if (hNotify == IntPtr.Zero) { return(false); } hEvent[0] = Win32.CreateEvent(IntPtr.Zero, false, false, null); hEvent[1] = hMsgQ; scanThread = new Thread(new ThreadStart(this.ScanThreadPorc)); scanThread.Start(); return(true); }