Skip to content

Commit 5db15c0

Browse files
Addressing Issue #552
While using platformio build system some new structures are not included in the final binary, for this reason it is required for concrete encoder and decoder for cbor commands to be referenced in files that are referenced by the sketch entrypoint
1 parent bc06ddc commit 5db15c0

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP()
7272
, _get_ota_confirmation{nullptr}
7373
#endif /* OTA_ENABLED */
7474
{
75-
75+
cbor::encoder::iotcloud::commandEncoders();
76+
cbor::decoder::iotcloud::commandDecoders();
7677
}
7778

7879
/******************************************************************************

src/cbor/IoTCloudMessageDecoder.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,13 @@ static ThingUpdateCommandDecoder thingUpdateCommandDecoder;
176176
static ThingDetachCommandDecoder thingDetachCommandDecoder;
177177
static LastValuesUpdateCommandDecoder lastValuesUpdateCommandDecoder;
178178
static TimezoneCommandDownDecoder timezoneCommandDownDecoder;
179+
180+
namespace cbor { namespace decoder { namespace iotcloud {
181+
void commandDecoders() {
182+
(void) otaUpdateCommandDecoder;
183+
(void) thingUpdateCommandDecoder;
184+
(void) thingDetachCommandDecoder;
185+
(void) lastValuesUpdateCommandDecoder;
186+
(void) timezoneCommandDownDecoder;
187+
}
188+
}}}

src/cbor/IoTCloudMessageDecoder.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,12 @@ class TimezoneCommandDownDecoder: public CBORMessageDecoderInterface {
6363
MessageDecoder::Status decode(CborValue* iter, Message *msg) override;
6464
};
6565

66+
namespace cbor { namespace decoder { namespace iotcloud {
67+
/**
68+
* Some link time optimization may exclude these classes to be instantiated
69+
* thus it may be required to reference them from outside of this file
70+
*/
71+
void commandDecoders();
72+
}}}
73+
6674
#endif /* ARDUINO_CBOR_MESSAGE_DECODER_H_ */

src/cbor/IoTCloudMessageEncoder.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,14 @@ static LastValuesBeginCommandEncoder lastValuesBeginCommandEncoder;
159159
static DeviceBeginCommandEncoder deviceBeginCommandEncoder;
160160
static OtaProgressCommandUpEncoder otaProgressCommandUpEncoder;
161161
static TimezoneCommandUpEncoder timezoneCommandUpEncoder;
162+
163+
namespace cbor { namespace encoder { namespace iotcloud {
164+
void commandEncoders() {
165+
(void) otaBeginCommandEncoder;
166+
(void) thingBeginCommandEncoder;
167+
(void) lastValuesBeginCommandEncoder;
168+
(void) deviceBeginCommandEncoder;
169+
(void) otaProgressCommandUpEncoder;
170+
(void) timezoneCommandUpEncoder;
171+
}
172+
}}}

src/cbor/IoTCloudMessageEncoder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,12 @@ class TimezoneCommandUpEncoder: public CBORMessageEncoderInterface {
7171
MessageEncoder::Status encode(CborEncoder* encoder, Message *msg) override;
7272
};
7373

74+
namespace cbor { namespace encoder { namespace iotcloud {
75+
/**
76+
* Some link time optimization may exclude these classes to be instantiated
77+
* thus it may be required to reference them from outside of this file
78+
*/
79+
void commandEncoders();
80+
}}}
7481

7582
#endif /* ARDUINO_CBOR_MESSAGE_ENCODER_H_ */

0 commit comments

Comments
 (0)