Skip to content

Commit 6f9780f

Browse files
authored
Merge pull request #314 from sivar2311/master
Reverting 2.10.4 back to 2.10.3
2 parents 6717276 + 47db29b commit 6f9780f

File tree

5 files changed

+15
-26
lines changed

5 files changed

+15
-26
lines changed

changelog.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# Changelog
2-
## Version 2.10.4
3-
- Implemented std::function for RangeController to allow lambda functions
4-
52
## Version 2.10.3
63
- Fixed version number for PlatformIO library registry
74

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"maintainer": true
1414
}
1515
],
16-
"version": "2.10.4",
16+
"version": "2.10.3",
1717
"frameworks": "arduino",
1818
"platforms": [
1919
"espressif8266",

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SinricPro
2-
version=2.10.4
2+
version=2.10.3
33
author=Boris Jaeger <[email protected]>
44
maintainer=Boris Jaeger <[email protected]>
55
sentence=Library for https://sinric.pro - simple way to connect your device to alexa

src/Capabilities/RangeController.h

+12-20
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,25 @@ FSTR(RANGE, rangeValueDelta); // "rangeValueDelta"
2727
* @snippet callbacks.cpp onRangeValue
2828
**/
2929

30-
using GenericRangeValueCallback_int = std::function<bool(const String &, const String &, int &)>;
31-
using GenericRangeValueCallback_float = std::function<bool(const String &, const String &, float &)>;
30+
using GenericRangeValueCallback_int = bool (*)(const String &, const String &, int &);
31+
using GenericRangeValueCallback_float = bool (*)(const String &, const String &, float &);
3232

3333
struct GenericRangeValueCallback {
3434
GenericRangeValueCallback() : type(type_unknown) {}
35-
GenericRangeValueCallback(GenericRangeValueCallback_int cb) : type(type_int), callback(cb) {}
36-
GenericRangeValueCallback(GenericRangeValueCallback_float cb) : type(type_float), callback(cb) {}
37-
~GenericRangeValueCallback() {};
38-
GenericRangeValueCallback& operator=(const GenericRangeValueCallback& other) { this->callback = other.callback; this->type = other.type; return *this; };
35+
GenericRangeValueCallback(GenericRangeValueCallback_int cb) : type(type_int), cb_int(cb) {}
36+
GenericRangeValueCallback(GenericRangeValueCallback_float cb) : type(type_float), cb_float(cb) {}
3937
enum {
4038
type_unknown,
4139
type_int,
4240
type_float
4341
} type;
44-
union Callback {
45-
Callback() {};
46-
Callback(const GenericRangeValueCallback_int& cb) : cb_int(cb) {};
47-
Callback(const GenericRangeValueCallback_float& cb) : cb_float(cb) {};
48-
Callback& operator=(const Callback& other) { cb_int = other.cb_int; return *this; }
49-
~Callback(){};
50-
42+
union {
5143
GenericRangeValueCallback_int cb_int;
5244
GenericRangeValueCallback_float cb_float;
53-
} callback;
45+
};
5446
};
5547

56-
using SetRangeValueCallback = std::function<bool(const String &, int &)>;
48+
using SetRangeValueCallback = bool (*)(const String &, int &);
5749

5850
/**
5951
* @brief Callback definition for onRangeValue function on a specific instance
@@ -87,7 +79,7 @@ using SetRangeValueCallback = std::function<bool(const String &, int &)>;
8779
* @section AdjustRangeValueCallback Example-Code
8880
* @snippet callbacks.cpp onAdjustRangeValue
8981
**/
90-
using AdjustRangeValueCallback = std::function<bool(const String&, int&)>;
82+
using AdjustRangeValueCallback = bool (*)(const String &, int &);
9183

9284
/**
9385
* @brief Callback definition for onAdjustRangeValue function on a specific instance for custom devices
@@ -280,14 +272,14 @@ bool RangeController<T>::handleRangeController(SinricProRequest &request) {
280272

281273
if (cb.type == GenericRangeValueCallback::type_float) {
282274
float value = request.request_value[FSTR_RANGE_rangeValue];
283-
success = cb.callback.cb_float(device->deviceId, request.instance, value);
275+
success = cb.cb_float(device->deviceId, request.instance, value);
284276
request.response_value[FSTR_RANGE_rangeValue] = value;
285277
return success;
286278
}
287279

288280
if (cb.type == GenericRangeValueCallback::type_int) {
289281
int value = request.request_value[FSTR_RANGE_rangeValue];
290-
success = cb.callback.cb_int(device->deviceId, request.instance, value);
282+
success = cb.cb_int(device->deviceId, request.instance, value);
291283
request.response_value[FSTR_RANGE_rangeValue] = value;
292284
return success;
293285
}
@@ -311,14 +303,14 @@ bool RangeController<T>::handleRangeController(SinricProRequest &request) {
311303

312304
if (cb.type == GenericRangeValueCallback::type_float) {
313305
float value = request.request_value[FSTR_RANGE_rangeValueDelta];
314-
success = cb.callback.cb_float(device->deviceId, request.instance, value);
306+
success = cb.cb_float(device->deviceId, request.instance, value);
315307
request.response_value[FSTR_RANGE_rangeValue] = value;
316308
return success;
317309
}
318310

319311
if (cb.type == GenericRangeValueCallback::type_int) {
320312
int value = request.request_value[FSTR_RANGE_rangeValueDelta];
321-
success = cb.callback.cb_int(device->deviceId, request.instance, value);
313+
success = cb.cb_int(device->deviceId, request.instance, value);
322314
request.response_value[FSTR_RANGE_rangeValue] = value;
323315
return success;
324316
}

src/SinricProVersion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Version Configuration
77
#define SINRICPRO_VERSION_MAJOR 2
88
#define SINRICPRO_VERSION_MINOR 10
9-
#define SINRICPRO_VERSION_REVISION 4
9+
#define SINRICPRO_VERSION_REVISION 3
1010
#define SINRICPRO_VERSION STR(SINRICPRO_VERSION_MAJOR) "." STR(SINRICPRO_VERSION_MINOR) "." STR(SINRICPRO_VERSION_REVISION)
1111
#define SINRICPRO_VERSION_STR "SinricPro (v" SINRICPRO_VERSION ")"
1212
#define SINRICPRO_VERISON_INT SINRICPRO_VERSION_MAJOR * 1000000 + SINRICPRO_VERSION_MINOR * 1000 + SINRICPRO_VERSION_REVISION

0 commit comments

Comments
 (0)