示例#1
0
        private IPrinterResponse Send(IPrinterRequest irequest)
        {
            if (irequest is FPURequest)
            {
                return(base.Send((FPURequest)irequest));
            }

            SlipResponse response = new SlipResponse();

            return(response);
        }
示例#2
0
        private IPrinterResponse Send(IPrinterRequest irequest)
        {
            //if (irequest is FPURequest) return base.Send((FPURequest)irequest);


            SlipResponse response = new SlipResponse();

            if (sp == null)
            {
                response.Detail = "serial port has not been initialized yet";
                return(response);
            }

            SlipRequest request = (SlipRequest)irequest;

            byte[] b = StringToByteArray(request.ToString());
            sp.Write(b, 0, b.Length);

            if (request.StatusCheck)
            {
                System.Threading.Thread.Sleep(100);
            }
            else
            {
                TimeSpan ts = DateTime.Now.Subtract(lastWRTime);
                if (ts.TotalMilliseconds < SLIP_DELAY)
                {
                    System.Threading.Thread.Sleep(SLIP_DELAY - (int)ts.TotalMilliseconds);
                }
            }

            lastWRTime = DateTime.Now;
            if (sp.BytesToRead > 0)
            {
                response = new SlipResponse(sp.ReadByte().ToString());
            }

            return(response);
        }
示例#3
0
        public IPrinterResponse CutPaper()
        {
            SlipResponse response = null;

            return(response);
        }
示例#4
0
        public IPrinterResponse Feed()
        {
            SlipResponse response = null;

            return(response);
        }