Ejemplo n.º 1
0
        public override void Connect(ConnectParametersCollection parameters)
        {
            try {
                if (!Connector.IsConnected)
                {
                    Connector.Connect();
#if DEBUG_PORTS
                    Debug.WriteLine("Connector: OPENED:");
                    Debug.WriteLine("Connector: start of call stack");
                    StackTrace trace = new StackTrace();
                    foreach (StackFrame frame in trace.GetFrames())
                    {
                        MethodBase meth = frame.GetMethod();
                        Debug.WriteLine(meth.DeclaringType.FullName + "." + meth.Name);
                    }
                    Debug.WriteLine("Connector: end of call stack");
#endif
                }

                Initialize();
            } catch (Exception ex) {
                Disconnect();
                throw new HardwareErrorException(new ErrorState(ErrorState.KitchenPrinterDisconnected, HardwareErrorSeverity.Error), ex);
            }
        }
        public override void Connect(ConnectParametersCollection parameters)
        {
            if (!Connector.IsConnected)
            {
                Connector.SetPortName(parameters);
                Connector.SetBaudRate(parameters);

                SetEncoding(WINDOWS_CYR_CODE_PAGE);
            }

            base.Connect(parameters);
        }
Ejemplo n.º 3
0
        public override void Connect(ConnectParametersCollection parameters)
        {
            try {
                try {
                    if (!Connector.IsConnected)
                    {
                        Connector.Connect();
                    }

                    Initialize();
                } catch (IOException ioex) {
                    throw new HardwareErrorException(new ErrorState(ErrorState.BadSerialPort, HardwareErrorSeverity.Error), ioex);
                } catch (UnauthorizedAccessException uaex) {
                    throw new HardwareErrorException(new ErrorState(ErrorState.BadSerialPort, HardwareErrorSeverity.Error), uaex);
                }
            } catch (Exception) {
                Disconnect();
                throw;
            }
        }
Ejemplo n.º 4
0
        public override void Connect(ConnectParametersCollection parameters)
        {
            try {
                if (!Connector.IsConnected)
                {
                    Connector.Connect();
                }

                if (messageTransceiver == null)
                {
                    messageTransceiver = new Thread(MessageTransceiver);
                    messageTransceiver.Start();
                }
                Initialize();
            } catch (IOException ioex) {
                throw new HardwareErrorException(new ErrorState(ErrorState.BadSerialPort, HardwareErrorSeverity.Error), ioex);
            } catch (UnauthorizedAccessException uaex) {
                throw new HardwareErrorException(new ErrorState(ErrorState.BadSerialPort, HardwareErrorSeverity.Error), uaex);
            }
        }
Ejemplo n.º 5
0
        public override void Connect(ConnectParametersCollection parameters)
        {
            try {
                try {
                    if (!Connector.IsConnected)
                    {
                        frameSeqNumber = 0x20;

                        Connector.Connect();
#if DEBUG_PORTS
                        Debug.WriteLine("Connector: OPENED:");
                        Debug.WriteLine("Connector: start of call stack");
                        StackTrace trace = new StackTrace();
                        foreach (StackFrame frame in trace.GetFrames())
                        {
                            MethodBase meth = frame.GetMethod();
                            Debug.WriteLine(meth.DeclaringType.FullName + "." + meth.Name);
                        }
                        Debug.WriteLine("Connector: end of call stack");
#endif
                    }

                    Initialize();

                    openCashDrawerEnabled = (bool)parameters [ConnectParameters.OpenDrawer];
                } catch (IOException ioex) {
                    throw new HardwareErrorException(new ErrorState(ErrorState.BadSerialPort, HardwareErrorSeverity.Error), ioex);
                } catch (UnauthorizedAccessException uaex) {
                    throw new HardwareErrorException(new ErrorState(ErrorState.BadSerialPort, HardwareErrorSeverity.Error), uaex);
                }
            } catch (Exception) {
                Disconnect();
                throw;
            }

            base.Connect(parameters);
        }
Ejemplo n.º 6
0
 protected void SetPassword(ConnectParametersCollection parameters)
 {
     operatorPassword = (string)parameters [ConnectParameters.Password];
 }
Ejemplo n.º 7
0
 public virtual void Connect(ConnectParametersCollection parameters)
 {
 }
Ejemplo n.º 8
0
 protected void SetEncoding(ConnectParametersCollection parameters)
 {
     SetEncoding((int)parameters [ConnectParameters.Encoding]);
 }
Ejemplo n.º 9
0
        public override void Connect(ConnectParametersCollection parameters)
        {
            printTotalOnly = (bool)parameters [ConnectParameters.PrintTotalOnly];

            base.Connect(parameters);
        }
 public void SetNetworkPort(ConnectParametersCollection parameters)
 {
     NetworkPort = (int)parameters [ConnectParameters.NetworkPort];
 }
 public void SetNetworkAddress(ConnectParametersCollection parameters)
 {
     NetworkAddress = (string)parameters [ConnectParameters.NetworkAddress];
 }
Ejemplo n.º 12
0
 public void SetBaudRate(ConnectParametersCollection parameters)
 {
     BaudRate = (int)parameters [ConnectParameters.BaudRate];
 }
Ejemplo n.º 13
0
 public void SetPortName(ConnectParametersCollection parameters)
 {
     PortName = (string)parameters [ConnectParameters.SerialPortName];
 }