Example #1
0
        private bool SlipReady()
        {
            IPrinterResponse response = Send(SlipRequest.CheckStatus(Part.SlipPaper));

            if (response.Detail == null)
            {
                throw new PrinterOfflineException();
            }
            if (response.Detail[6] == '1')//Slip is not detected by TOF sensor
            {
                response.Data = "Slip is not detected by TOF sensor";
                return(false);
            }

            if (response.Detail[5] == '1')//Slip is not detected by BOF sensor
            {
                response.Data = "Slip is not detected by BOF sensor";
                return(false);
            }

            if (response.Detail[3] == '1')//Waits for slip insertion
            {
                response.Data = "Waits for slip insertion";
                return(false);
            }
            return(true);
        }
Example #2
0
        internal bool CheckConnection()
        {
            if (sp == null)
            {
                return(true);
            }
            //asking slip is not for slip request,
            //it is only for to reach printer
            IPrinterResponse response = Send(SlipRequest.CheckStatus(Part.SlipPaper));

            if (response.Detail == null)
            {
                return(false);
            }
            return(true);
        }
Example #3
0
        private IPrinterResponse WriteLine(string line)
        {
            IPrinterResponse responseOffline = Send(SlipRequest.CheckStatus(Part.Offline));

            if (sp == null)
            {
                return(responseOffline);
            }

            if (responseOffline.Data == null && responseOffline.Detail == null)
            {
                throw new PowerFailureException();
            }
            if (!SlipReady())
            {
                DocumentRequested(new RequestSlipException(), new EventArgs());
                WaitForSlip();
            }
            return(Send(SlipRequest.WriteLine(line)));
        }