/// <summary>
        /// Open Serial port configurations
        /// </summary>
        public OpenPortResponse OpenPort(OpenPortRequest request)
        {
            try
            {
                request.Device.SerialPort.PortName      = request.Device.DeviceInfo.ComPortName; //COM1
                request.Device.SerialPort.BaudRate      = Settings.BaudRate;                     //9600 || 115200 -> default
                request.Device.SerialPort.DataBits      = 8;                                     //8 -> default
                request.Device.SerialPort.StopBits      = StopBits.One;                          //1 -> default
                request.Device.SerialPort.Parity        = Parity.None;                           //None -> default
                request.Device.SerialPort.ReadTimeout   = Settings.ReadTimeout;                  //300 -> default
                request.Device.SerialPort.WriteTimeout  = Settings.WriteTimeout;                 //300 -> default
                request.Device.SerialPort.Encoding      = Encoding.GetEncoding("iso-8859-1");
                request.Device.SerialPort.DataReceived += PortDataReceived;
                request.Device.SerialPort.Open();
                request.Device.SerialPort.DtrEnable = true;
                request.Device.SerialPort.RtsEnable = true;
            }
            catch (Exception ex)
            {
                throw new SerialPortException("SerialPort Open Error", ex);
            }

            OpenPortResponse response = new OpenPortResponse();

            response.CompleteRunAfter(request);
            return(response);
        }
        public OpenPortResponse OpenPort(OpenPortRequest request)
        {
            Stopwatch cron = new Stopwatch();

            cron.Start();

            OpenPortResponse response = new OpenPortResponse();

            try
            {
                // double value = 23.0 / 0.0;
                response.Content = System.IO.File.ReadAllBytes(request.Filename);
                response.Success = true;
            }
            catch (Exception ex)
            {
                //response.Exception = ex;
                response.ExceptionMessage = ex.Message;
                response.Success          = false;

                var errDto = new ErrorDto();
                errDto.Message    = ex.Message;
                errDto.Severity   = 2;
                errDto.StackTrace = ex.StackTrace;
                throw new FaultException <ErrorDto>(errDto,
                                                    new FaultReason(ex.Message));
            }
            finally
            {
                cron.Stop();
                response.Interval = cron.Elapsed;
            }

            return(response);
        }