Movatterモバイル変換


[0]ホーム

URL:


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

Use mbed::callback for BLE event handler typedefs on ARDUINO_ARCH_MBED#352

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
DenebTM wants to merge1 commit intoarduino-libraries:master
base:master
Choose a base branch
Loading
fromDenebTM:master

Conversation

@DenebTM
Copy link

@DenebTMDenebTM commentedFeb 12, 2024
edited
Loading

This allows using capturing lambdas for BLE device and characteristic event handlers on Mbed OS-based devices, as required by a recent project of mine:

for (auto tup : senswarn_chars) {auto ble_char = std::get<BLEUnsignedCharCharacteristic*>(tup);auto val_ptr  = std::get<bool*>(tup);  ble_char->setEventHandler(      BLEWritten,      [val_ptr](BLEDevice central, BLECharacteristic characteristic) {bool warning_active = *characteristic.value() !=0;if (*val_ptr != warning_active) { *val_ptr = warning_active; }if (warning_active) { ch_any_warning_active.writeValue(true); }      });  sv_senswarn.addCharacteristic(*ble_char);}

Note: Perhaps a plainstd::function type is permissible here in general. I no longer have access to the hardware to test this, unfortunately.

This allows using capturing lambdas for BLE handlers on mbed-baseddevices.
@CLAassistant
Copy link

CLAassistant commentedFeb 12, 2024
edited
Loading

CLA assistant check
All committers have signed the CLA.

@per1234per1234 added type: enhancementProposed improvement topic: codeRelated to content of the project itself labelsFeb 12, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

topic: codeRelated to content of the project itselftype: enhancementProposed improvement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@DenebTM@CLAassistant@per1234

[8]ページ先頭

©2009-2025 Movatter.jp