Exemplo n.º 1
0
        private AckResponse InternalSendRequest(EnqRequest request)
        {
            int    getValueLength = 0;
            string getstring      = null;

            var bytes = request.GetBytes();

            socket.Receive(getbyte, 0
                           , getbyte.Length, SocketFlags.None);
            getValueLength = byteArrayDefrag(getbyte);
            getstring      = Encoding.UTF7.GetString(getbyte, 0
                                                     , getValueLength + 1);

            //this._port.Write(bytes, 0, bytes.Length);

            //Thread.VolatileWrite(ref this._lastResponse, null);
            this._lastResponse = getbyte;
            //this._ar.WaitOne(SecondsToWait);

            if (this._lastResponse == null)
            {
                throw new Exception("Cannot connect to port!");
            }

            return((AckResponse)this._lastResponse);
        }
        public void ResetFaults()
        {
            var request = new EnqRequest();
            request.Ident = Identifiers.ResetFaults;

            var response = this.InternalSendRequest(request);
            this.CheckAck(response);
        }
        public void SendMessage(Message message)
        {
            var request = new EnqRequest();
            request.Ident = Identifiers.TransmitNonLibraryMessage;
            request.Data = message.GetBytes();

            var response = this.InternalSendRequest(request);
            this.CheckAck(response);
        }
        public void ShortShutDown()
        {
            var request = new EnqRequest();
            request.Ident = Identifiers.Power;
            request.Data = new byte[] { 0x01 };

            var response = this.InternalSendRequest(request);
            this.CheckAck(response);
        }
Exemplo n.º 5
0
        public void ResetFaults()
        {
            var request = new EnqRequest();

            request.Ident = Identifiers.ResetFaults;

            var response = this.InternalSendRequest(request);

            this.CheckAck(response);
        }
Exemplo n.º 6
0
        public void SendPartialMessage(PartialMessage message)
        {
            var request = new EnqRequest();

            request.Ident = Identifiers.TransmitPartialMessage;
            request.Data  = message.GetBytes();

            var response = this.InternalSendRequest(request);

            this.CheckAck(response);
        }
Exemplo n.º 7
0
        public void ShortShutDown()
        {
            var request = new EnqRequest();

            request.Ident = Identifiers.Power;
            request.Data  = new byte[] { 0x01 };

            var response = this.InternalSendRequest(request);

            this.CheckAck(response);
        }
Exemplo n.º 8
0
        public PrinterFaults RequestPrinterFaults()
        {
            var request = new EnqRequest();

            request.Ident = Identifiers.RequestPrinterFaults;

            var response = this.InternalSendRequest(request);

            this.CheckAck(response);
            return(new PrinterFaults(response.Data));
        }
Exemplo n.º 9
0
        public InkInfo RequestInkInfo()
        {
            var request = new EnqRequest();

            request.Ident = Identifiers.RequestInkCircuitSolenoidValve;

            var response = this.InternalSendRequest(request);

            this.CheckAck(response);
            return(new InkInfo(response.Data));
        }
Exemplo n.º 10
0
        public void TransmitMessageToPrint(byte headNumber, byte messageNumber)
        {
            var request = new EnqRequest();

            request.Ident = Identifiers.TransmitMessageNumber;
            request.Data  = new byte[] { headNumber, 0x00, messageNumber };

            var response = this.InternalSendRequest(request);

            this.CheckAck(response);
        }
Exemplo n.º 11
0
        private AckResponse InternalSendRequest(EnqRequest request)
        {
            var bytes = request.GetBytes();

            this._port.Write(bytes, 0, bytes.Length);

            Thread.VolatileWrite(ref this._lastResponse, null);
            this._ar.WaitOne(SecondsToWait);

            if (this._lastResponse == null)
            {
                throw new Exception("Cannot connect to port!");
            }

            return((AckResponse)this._lastResponse);
        }
        public void TransmitMessageToPrint(byte headNumber, byte messageNumber)
        {
            var request = new EnqRequest();
            request.Ident = Identifiers.TransmitMessageNumber;
            request.Data = new byte[] { headNumber, 0x00, messageNumber };

            var response = this.InternalSendRequest(request);
            this.CheckAck(response);
        }
        private AckResponse InternalSendRequest(EnqRequest request)
        {
            var bytes = request.GetBytes();
            this._port.Write(bytes, 0, bytes.Length);

            Thread.VolatileWrite(ref this._lastResponse, null);
            this._ar.WaitOne(SecondsToWait);

            if (this._lastResponse == null)
            {
                throw new Exception("Cannot connect to port!");
            }

            return (AckResponse)this._lastResponse;
        }
        public PrinterFaults RequestPrinterFaults()
        {
            var request = new EnqRequest();
            request.Ident = Identifiers.RequestPrinterFaults;

            var response = this.InternalSendRequest(request);
            this.CheckAck(response);
            return new PrinterFaults(response.Data);
        }
        public InkInfo RequestInkInfo()
        {
            var request = new EnqRequest();
            request.Ident = Identifiers.RequestInkCircuitSolenoidValve;

            var response = this.InternalSendRequest(request);
            this.CheckAck(response);
            return new InkInfo(response.Data);
        }