Example #1
0
 /// <summary>
 /// Sends a command to the focuser hub, via the focuserCommunicator, and waits for a specific response depending on the command.
 /// </summary>
 /// <param name="cmd">The command to send to the device</param>
 /// <param name="resp">The expected response to the command</param>
 /// <param name="purpose">A description of the command (used when logging data and throwing exceptions).</param>
 private static void sendCommand(string cmd, CmdResponseOptions resp, string purpose)
 {
     try
     {
         FocuserManualResetEvent responseEvent = new FocuserManualResetEvent(resp);
         focuserCommunicator.SendString(cmd, responseEvent);
         if (responseEvent.WaitOne(CMD_RESPONSE_TIMEOUT))
             ClearTimeoutCount();
         else
         {
             responseEvent.SetTimeoutOccurred();
             HandleTimeoutEvent();
         }
     }
     catch
     {
         throw;
     }
 }
 public FocuserManualResetEvent(CmdResponseOptions cmd)
     : base(false, EventResetMode.ManualReset)
 {
     this.command = cmd;
 }