Go Down

Topic: AT commands set? HCI? (Read 76 times) previous topic - next topic

dustystew

I'm looking for a sketch that implements either an AT command set, or HCI (Host Controller Interface) for the Nano 33 BLE.



Klaus_K

I'm looking for a sketch that implements either an AT command set, or HCI (Host Controller Interface) for the Nano 33 BLE.
Why? HCI is used by the library. If you want to see how, just look at the source code. But in most cases that should not be necessary especially not at the sketch level. Do you want to implement your own Host library?

dustystew

Why not?

OK I'll tell you. I am messing around with the idea of using this chip to emulate various protocols. Rather than buying fixed function devices. You know? They all do the same thing. Most of the time its just changing the command set. So far I have a command interpreter and about a dozen commands.

I have been poking around in the source code. It seems to be mostly abstraction, ie lots of code that does nothing. Still trying to figure that out what connects to what. There are no comments in the code, so one has to navigate here and there looking for where the code that actually does something resides.

I succeeded in finding where the advertising packets are assembled, and I understand that, and can see why various settings don't take effect until the advertise() method is called. But this fact is not specified in the documentation. So everyone who ever tries to do this probably has to waste yet another 15 minutes figuring it out.

I disagree with that design decision (re needing to stop/start advertising) so in my code (which I will publish here eventually), when a setting is made, it will stop advertising for a millisecond in order to change the parameter (eg localName) then restart advertising. So it just changes.









Klaus_K

OK I'll tell you. I am messing around with the idea of using this chip to emulate various protocols. Rather than buying fixed function devices. You know? They all do the same thing. Most of the time its just changing the command set. So far I have a command interpreter and about a dozen commands.
Fair enough. I just wanted to make sure you know what you are doing.

I disagree with that design decision (re needing to stop/start advertising) so in my code (which I will publish here eventually), when a setting is made, it will stop advertising for a millisecond in order to change the parameter (eg localName) then restart advertising. So it just changes.
Would it be easier to write a wrapper class and implement your additional abstraction on top of the ArduinoBLE library? This way you do not need to modify your code every time the library is changed and improved.

You could add value for user who do not want to focus on the BLE part and rather have a application level class e.g. a BLE heart rate monitor class. All they would need to do is create an instance, change the local name and then write the values.

dustystew

I think you make a good point re a wrapper class. I should do that eventually.

At the moment, I am working through all the methods for the BLE 5 classes. Since there isn't much documentation, I am searching for sketches, then modifying them to my needs. 

Right now I'm working through scanning for other devices. I found a good sketch that has provided a starting point. But so far, it's pretty flaky. When it works, great. But it most often doesn't connect or cannot discover attributes, and occasionally hangs. Sketch attached.


Go Up