Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] BLE Basic Infrastructure #788

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open

[WIP] BLE Basic Infrastructure #788

wants to merge 58 commits into from

Conversation

bakerstu
Copy link
Owner

No description provided.

balazsracz and others added 24 commits July 6, 2024 23:04
…bakerstu-ble-basics

* origin/bracz-databuffer-read-api:
  Adds more convenient read API to databuffer.
Changes the client objects to be constant in memory address instead of being moved around.
…roper

ownership of objects when BLE client / connections get removed.
for ownership by the client object.
Refactors the send function to be an std::function instead of a subclass.
Adds accessor for an abstract protocol engine instead.
Rewrites conditions in move read pointer forward, because it was incorrect.
- Handles the case when the src or dst buffer is empty.
- Detects when the append happens exactly at a buffer boundary and the
  buffers are already linked buffer.
- Adds a parameter that makes this work even when the link is not there yet
This fixes a buffer refcount bug when a buffer ended up with a zero length
and too few refs.
- MTU < 500.
- do_write needs to be repeated, so we call it via the executor.
We took over o.free_ but this makes the current buffer appendable, which is wrong.
@@ -60,6 +62,10 @@ public:
///
using SendFunction = std::function<void(const uint8_t *data, size_t len)>;

/// How big can a single attribute write be? ESP's BLE implementation says
/// 600 bytes. We keep some buffer.
static constexpr size_t MAX_BYTES_PER_WRITE = 500;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, ble core specification is 512b. I'd likely drop to ~450b as a default (or move to a config constant)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is apparently also an MTU negotiation happening after the connection gets established. So this likely won't work just as is. Then the negiatiated MTU is not the maximum value that you can transmit, because there is some protocol headers as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants