Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 10e5feb

Browse files
author
Mattia Bertorello
authored
Merge pull request #45 from eclipse1985/master
Fix dimmed typo
2 parents cb5dda0 + beebfc2 commit 10e5feb

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

src/ArduinoCloudThing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
#include "types/automation/CloudColoredLight.h"
3636
#include "types/automation/CloudContactSensor.h"
37-
#include "types/automation/CloudDimmeredLight.h"
37+
#include "types/automation/CloudDimmedLight.h"
3838
#include "types/automation/CloudLight.h"
3939
#include "types/automation/CloudMotionSensor.h"
4040
#include "types/automation/CloudSmartPlug.h"

src/types/automation/CloudDimmeredLight.h renamed to src/types/automation/CloudDimmedLight.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// a commercial license, send an email to [email protected].
1616
//
1717

18-
#ifndef CLOUDDIMMEREDLIGHT_H_
19-
#define CLOUDDIMMEREDLIGHT_H_
18+
#ifndef CLOUDDIMMEDLIGHT_H_
19+
#define CLOUDDIMMEDLIGHT_H_
2020

2121
/******************************************************************************
2222
INCLUDE
@@ -29,49 +29,49 @@
2929
/******************************************************************************
3030
CLASS DECLARATION
3131
******************************************************************************/
32-
class DimmeredLight {
32+
class DimmedLight {
3333
public:
3434
bool swi;
3535
float bri;
36-
DimmeredLight(bool swi, float bri): swi(swi), bri(bri) {
36+
DimmedLight(bool swi, float bri): swi(swi), bri(bri) {
3737
}
3838

39-
bool operator==(DimmeredLight & aLight) {
39+
bool operator==(DimmedLight & aLight) {
4040
return aLight.swi == swi && aLight.bri == bri;
4141
}
4242

43-
bool operator!=(DimmeredLight & aLight) {
43+
bool operator!=(DimmedLight & aLight) {
4444
return !(operator==(aLight));
4545
}
4646

4747
};
4848

49-
class CloudDimmeredLight : public ArduinoCloudProperty {
49+
class CloudDimmedLight : public ArduinoCloudProperty {
5050
private:
51-
DimmeredLight _value,
52-
_cloud_value;
51+
DimmedLight _value,
52+
_cloud_value;
5353

5454
public:
55-
CloudDimmeredLight() : _value(false, 0), _cloud_value(false, 0) {}
56-
CloudDimmeredLight(bool swi, float brightness) : _value(swi, brightness), _cloud_value(swi, brightness) {}
55+
CloudDimmedLight() : _value(false, 0), _cloud_value(false, 0) {}
56+
CloudDimmedLight(bool swi, float brightness) : _value(swi, brightness), _cloud_value(swi, brightness) {}
5757

5858
virtual bool isDifferentFromCloud() {
5959

6060
return _value != _cloud_value;
6161
}
6262

63-
CloudDimmeredLight& operator=(DimmeredLight aLight) {
63+
CloudDimmedLight& operator=(DimmedLight aLight) {
6464
_value.swi = aLight.swi;
6565
_value.bri = aLight.bri;
6666
updateLocalTimestamp();
6767
return *this;
6868
}
6969

70-
DimmeredLight getCloudValue() {
70+
DimmedLight getCloudValue() {
7171
return _cloud_value;
7272
}
7373

74-
DimmeredLight getValue() {
74+
DimmedLight getValue() {
7575
return _value;
7676
}
7777

@@ -118,4 +118,4 @@ class CloudDimmeredLight : public ArduinoCloudProperty {
118118
}
119119
};
120120

121-
#endif /* CLOUDDIMMEREDLIGHT_H_ */
121+
#endif /* CLOUDDIMMEDLIGHT_H_ */

test/src/test_decode.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "types/CloudWrapperString.h"
1717
#include "types/automation/CloudColoredLight.h"
1818
#include "types/automation/CloudContactSensor.h"
19-
#include "types/automation/CloudDimmeredLight.h"
19+
#include "types/automation/CloudDimmedLight.h"
2020
#include "types/automation/CloudLight.h"
2121
#include "types/automation/CloudMotionSensor.h"
2222
#include "types/automation/CloudSmartPlug.h"
@@ -191,21 +191,21 @@ SCENARIO("Arduino Cloud Properties are decoded", "[ArduinoCloudThing::decode]")
191191

192192
/************************************************************************************/
193193

194-
WHEN("A DimmeredLight property is changed via CBOR message") {
194+
WHEN("A DimmedLight property is changed via CBOR message") {
195195
GIVEN("CloudProtocol::V2") {
196196
ArduinoCloudThing thing;
197197
thing.begin();
198198

199-
CloudDimmeredLight light_test = CloudDimmeredLight(false, 0.0);
199+
CloudDimmedLight light_test = CloudDimmedLight(false, 0.0);
200200

201201
thing.addPropertyReal(light_test, "test", Permission::ReadWrite);
202202

203203
/* [{0: "test:swi", 4: true},{0: "test:bri", 2: 2.0}] = 83 A2 00 68 74 65 73 74 3A 73 77 69 04 F5 //A2 00 68 74 65 73 74 3A 62 72 69 02 FA 40 00 00 00 */
204204
uint8_t const payload[] = {0x82, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x73, 0x77, 0x69, 0x04, 0xF5, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x62, 0x72, 0x69, 0x02, 0xFA, 0x40, 0x00, 0x00, 0x00};
205205
thing.decode(payload, sizeof(payload) / sizeof(uint8_t));
206206

207-
DimmeredLight light_compare = DimmeredLight(true, 2.0);
208-
DimmeredLight value_light_test = light_test.getValue();
207+
DimmedLight light_compare = DimmedLight(true, 2.0);
208+
DimmedLight value_light_test = light_test.getValue();
209209
bool verify = (value_light_test == light_compare);
210210
REQUIRE(verify);
211211
REQUIRE(value_light_test.swi == light_compare.swi);

test/src/test_encode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ SCENARIO("Arduino Cloud Properties are encoded", "[ArduinoCloudThing::encode]")
149149

150150
/************************************************************************************/
151151

152-
WHEN("A 'DimmeredLight' property is added") {
152+
WHEN("A 'DimmedLight' property is added") {
153153
GIVEN("CloudProtocol::V2") {
154154
ArduinoCloudThing thing;
155155
thing.begin();
156156
encode(thing);
157157

158-
CloudDimmeredLight color_test = CloudDimmeredLight(true, 2.0);
158+
CloudDimmedLight color_test = CloudDimmedLight(true, 2.0);
159159
thing.addPropertyReal(color_test, "test", Permission::ReadWrite);
160160

161161
/* [{0: "test:swi", 4: true},{0: "test:hue", 2: 0.0},{0: "test:sat", 2: 0.0},{0: "test:bri", 2: 2.0}] = 83 A2 00 68 74 65 73 74 3A 73 77 69 04 F5 //A2 00 68 74 65 73 74 3A 68 75 65 02 FA 00 00 00 00 A2 00 68 74 65 73 74 3A 73 61 74 02 FA 00 00 00 00 A2 00 68 74 65 73 74 3A 62 72 69 02 FA 40 00 00 00 FF*/

0 commit comments

Comments
 (0)