adafruit / Adafruit_CircuitPython_BLE

Bluetooth Low Energy (BLE) library for CircuitPython
MIT License
127 stars 58 forks source link

Add Example for print text from ble UART #14

Closed dsiee closed 5 years ago

dsiee commented 5 years ago

There doesn't seem to be an example for this floating around that i could find, so here is one.

Takes a line from the uart_server, strips the formatting and prints the result. Could be useful for people implementing custom commands over UART as it shows the readline() function.

dhalbert commented 5 years ago

Hi - I'm not sure what you're sending from the client side. Are you using the BluefruitConnect app, and if so how? Are you using its UART functionality or sending something else?

dsiee commented 5 years ago

Yes, UART from the bluefruit app as it would be the most likely way Bluetooth would be used with circuit python. It should print any UART line just removing the first 3 and last two chars. This will work for any of the modes that send a UART message, mainly for the text, but also works for button presses returning their code. Would it be better if we just printed the whole UART message? On 11 Jul. 2019 07:39, Dan Halbert notifications@github.com wrote:Hi - I'm not sure what you're sending from the client side. Are you using the BluefruitConnect app, and if so how? Are you using its UART functionality or sending something else?

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.

dhalbert commented 5 years ago

I don't see that we have a separate packet type for raw text. The UART section in the iOS Bluefruit app just sends straight text, without any prefix bytes. So I'm confused about where the prefix bytes you mention are coming from. The color picker, etc. do have prefix bytes.

dsiee commented 5 years ago

Hmm, I was definitely getting extra characters using the Android Bluefruit App when just sending text. I will investigate further to check and perhaps just include the extra characters if it would be dropping wanted data for iOS.

On July 20, 2019 at 6:04 AM, Dan Halbert notifications@github.com wrote:

I don't see that we have a separate packet type for raw text. The UART section in the iOS Bluefruit app just sends straight text, without any prefix bytes. So I'm confused about where the prefix bytes you mention are coming from. The color picker, etc. do have prefix bytes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

dhalbert commented 5 years ago

Closing this for now, but happy to re-open if you would like to bring it up again.