public bool CloseShutter(CustomConfig config)
 {
     try
     {
         if (config.AttachedObject == null)
             return false;
         SerialPort serialPort = config.AttachedObject as SerialPort;
         if (serialPort == null) throw new ArgumentNullException("serialPort");
         if (config.Get("IsHexa") == "True")
         {
             var data = StringToByteArray(config.Get("CaptureOff"));
             serialPort.Write(data, 0, data.Length);
         }
         else
         {
             serialPort.WriteLine(config.Get("CaptureOff"));
         }
         serialPort.Close();
         config.AttachedObject = null;
     }
     catch (Exception ex)
     {
         Log.Debug("ArduinoShutterRelease", ex);
         StaticHelper.Instance.SystemMessage = "Error Shutter " + ex.Message;
     }
     return true;
 }
 public bool OpenShutter(CustomConfig config)
 {
     if (config.AttachedObject != null)
         CloseShutter(config);
     SerialPort serialPort = new SerialPort(config.Get("Port"));
     serialPort.Open();
     serialPort.RtsEnable = true;
     config.AttachedObject = serialPort;
     return true;
 }
Ejemplo n.º 3
0
 public bool OpenShutter(CustomConfig config)
 {
     try
     {
         if (config.AttachedObject != null)
             CloseShutter(config);
         SerialPort serialPort = new SerialPort(config.Get("Port"));
         serialPort.Open();
         serialPort.WriteTimeout = 3500;
         var data = StringToByteArray(config.Get("Init"));
         serialPort.Write(data, 0, data.Length);
         data = StringToByteArray(config.Get("CaptureOn"));
         serialPort.Write(data, 0, data.Length);
         config.AttachedObject = serialPort;
     }
     catch (Exception ex)
     {
         Log.Debug("UsbRelayRelease", ex);
         StaticHelper.Instance.SystemMessage = "Error Shutter " + ex.Message;
     }
     return true;
 }
 public bool DeassertFocus(CustomConfig config)
 {
     SendCommand("4", config.Get("Port"));
     return true;
 }
 public bool CloseShutter(CustomConfig config)
 {
     SendCommand("3", config.Get("Port"));
     return true;
 }
 public bool OpenShutter(CustomConfig config)
 {
     SendCommand("2", config.Get("Port"));
     return true;
 }
 public bool Focus(CustomConfig config)
 {
     SendCommand("0", config.Get("Port"));
     SendCommand("6", config.Get("Port"));
     return true;
 }
 public bool Capture(CustomConfig config)
 {
     SendCommand("0", config.Get("Port"));
     SendCommand("5", config.Get("Port"));
     return true;
 }
 public bool OpenShutter(CustomConfig config)
 {
     try
     {
         if (config.AttachedObject != null)
             CloseShutter(config);
         SerialPort serialPort = new SerialPort(config.Get("Port"));
         serialPort.Open();
         serialPort.RtsEnable = true;
         config.AttachedObject = serialPort;
     }
     catch (Exception ex)
     {
         Log.Debug("Comm OpenShutter", ex);
         StaticHelper.Instance.SystemMessage = "Error Shutter " + ex.Message;
     }
     return true;
 }
 public bool CloseShutter(CustomConfig config)
 {
     SendCommand(config.Get("IrRemote") == "True" ? "7" : "3", config.Get("Port"));
     return true;
 }
 public bool OpenShutter(CustomConfig config)
 {
     SendCommand("0", config.Get("Port"));
     SendCommand(config.Get("IrRemote") == "True" ? "7" : "2", config.Get("Port"));
     return true;
 }
 public bool Capture(CustomConfig config)
 {
     SendCommand("0", config.Get("Port"));
     SendCommand(config.Get("IrRemote") == "True" ? "7" : "5", config.Get("Port"));
     return true;
 }
 public bool OpenShutter(CustomConfig config)
 {
     try
     {
         if (config.AttachedObject != null)
             CloseShutter(config);
         SerialPort serialPort = new SerialPort(config.Get("Port"));
         serialPort.Open();
         serialPort.BaudRate = 9600;
         serialPort.WriteTimeout = 3500;
         if (config.Get("IsHexa") == "True")
         {
             var data = StringToByteArray(config.Get("CaptureOn"));
             serialPort.Write(data, 0, data.Length);
         }
         else
         {
             serialPort.WriteLine(config.Get("CaptureOn"));
         }
         config.AttachedObject = serialPort;
     }
     catch (Exception ex)
     {
         Log.Debug("ArduinoShutterRelease", ex);
         StaticHelper.Instance.SystemMessage = "Error Shutter " + ex.Message;
     }
     return true;
 }