G
Guest
If I have understood this correctly, I should be able to receive data from a
Bluetooth device (like a GPS mouse) if I activate the incoming COM-port,
specified as COM4 on the HTC Himalaya. I am trying to test this using the
..NETCF V2 SerialPort class under C# (VS 2005 B2), but it don't seem to make
much sense...
if (myPort.BytesToRead > 0)
{
byte[] baInput = new byte[1000];
myPort.Read(baInput, 0, baInput.Length);
textBox1.Text = "Got sommit!";
myPort.DiscardInBuffer();
myPort.DiscardOutBuffer();
}
The above fails: BytesToRead consistantly returns 1583096 bytes (even more
for the BytesToSend !) and (at least the first 1000 bytes) it is all NULL
data - the DiscardInBuffer() method has zero effect!
Even wierder, this code runs if talking to COM5 (the BT outgoing port) but
throws an (undefined?) Exception when reading from COM4.
I'm not making much progress here... has anyone had more luck here?
Thanks for your support,
Peter Beedell
Bluetooth device (like a GPS mouse) if I activate the incoming COM-port,
specified as COM4 on the HTC Himalaya. I am trying to test this using the
..NETCF V2 SerialPort class under C# (VS 2005 B2), but it don't seem to make
much sense...
if (myPort.BytesToRead > 0)
{
byte[] baInput = new byte[1000];
myPort.Read(baInput, 0, baInput.Length);
textBox1.Text = "Got sommit!";
myPort.DiscardInBuffer();
myPort.DiscardOutBuffer();
}
The above fails: BytesToRead consistantly returns 1583096 bytes (even more
for the BytesToSend !) and (at least the first 1000 bytes) it is all NULL
data - the DiscardInBuffer() method has zero effect!
Even wierder, this code runs if talking to COM5 (the BT outgoing port) but
throws an (undefined?) Exception when reading from COM4.
I'm not making much progress here... has anyone had more luck here?
Thanks for your support,
Peter Beedell