public PrinterStatusFlags(Response response)
        {
            var flags = (Byte)response.GetInt32(0);

            this.HasPrinterErrors = flags != 0;
            this.PrinterNotReady = (flags & 0x01) == 0x01;
            this.OutOfPaper = (flags & 0x02) == 0x02;
            this.CoverOpened = (flags & 0x04) == 0x04;
            this.CutterError = (flags & 0x08) == 0x08;
            this.ConnectionError = (flags & 0x80) == 0x80;
        }
Beispiel #2
0
 public EcrStatusFlags(Response response)
 {
     this.FatalStatus = new FatalStatus((Byte)response.GetInt32(0));
     this.CurrentStatus = new CurrentStatus((UInt16)response.GetInt32(1));
     this.DocumentStatus = new DocumentStatus((Byte)response.GetInt32(2));
 }
 public ProtocolException(Response response)
     : base(String.Format(Resources.Protocol_Error, response.ErrorCode))
 {
     this.ErrorCode = response.ErrorCode;
 }
Beispiel #4
0
        public Response GetResponse(Request request)
        {
            WriteRequest(request.ToArray());

            var response = new Response(ReadResponse());

            if (request.PacketId != response.PacketId)
                throw new InvalidOperationException(Resources.Packet_Id_Differs);
            if (!response.IsCrcValid)
                throw new InvalidOperationException(Resources.Invalid_Response_CRC);
            if (response.ErrorCode != 0)
                throw new ProtocolException(response);

            return response;
        }