I have a cash register and I communicate with it on a low level. So, the idea is the following. The fiscal printer has got fiscal memory. IN this memory it records everything you've sold. But before I make a sale I want to check if this memory is full, cos I'll have problems with registring the sale. How do I do this? By sending a request that return something and with this something the state of the printer. So I write the following funcion that sends data.
FiscalPrinters.DatecsFP1000 fiscal = new FiscalPrinters.DatecsFP1000();
if(serialPort.IsOpen == false)
serialPort.Write(fiscal.izpratiKomanda(0x3E, 0x20), 0, fiscal.izpratiKomanda(0x3E, 0x20).Length);
I leave the port opened to recieve the data. I use a program to monitor the communication. The data sended is:
01 24 20 3E 05 30 30 38 37 03 in HEX
The recieved data is:
01 3C 20 3E 33 30 2D 30 38 2D 31 30 20 30 39 3A
35 38 3A 32 30 04 88 80 C0 86 86 92 05 30 37 35 in Hex
and in string 30-08-10 it gives me the date. Which means everything in the sent command is OK :).
So, to read this line, which contains a control bit, that says is there free memory in the printer, I've written the following functuin attaced to a SerialPort DataRecieved event.
But the event eider doesn't trigger, or throws the following exception:
The I/O operation has been aborted because of either a thread exit or an application request.
What am I doing wrong?