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

Commit ece700d

Browse files
ilcatoaentinger
authored andcommitted
Use base integer type
Internally encode and decode use int types.
1 parent 51f84ee commit ece700d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/types/automation/CloudTelevision.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/******************************************************************************
2929
ENUM
3030
******************************************************************************/
31-
enum class PlaybackCommands : uint8_t {
31+
enum class PlaybackCommands : int {
3232
FastForward = 0,
3333
Next = 1,
3434
Pause = 2,
@@ -39,7 +39,7 @@ enum class PlaybackCommands : uint8_t {
3939
Stop = 7,
4040
None = 255
4141
};
42-
enum class InputValue : uint8_t {
42+
enum class InputValue : int {
4343
AUX1 = 0,
4444
AUX2 = 1,
4545
AUX3 = 2,
@@ -110,14 +110,14 @@ enum class InputValue : uint8_t {
110110
class Television {
111111
public:
112112
bool swi;
113-
uint8_t vol;
113+
int vol;
114114
bool mut;
115115
PlaybackCommands pbc;
116116
InputValue inp;
117-
uint16_t cha;
117+
int cha;
118118

119119

120-
Television(bool const swi, uint8_t const vol, bool const mut, PlaybackCommands const pbc, InputValue const inp, uint16_t const cha): swi(swi), vol(vol), mut(mut), pbc(pbc), inp(inp), cha(cha) {
120+
Television(bool const swi, int const vol, bool const mut, PlaybackCommands const pbc, InputValue const inp, int const cha): swi(swi), vol(vol), mut(mut), pbc(pbc), inp(inp), cha(cha) {
121121
}
122122

123123
bool operator==(Television const & aTV) {
@@ -142,7 +142,7 @@ class CloudTelevision : public ArduinoCloudProperty {
142142
_cloud_value;
143143
public:
144144
CloudTelevision() : _value(false, 0, false, PlaybackCommands::None, InputValue::TV, 0), _cloud_value(false, 0, false, PlaybackCommands::None, InputValue::TV, 0) {}
145-
CloudTelevision(bool const swi, uint8_t const vol, bool const mut, PlaybackCommands const pbc, InputValue const inp, uint16_t const cha) : _value(swi, vol, mut, pbc, inp, cha), _cloud_value(swi, vol, mut, pbc, inp, cha) {}
145+
CloudTelevision(bool const swi, int const vol, bool const mut, PlaybackCommands const pbc, InputValue const inp, int const cha) : _value(swi, vol, mut, pbc, inp, cha), _cloud_value(swi, vol, mut, pbc, inp, cha) {}
146146

147147
virtual bool isDifferentFromCloud() {
148148

@@ -208,11 +208,11 @@ class CloudTelevision : public ArduinoCloudProperty {
208208
}
209209
virtual void setAttributesFromCloud() {
210210
setAttribute(_cloud_value.swi);
211-
setAttribute((int&)_cloud_value.vol);
211+
setAttribute(_cloud_value.vol);
212212
setAttribute(_cloud_value.mut);
213213
setAttribute((int&)_cloud_value.pbc);
214214
setAttribute((int&)_cloud_value.inp);
215-
setAttribute((int&)_cloud_value.cha);
215+
setAttribute(_cloud_value.cha);
216216
}
217217
};
218218

0 commit comments

Comments
 (0)