I searched online but could not find anything close to my problem. I have an simple application that communicates with a PCB via bluetooth . There is nothing fancy or different about this PCB. Just straight forward read and write to COM. The problem is When I send a command it receives and replies back to me. I can write to port perfectly but i do not receive anything back. COnnection and other things are all set, and good. if i use a terminal application to send/receive thru COM, everything works perfectly. I tried many ways to read from COM but I get 0 byte. please see below. Any idea?
port = new SafeSerialPort(portName, 115200, Parity.None, 8, StopBits.One);
port.Write(data, 0, data.Length);
Once I sent this I can see in the terminal application(realterm) the device receives(I use device's debug port to see it) it and responds back (I can send my data from a terminal application, and get my response back. But not from my application). I even increased write/read timesouts still did not work out.
I tried various things as seen below. still no hope. I set even a delay. still nothing returns. all these returns null:
port.Read(dataBuffer, 0, dataBuffer.Length);
char b = (char)port.ReadChar();
byte be = (Byte)port.ReadByte();
var response = port.ReadExisting();//nothing
int dataLengt = port.BytesToRead;//returns 0