|
1 | 1 | // algoiot.cpp |
2 | | -// v20231205-1 |
| 2 | +// v20240415-1 |
3 | 3 |
|
4 | 4 | // Work in progress |
5 | 5 | // TODO: |
|
34 | 34 | #include "bip39enwords.h" // BIP39 english words to convert Algorand private key from mnemonics |
35 | 35 | #include "algoiot.h" |
36 | 36 |
|
37 | | -// #define LIB_DEBUGMODE |
| 37 | +#define LIB_DEBUGMODE |
38 | 38 | #define DEBUG_SERIAL Serial |
39 | 39 |
|
40 | 40 |
|
@@ -154,7 +154,7 @@ const char* AlgoIoT::getTransactionID() |
154 | 154 | // Public methods to add values to be written in the blockchain |
155 | 155 | // Strongly typed; this helps towards adding ARC-2/MessagePack in the future |
156 | 156 |
|
157 | | -int AlgoIoT::dataAddInt8Field(char* label, const int8_t value) |
| 157 | +int AlgoIoT::dataAddInt8Field(const char* label, const int8_t value) |
158 | 158 | { |
159 | 159 | int len = 0; |
160 | 160 |
|
@@ -183,7 +183,7 @@ int AlgoIoT::dataAddInt8Field(char* label, const int8_t value) |
183 | 183 | return ALGOIOT_NO_ERROR; |
184 | 184 | } |
185 | 185 |
|
186 | | -int AlgoIoT::dataAddUInt8Field(char* label, const uint8_t value) |
| 186 | +int AlgoIoT::dataAddUInt8Field(const char* label, const uint8_t value) |
187 | 187 | { |
188 | 188 | int len = 0; |
189 | 189 |
|
@@ -212,7 +212,7 @@ int AlgoIoT::dataAddUInt8Field(char* label, const uint8_t value) |
212 | 212 | return ALGOIOT_NO_ERROR; |
213 | 213 | } |
214 | 214 |
|
215 | | -int AlgoIoT::dataAddInt16Field(char* label, const int16_t value) |
| 215 | +int AlgoIoT::dataAddInt16Field(const char* label, const int16_t value) |
216 | 216 | { |
217 | 217 | int len = 0; |
218 | 218 |
|
@@ -241,7 +241,7 @@ int AlgoIoT::dataAddInt16Field(char* label, const int16_t value) |
241 | 241 | return ALGOIOT_NO_ERROR; |
242 | 242 | } |
243 | 243 |
|
244 | | -int AlgoIoT::dataAddUInt16Field(char* label, const uint16_t value) |
| 244 | +int AlgoIoT::dataAddUInt16Field(const char* label, const uint16_t value) |
245 | 245 | { |
246 | 246 | int len = 0; |
247 | 247 |
|
@@ -270,7 +270,7 @@ int AlgoIoT::dataAddUInt16Field(char* label, const uint16_t value) |
270 | 270 | return ALGOIOT_NO_ERROR; |
271 | 271 | } |
272 | 272 |
|
273 | | -int AlgoIoT::dataAddInt32Field(char* label, const int32_t value) |
| 273 | +int AlgoIoT::dataAddInt32Field(const char* label, const int32_t value) |
274 | 274 | { |
275 | 275 | int len = 0; |
276 | 276 |
|
@@ -299,7 +299,7 @@ int AlgoIoT::dataAddInt32Field(char* label, const int32_t value) |
299 | 299 | return ALGOIOT_NO_ERROR; |
300 | 300 | } |
301 | 301 |
|
302 | | -int AlgoIoT::dataAddUInt32Field(char* label, const uint32_t value) |
| 302 | +int AlgoIoT::dataAddUInt32Field(const char* label, const uint32_t value) |
303 | 303 | { |
304 | 304 | int len = 0; |
305 | 305 |
|
@@ -328,7 +328,7 @@ int AlgoIoT::dataAddUInt32Field(char* label, const uint32_t value) |
328 | 328 | return ALGOIOT_NO_ERROR; |
329 | 329 | } |
330 | 330 |
|
331 | | -int AlgoIoT::dataAddFloatField(char* label, const float value) |
| 331 | +int AlgoIoT::dataAddFloatField(const char* label, const float value) |
332 | 332 | { |
333 | 333 | int len = 0; |
334 | 334 |
|
@@ -357,7 +357,7 @@ int AlgoIoT::dataAddFloatField(char* label, const float value) |
357 | 357 | return ALGOIOT_NO_ERROR; |
358 | 358 | } |
359 | 359 |
|
360 | | -int AlgoIoT::dataAddShortStringField(char* label, char* shortCString) |
| 360 | +int AlgoIoT::dataAddShortStringField(const char* label, char* shortCString) |
361 | 361 | { |
362 | 362 | int len = 0; |
363 | 363 |
|
@@ -430,7 +430,7 @@ int AlgoIoT::submitTransactionToAlgorand() |
430 | 430 | #ifdef LIB_DEBUGMODE |
431 | 431 | DEBUG_SERIAL.println("\n Error initializing transaction MessagePack\n"); |
432 | 432 | #endif |
433 | | - return NULL; |
| 433 | + return ALGOIOT_MESSAGEPACK_ERROR; |
434 | 434 | } |
435 | 435 | iErr = prepareTransactionMessagePack(msgPackTx, fv, fee, PAYMENT_AMOUNT_MICROALGOS, notes, (uint16_t)notesLen); |
436 | 436 | if (iErr) |
|
0 commit comments