public void StartSendingMultipleCommands(MultipleCommandSeries series) { if (m_CurrentMultipleCommandSeries != MultipleCommandSeries.None) { m_CanSendCommand = false; m_CurrentMultipleCommandSeries = series; } }
public void FinishedSendingMultipleCommands(MultipleCommandSeries series) { if (m_CurrentMultipleCommandSeries == series) { m_CanSendCommand = true; m_CurrentMultipleCommandSeries = MultipleCommandSeries.None; } }
public List<byte[]> GetCommandSeries(MultipleCommandSeries series) { if (series == MultipleCommandSeries.InitCamera) { return GetInitCameraCommandSeries(); } else if (series == MultipleCommandSeries.ReadCameraSettings) { return GetReadCameraSettingsCommandSeries(); } else if (series == MultipleCommandSeries.ReadCameraState) { return GetReadCameraStateCommandSeries(); } else return new List<byte[]>(); }
private List<WAT910BDCommandWithResponse> SendCameraCommandSeries(MultipleCommandSeries commandSeries, bool readCommands) { if (m_StateMachine.CanSendCommand() && IsConnected) { m_StateMachine.StartSendingMultipleCommands(commandSeries); try { List<WAT910BDCommandWithResponse> commands = m_StateMachine.GetCommandSeries(commandSeries); for (int i = 0; i < commands.Count; i++) { WAT910BDCommandWithResponse command = commands[i]; if (readCommands) { if (!SendReadCommand(command.CommandBytes, command.Command.ToString())) // One of the commands errored. Aborting break; command.Response = m_StateMachine.LastReceivedMessage(); } else { if (!SendWriteCommand(command.CommandBytes, command.Command.ToString())) // One of the commands errored. Aborting break; command.Response = m_StateMachine.LastReceivedMessage(); } } return commands; } finally { m_StateMachine.FinishedSendingMultipleCommands(commandSeries); RaiseOnExecutionCompeted(); } } return null; }