zampino

zampino

Hello nervlers!

I’m trying to connect a bluetooth printer (thermal ESC/POS “driverless”) to a Raspberry Pi Zero 2 W.
Nerves on the RaspBerry and BlueHeron are working fine (at least with this commit :slight_smile:) and I can connect to the printer via the ATT Client (as per the govee lightbulb examples in BlueHeron repo).

But from there on I’m lost, and not sure if the ATT layer alone is sufficient for this task at all.
To start with, the Govee example uses a hardcoded handle (0x0015) in the BlueHeron.ATT.Client.write/3 which I don’t know where is coming from, so I tried the connection handle itself but that gave no outcome.

The point is: the printer peripheral requires an authentication step via a PIN to be paired with the central role.

  • Did anyone try/manage to pair a device via PIN with BlueHeron?
  • Does that correspond to integrate the SMP layer with the ATT client?
  • Can I convince my device to not require authentication?

In fact I can e.g. send data to the printer from mac OS only after first pairing it via its PIN:

This is an excerpt of the packet logs (via packetlogger) between macOS and the printer during pairing:

A lot of the mentioned packets (link policy, authentication requested, etc.) are present in the BlueHeron library but I wouldn’t know how/if they can be fitted into the ATT Client connection.

And these are the packets exchanged when I send data via a serial debugging tool from mac to the printer to have it print “hello”:

Mac OS seems to change the connection packet type (?) to RFCOMM, but the RFCOMM packet type is not mentioned at all in BlueHeron packets/modules, is there an alternative to that?

I’ll keep trying to integrate SMP, but any help around that would be much appreciated.
A big thank you to the maintainers of nerves and blue heron!!

Showing Posts 1 to 2

ConnorRigby

ConnorRigby

Nerves Core Team

To start with, the Govee example uses a hardcoded handle (0x0015) in the `BlueHeron.ATT.Client.write/3

This handle came from the ATT table. When that example was written, we didn’t have GATT support yet, so the hardcoded value was used.

You’re on the right track with SMP. I know that BlueHeron doesn’t currently support SMP for the ATT client, but it shouldn’t be that hard to add. It’s been a while since i looked in there, but the spec is pretty readable on how it should work. I think all of the required algorithms should be implemented already.

zampino

zampino OP

Turns out that was drastically false!

Again, it’s a matter of finding the correct characteristic handle as mentioned above.

I used a different bluetooth debugging tool (SmartBond for Mac OS) which is able to discover the services/characteristic tree of the device and send via ATT/L2CAP/ACL, bypassing SMP entirely.

I’m confused, but happy it worked.

I guess the missing link in the ATT Client in BlueHeron is implementing the ReadByTypeRequest/Response (hinted at here and here) messages to discover such a handle?

Hope this can turn out useful to others as well.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews