Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BLERead event handler called twice? #272

Open
Labels
type: imperfectionPerceived defect in any part of project
@kk7ds

Description

I'm using an Arduino Nano RP2040 Connect with the NINA module. I've got a service that exposes some string characteristics that I want to feed a different value to each time they're read. I've set an eventhandler for BLERead, which is called. However, it seems to always be called twice on each read. I thought maybe this was a problem with the mobile app I'm writing, but I tried a BLE test/scanner app and each time I read the characteristic, the event handler is called twice.

Surely this is not intentional right? Am I doing something wrong that causes me to be called twice? I've looked through the AndroidBLE code a bit and I don't see any indication that I should be called twice. Even if I don't change the value, the handler is called twice.

Here's roughly what I'm doing:

void iter_temp_log(BLEDevice *central, BLECharacteristic c) {
 Serial.println("CALLED!");
}
void setup() {
 BLE.setLocalName("Remote Level");
 BLE.setAdvertisedService(levelservice);
 levelservice.addCharacteristic(templog);
 BLE.addService(levelservice);
 BLE.advertise();
 templog.setEventHandler(BLERead, iter_temp_log);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /