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

New Write mehod for characteristics #368

Closed
wants to merge 2 commits into from

Conversation

fabik111
Copy link
Contributor

The current writeValue method, used for writing the the value of a characteristic, returns an integer value.
This value is used as a Boolean to indicate the success or the failure of the writing operation, without giving any indication about the amount of bytes actually transferred (in case of subscription) or "loaded" into the characteristic (in case of a readable characteristic).
Considering that the MTU, the amount of transferable data, is decided by the central and varies device by device, it is impossible for the user to determinate how many bytes are transferred and upon that to take an action.
In this PR a write method is added that returns the number of bytes transferred. The new method supports all the typed characteristics and also the String characteristic and is equally powerful as the writeValue method.
It works both when the device is in peripheral and central mode.

@CLAassistant
Copy link

CLAassistant commented Sep 23, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

Memory usage change @ 73efcc6

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 🔺 0 - +64 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 +8 - +8 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:megaavr:uno2018:mode=on 🔺 +52 - +52 +0.11 - +0.11 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi 🔺 +16 - +32 +0.01 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 🔺 +8 - +8 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot 🔺 +8 - +8 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Central/LedControl
flash
% examples/Central/LedControl
RAM for global variables
% examples/Central/PeripheralExplorer
flash
% examples/Central/PeripheralExplorer
RAM for global variables
% examples/Central/Scan
flash
% examples/Central/Scan
RAM for global variables
% examples/Central/ScanCallback
flash
% examples/Central/ScanCallback
RAM for global variables
% examples/Central/SensorTagButton
flash
% examples/Central/SensorTagButton
RAM for global variables
% examples/Peripheral/Advertising/EnhancedAdvertising
flash
% examples/Peripheral/Advertising/EnhancedAdvertising
RAM for global variables
% examples/Peripheral/Advertising/RawDataAdvertising
flash
% examples/Peripheral/Advertising/RawDataAdvertising
RAM for global variables
% examples/Peripheral/BatteryMonitor
flash
% examples/Peripheral/BatteryMonitor
RAM for global variables
% examples/Peripheral/ButtonLED
flash
% examples/Peripheral/ButtonLED
RAM for global variables
% examples/Peripheral/CallbackLED
flash
% examples/Peripheral/CallbackLED
RAM for global variables
% examples/Peripheral/EncryptedBatteryMonitor
flash
% examples/Peripheral/EncryptedBatteryMonitor
RAM for global variables
% examples/Peripheral/LED
flash
% examples/Peripheral/LED
RAM for global variables
%
arduino:mbed_nano:nano33ble 0 0.0 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 0 0.0 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 0 0.0 0 0.0 64 0.01 0 0.0
arduino:mbed_nano:nanorp2040connect 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0
arduino:megaavr:uno2018:mode=on 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0 52 0.11 0 0.0
arduino:renesas_uno:unor4wifi 32 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 32 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 32 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 32 0.01 0 0.0
arduino:samd:mkrwifi1010 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0
arduino:samd:nano_33_iot 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0
Click for full report CSV
Board,examples/Central/LedControl<br>flash,%,examples/Central/LedControl<br>RAM for global variables,%,examples/Central/PeripheralExplorer<br>flash,%,examples/Central/PeripheralExplorer<br>RAM for global variables,%,examples/Central/Scan<br>flash,%,examples/Central/Scan<br>RAM for global variables,%,examples/Central/ScanCallback<br>flash,%,examples/Central/ScanCallback<br>RAM for global variables,%,examples/Central/SensorTagButton<br>flash,%,examples/Central/SensorTagButton<br>RAM for global variables,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>flash,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>RAM for global variables,%,examples/Peripheral/Advertising/RawDataAdvertising<br>flash,%,examples/Peripheral/Advertising/RawDataAdvertising<br>RAM for global variables,%,examples/Peripheral/BatteryMonitor<br>flash,%,examples/Peripheral/BatteryMonitor<br>RAM for global variables,%,examples/Peripheral/ButtonLED<br>flash,%,examples/Peripheral/ButtonLED<br>RAM for global variables,%,examples/Peripheral/CallbackLED<br>flash,%,examples/Peripheral/CallbackLED<br>RAM for global variables,%,examples/Peripheral/EncryptedBatteryMonitor<br>flash,%,examples/Peripheral/EncryptedBatteryMonitor<br>RAM for global variables,%,examples/Peripheral/LED<br>flash,%,examples/Peripheral/LED<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,0,0.0,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,0,0.0,0,0.0,64,0.01,0,0.0
arduino:mbed_nano:nanorp2040connect,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0
arduino:megaavr:uno2018:mode=on,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0,52,0.11,0,0.0
arduino:renesas_uno:unor4wifi,32,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,32,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,32,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,32,0.01,0,0.0
arduino:samd:mkrwifi1010,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0
arduino:samd:nano_33_iot,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Sep 23, 2024
@fabik111 fabik111 closed this Oct 3, 2024
@per1234 per1234 self-assigned this Oct 3, 2024
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants