question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent data received (Bluetooth classic, RFComm, Serialport)

See original GitHub issue

Hi, I am trying to connect to a medica device using Visual Studio + MAUI + InTheHand.Net.Bluetooth.

I successfully pair the device, then connect using the BluetoothService.SerialPort service, but whatever I receive is:

CALL c4:62:ea:98:ce:08 1103 RFCOMM

where c4:62:ea:98:ce:08 is the address of my device. If I try to connect using BluetoothService.DialupNetworking (1103) the connection do not succeed. What I do is:

stream = client.GetStream();
StreamWriter sw = new StreamWriter(stream, System.Text.Encoding.ASCII); (this will be needed later)
StreamReader sr = new StreamReader(stream, System.Text.Encoding.ASCII);
char[] buffer = new char[10000];
await sr.ReadAsync(buffer, 0, (int)stream.Length);

Is something I am doing wrong?

Thanks, Michele

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ajay-mundicommented, Dec 9, 2022

Hello Enrique and Michele,

Enrique I also tried using your approach (was a lot nicer than mine lol), but still can’t seem to read anything from the stream. Not really sure what I am doing with this bluetooth stuff to be honest. Having a MAUI cross platform sample in this repo would be really helpful.

1reaction
mdimacommented, Dec 9, 2022

Thank you Enrique, I tried to use the same pattern you used here: https://github.com/inthehand/32feet/issues/252 to read from the device, but the result doesn’t change at all.

About your issue, I am experiencing the same problem. The “.Connected” property gets false only after a read timeout, even if I turn off the device after I connect it.

Regards, Michele

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bluetooth communication using serialports and windows ...
My best guess is that RFCOMM refers to Serial Port Profile SPP, which basically emulates serial port through the Bluetooth.
Read more >
Inconsistent values with Bluetooth and Serial.Read
I have gotten Arduino to Arduino communication setup. However I am getting inconsistent values when printing the incoming master data.
Read more >
Bluetooth Framework and RFCOMM Protocol
Bluetooth Framework natively supports Bluetooth Classic RFCOMM protocol in client and server modes. That means that Bluetooth Framework can act as RFCOMM client ......
Read more >
Can't use Bluetooth COM ports from Windows 10
1 Answer. The first thing to mention is that rfcomm was deprecated back in 2017 by the BlueZ project so if you are...
Read more >
Strange behaviour using serial port and bluetooth
I'm trying to connect via serial port, a wearable device to a processing IDE using ... Once this is done, if I use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found