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

Commit 7fbfe1f

Browse files
committed
Fix Astyle formatting
1 parent 081a5f6 commit 7fbfe1f

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/ArduinoCloudProperty.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#endif
2424

2525
static unsigned long getTimestamp() {
26-
return 0;
26+
return 0;
2727
}
2828

2929
/******************************************************************************
@@ -151,16 +151,16 @@ void ArduinoCloudProperty::appendAttributeReal(String value, String attributeNam
151151
}
152152

153153
void ArduinoCloudProperty::appendAttributeName(String attributeName, std::function<void (CborEncoder& mapEncoder)>appendValue, CborEncoder *encoder) {
154-
if(attributeName != ""){
154+
if (attributeName != "") {
155155
_attributeIdentifier++;
156156
}
157157
CborEncoder mapEncoder;
158158
cbor_encoder_create_map(encoder, &mapEncoder, 2);
159159
cbor_encode_int(&mapEncoder, static_cast<int>(CborIntegerMapKey::Name));
160160

161-
if(_lightPayload) {
161+
if (_lightPayload) {
162162
int completeIdentifier = _attributeIdentifier * 256;
163-
completeIdentifier += _identifier;
163+
completeIdentifier += _identifier;
164164
cbor_encode_int(&mapEncoder, completeIdentifier);
165165
} else {
166166
String completeName = _name;
@@ -204,13 +204,13 @@ void ArduinoCloudProperty::setAttributeReal(String& value, String attributeName)
204204
}
205205

206206
void ArduinoCloudProperty::setAttributeReal(String attributeName, std::function<void (CborMapData *md)>setValue) {
207-
if(attributeName != ""){
207+
if (attributeName != "") {
208208
_attributeIdentifier++;
209209
}
210210
for (int i = 0; i < _map_data_list->size(); i++) {
211211
CborMapData *map = _map_data_list->get(i);
212212
if (map != nullptr) {
213-
if(map->light_payload.isSet() && map->light_payload.get()) {
213+
if (map->light_payload.isSet() && map->light_payload.get()) {
214214
int attid = map->attribute_identifier.get();
215215
if (attid == _attributeIdentifier) {
216216
setValue(map);
@@ -225,7 +225,7 @@ void ArduinoCloudProperty::setAttributeReal(String attributeName, std::function<
225225
}
226226
}
227227
}
228-
228+
229229
}
230230

231231
String ArduinoCloudProperty::getAttributeName(String propertyName, char separator) {

src/ArduinoCloudThing.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ArduinoCloudProperty& ArduinoCloudThing::addPropertyReal(ArduinoCloudProperty &
9898
addProperty(&property, propertyIdentifier);
9999
return (property);
100100
}
101-
101+
102102
}
103103

104104
void ArduinoCloudThing::decode(uint8_t const * const payload, size_t const length, bool isSyncMessage) {
@@ -346,20 +346,20 @@ ArduinoCloudThing::MapParserState ArduinoCloudThing::handle_Name(CborValue * val
346346
int val = 0;
347347
if (cbor_value_get_int(value_iter, &val) == CborNoError) {
348348
map_data->light_payload.set(true);
349-
map_data->name_identifier.set(val&255);
350-
map_data->attribute_identifier.set(val>>8);
349+
map_data->name_identifier.set(val & 255);
350+
map_data->attribute_identifier.set(val >> 8);
351351
map_data->light_payload.set(true);
352352
String name = getPropertyNameByIdentifier(val);
353353
map_data->name.set(name);
354-
354+
355355

356356
if (cbor_value_advance(value_iter) == CborNoError) {
357357
next_state = MapParserState::MapKey;
358358
}
359359
}
360360
}
361361

362-
362+
363363

364364
return next_state;
365365
}
@@ -497,7 +497,7 @@ void ArduinoCloudThing::updateProperty(String propertyName, unsigned long cloudC
497497
// retrieve the property name by the identifier
498498
String ArduinoCloudThing::getPropertyNameByIdentifier(int propertyIdentifier) {
499499
ArduinoCloudProperty* property;
500-
if(propertyIdentifier>255) {
500+
if (propertyIdentifier > 255) {
501501
property = getProperty(propertyIdentifier & 255);
502502
} else {
503503
property = getProperty(propertyIdentifier);

src/ArduinoCloudThing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ArduinoCloudThing {
7878

7979
void begin();
8080

81-
ArduinoCloudProperty & addPropertyReal(ArduinoCloudProperty & property, String const & name, Permission const permission, int propertyIdentifier);
81+
ArduinoCloudProperty & addPropertyReal(ArduinoCloudProperty & property, String const & name, Permission const permission, int propertyIdentifier = -1);
8282

8383
/* encode return > 0 if a property has changed and encodes the changed properties in CBOR format into the provided buffer */
8484
int encode(uint8_t * data, size_t const size, bool lightPayload = false);
@@ -139,7 +139,7 @@ class ArduinoCloudThing {
139139
static double convertCborHalfFloatToDouble(uint16_t const half_val);
140140
void freeMapDataList(LinkedList<CborMapData *> * map_data_list);
141141
inline void addProperty(ArduinoCloudProperty * property_obj, int propertyIdentifier) {
142-
if(propertyIdentifier != -1) {
142+
if (propertyIdentifier != -1) {
143143
property_obj->setIdentifier(propertyIdentifier);
144144
} else {
145145
property_obj->setIdentifier(_numProperties);

test/src/test_decode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ SCENARIO("Arduino Cloud Properties are decoded", "[ArduinoCloudThing::decode]")
183183
}
184184
}
185185

186-
/************************************************************************************/
186+
/************************************************************************************/
187187

188188
WHEN("A Color property is changed via CBOR message - light payload") {
189189
GIVEN("CloudProtocol::V2") {

0 commit comments

Comments
 (0)