示例#1
0
 public void StartSendingMultipleCommands(MultipleCommandSeries series)
 {
     if (m_CurrentMultipleCommandSeries != MultipleCommandSeries.None)
     {
         m_CanSendCommand = false;
         m_CurrentMultipleCommandSeries = series;
     }
 }
示例#2
0
 public void FinishedSendingMultipleCommands(MultipleCommandSeries series)
 {
     if (m_CurrentMultipleCommandSeries == series)
     {
         m_CanSendCommand = true;
         m_CurrentMultipleCommandSeries = MultipleCommandSeries.None;
     }
 }
示例#3
0
 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[]>();
 }
示例#4
0
        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;
        }