Serial port: How to know when data has been completely sent
Suppose I have a thread sending bytes out the serial port(COM1: That 9pin D connector). Suppose I have to keep sending something or the other continuously because I cannot keep the medium idle because my wireless system requires that some thing be present all the time...
So I want to continuously send zeroes if any other data is not there. But I cannot just fill the buffer with tons of zeroes because I don't know whether the previous filler zeroes that I tried to send have been sent completely.
Note: I am currently using CreateFile() ReadFile() and WriteFile() functions.
1) How do I know whether the data I pushed in have been completely sent so that I can fill zeroes/send data if that is available?
2)Is there any way to get the OS to call a callback fn when data previously pushed has been sent so that I can fill new data