private void pollingTimer_Tick(object sender, EventArgs e) { SipperCommand cmd = null; lock (executedCmds) { if (executedCmds.Count > 0) { cmd = executedCmds.Dequeue(); } } if (cmd == null) { return; } if (cmd.ExecutedOk()) { errorLastTimeTryingToRetrieveData = false; cameraDataPrev2 = cameraDataPrev1; cameraDataPrev1 = cameraData; cameraData = cmd.CameraLine(); PaintImage(); SaveImageInLogDirectory(); } else { errorLastTimeTryingToRetrieveData = true; PaintErrorRetreivingCammeraLineData(); } refreshButton.Enabled = true; weAreWaitingForCameraLineData = false; }
private void refreshButton_Click(object sender, EventArgs e) { errorLastTimeTryingToRetrieveData = false; weAreWaitingForCameraLineData = true; refreshButton.Enabled = false; sipperCommunications.QueueSipperCommand(SipperCommand.CreateGetCammeraLineCmd(executedCmds, sipperCommunications, logFile)); }
} /* CreateReadSerialPortCmd */ public static SipperCommand CreateStopRecordingCmd(Queue <SipperCommand> _resultQueue, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.StopRecordingCmd, _resultQueue, _circularBuffer, _logFile); return(cmd); } /* CreateReadSerialPortCmd */
} /* CreateReadSerialPortCmd */ public static SipperCommand CreateReBootBatteryCmd(Queue <SipperCommand> _resultQueue, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.ReBootBatteryCmd, _resultQueue, _circularBuffer, _logFile); return(cmd); } /* CreateReBootBatteryCmd */
} /* CreateReadSerialPortCmd */ public static SipperCommand CreateGetCammeraParametersCmd(Queue <SipperCommand> _resultQueue, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.GetCameraParametersCmd, _resultQueue, _circularBuffer, _logFile); return(cmd); } /* CreateReadSerialPortCmd */
} /* CreateReadSerialPortCmd */ public static SipperCommand CreateUserCmd(Queue <SipperCommand> _resultQueue, string _userCmd, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.UserCmd, _resultQueue, _circularBuffer, _logFile); cmd.userCmd = _userCmd; return(cmd); } /* CreateReadSerialPortCmd */
} /* CreateReadSerialPortCmd */ public static SipperCommand CreatePreviewCmd(Queue <SipperCommand> _resultQueue, int _blocksToRead, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.PreviewCmd, _resultQueue, _circularBuffer, _logFile); cmd.blocksToRead = _blocksToRead; return(cmd); } /* CreateReadSerialPortCmd */
} /* CreateReadSerialPortCmd */ public static SipperCommand CreateReadSerialPortCmd(Queue <SipperCommand> _resultQueue, int _serialPort, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.ReadSerialPortCmd, _resultQueue, _circularBuffer, _logFile); cmd.serialPort = _serialPort; return(cmd); } /* CreateReadSerialPortCmd */
public static SipperCommand CreateChangeBatteryCmd(Queue <SipperCommand> _resultQueue, int _batteryNum, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.ChangeBatteryCmd, _resultQueue, _circularBuffer, _logFile); cmd.batteryNum = _batteryNum; return(cmd); } /* CreateReadSerialPortCmd */
} /* CreateReadSerialPortCmd */ public static SipperCommand CreateSetFileNameAndStartRecordingCmd(Queue <SipperCommand> _resultQueue, string _fileName, string _fileDesc, CircularBuffer _circularBuffer, StreamWriter _logFile ) { SipperCommand cmd = new SipperCommand(CmdTypes.SetFileNameAndStartRecordingCmd, _resultQueue, _circularBuffer, _logFile); cmd.fileName = _fileName; cmd.fileDesc = _fileDesc; return(cmd); } /* CreateReadSerialPortCmd */
public CameraLineDisplay(CircularBuffer _sipperCommunications, SipperConfigRec _configRec, StreamWriter _logFile ) { InitializeComponent(); executedCmds = new Queue <SipperCommand> (); sipperCommunications = _sipperCommunications; logFile = _logFile; configRec = _configRec; oldScallingRatio = ScallingRatio(); firstCameraCol = 0; pollingTimer.Enabled = true; sipperCommunications.QueueSipperCommand(SipperCommand.CreateGetCammeraLineCmd(executedCmds, sipperCommunications, logFile)); refreshButton.Enabled = false; weAreWaitingForCameraLineData = true; PaintWaitingForCameraLineData(); }