Skip to content

Detect BLE connection interval in sketch? #781

Answered by santatester
amowry asked this question in Q&A
Discussion options

You must be logged in to vote

I couldn't find it in any of the examples, but there is a 'getConnectionInterval' function that will give you the result you're looking for.

Here's the peripheral 'bleuart' example's connect_callback modified with the connection interval function:

void connect_callback(uint16_t conn_handle)
{
  // Get the reference to current connection
  BLEConnection* connection = Bluefruit.Connection(conn_handle);

  char central_name[32] = { 0 };
  uint16_t connIntvl = 0;

  connection->getPeerName(central_name, sizeof(central_name));

// Get the current connection agreed upon connection interval
  connIntvl = connection->getConnectionInterval();

  Serial.print("Connected to ");
  Serial.println(cent…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@amowry
Comment options

@santatester
Comment options

Answer selected by amowry
@amowry
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #779 on July 07, 2023 10:40.