You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API is harder to use than it needs to be. E.g. cannot write:
BLECharacteristic myCharacteristic(...);
// ...
myCharacteristic.setValue(2.5F); // Error here
Error: no instance of overloaded function "BLECharacteristic::setValue" matches the argument list
This is because the function requires a reference to a value, which cannot be created from the temporary 2.5F value.
You instead have to do:
BLECharacteristic myCharacteristic(...);
// ...float tempFloat = 2.5F;
myCharacteristic.setValue(tempFloat; // OK
This is OK for a couple of calls, but if you're setting lots of values it gets very messy.
Describe the solution you'd like
Change the function signatures to either take arguments by value or by const reference:
// oldvoidsetValue(uint32_t &data32);
// new - valuevoidsetValue(uint32_t data32);
// new - const referencevoidsetValue(constuint32_t &data32);
This should apply to all the overloads: uint16_t, uint32_t, int, float, double.
Since the code already just immediately copies everything into a uint8_t[] or other temporary value I don't think this will affect how it works. It also shouldn't break any existing use of the API.
As such, cost of implementing this should be minimal.
Describe alternatives you've considered
Workaround with temporary variables. Works OK but gets messy as number of variables increases.
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
I confirm I have checked existing list of Feature requests and Contribution Guide.
The text was updated successfully, but these errors were encountered:
Related area
BLE API
Hardware specification
Shouldn't depend on specific hardware
Is your feature request related to a problem?
API is harder to use than it needs to be. E.g. cannot write:
Error:
no instance of overloaded function "BLECharacteristic::setValue" matches the argument list
This is because the function requires a reference to a value, which cannot be created from the temporary
2.5F
value.You instead have to do:
This is OK for a couple of calls, but if you're setting lots of values it gets very messy.
Describe the solution you'd like
Change the function signatures to either take arguments by value or by const reference:
This should apply to all the overloads:
uint16_t
,uint32_t
,int
,float
,double
.Since the code already just immediately copies everything into a
uint8_t[]
or other temporary value I don't think this will affect how it works. It also shouldn't break any existing use of the API.As such, cost of implementing this should be minimal.
Describe alternatives you've considered
Workaround with temporary variables. Works OK but gets messy as number of variables increases.
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
The text was updated successfully, but these errors were encountered: