Skip to content

Debug macros replace direct calls to Arduino_DebugUtils #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 28 additions & 8 deletions src/ArduinoIoTCloud_Config.h → src/AIoTC_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,41 @@
a commercial license, send an email to [email protected].
*/

#ifndef ARDUINO_IOT_CLOUD_CONFIG_H_
#define ARDUINO_IOT_CLOUD_CONFIG_H_
#ifndef ARDUINO_AIOTC_CONFIG_H_
#define ARDUINO_AIOTC_CONFIG_H_

/******************************************************************************
* USER CONFIGURED DEFINES
* USER CONFIGURABLE DEFINES
******************************************************************************/

#ifndef OTA_STORAGE_SFU
#define OTA_STORAGE_SFU (0)
#endif

#ifndef DBG_ERROR
#define DBG_ERROR(fmt, ...) Debug.print(DBG_ERROR, fmt, ## __VA_ARGS__)
#endif

#ifndef DBG_WARNING
#define DBG_WARNING(fmt, ...) Debug.print(DBG_WARNING, fmt, ## __VA_ARGS__)
#endif

#ifndef DBG_INFO
#define DBG_INFO(fmt, ...) Debug.print(DBG_INFO, fmt, ## __VA_ARGS__)
#endif

#ifndef DBG_DEBUG
#define DBG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__)
#endif

#ifndef DBG_VERBOSE
#define DBG_VERBOSE(fmt, ...) Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__)
#endif

/******************************************************************************
* AUTOMATICALLY CONFIGURED DEFINES
******************************************************************************/

#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
#define OTA_STORAGE_SNU (1)
#else
Expand All @@ -38,10 +62,6 @@
#define OTA_STORAGE_SSU (0)
#endif

/******************************************************************************
* AUTOMATIC CONFIGURED DEFINES
******************************************************************************/

#if OTA_STORAGE_SFU || OTA_STORAGE_SSU || OTA_STORAGE_SNU
#define OTA_ENABLED (1)
#else
Expand All @@ -64,4 +84,4 @@
#define HAS_TCP
#endif

#endif /* ARDUINO_IOT_CLOUD_CONFIG_H_ */
#endif /* ARDUINO_AIOTC_CONFIG_H_ */
12 changes: 6 additions & 6 deletions src/ArduinoIoTCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ void ArduinoIoTCloudClass::printConnectionStatus(ArduinoIoTConnectionStatus stat
{
switch (status)
{
case ArduinoIoTConnectionStatus::IDLE: Debug.print(DBG_INFO, "Arduino IoT Cloud Connection status: IDLE"); break;
case ArduinoIoTConnectionStatus::ERROR: Debug.print(DBG_ERROR, "Arduino IoT Cloud Connection status: ERROR"); break;
case ArduinoIoTConnectionStatus::CONNECTING: Debug.print(DBG_INFO, "Arduino IoT Cloud Connection status: CONNECTING"); break;
case ArduinoIoTConnectionStatus::RECONNECTING: Debug.print(DBG_INFO, "Arduino IoT Cloud Connection status: RECONNECTING"); break;
case ArduinoIoTConnectionStatus::CONNECTED: Debug.print(DBG_INFO, "Arduino IoT Cloud Connection status: CONNECTED"); break;
case ArduinoIoTConnectionStatus::DISCONNECTED: Debug.print(DBG_ERROR, "Arduino IoT Cloud Connection status: DISCONNECTED"); break;
case ArduinoIoTConnectionStatus::IDLE: DBG_INFO ("Arduino IoT Cloud Connection status: IDLE"); break;
case ArduinoIoTConnectionStatus::ERROR: DBG_ERROR("Arduino IoT Cloud Connection status: ERROR"); break;
case ArduinoIoTConnectionStatus::CONNECTING: DBG_INFO ("Arduino IoT Cloud Connection status: CONNECTING"); break;
case ArduinoIoTConnectionStatus::RECONNECTING: DBG_INFO ("Arduino IoT Cloud Connection status: RECONNECTING"); break;
case ArduinoIoTConnectionStatus::CONNECTED: DBG_INFO ("Arduino IoT Cloud Connection status: CONNECTED"); break;
case ArduinoIoTConnectionStatus::DISCONNECTED: DBG_ERROR("Arduino IoT Cloud Connection status: DISCONNECTED"); break;
}
}
2 changes: 1 addition & 1 deletion src/ArduinoIoTCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* INCLUDE
******************************************************************************/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>

#include <Arduino_ConnectionHandler.h>
#include <Arduino_DebugUtils.h>
Expand Down
6 changes: 3 additions & 3 deletions src/ArduinoIoTCloudLPWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* INCLUDE
******************************************************************************/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>

#ifdef HAS_LORA

Expand Down Expand Up @@ -101,8 +101,8 @@ void ArduinoIoTCloudLPWAN::update()

void ArduinoIoTCloudLPWAN::printDebugInfo()
{
Debug.print(DBG_INFO, "***** Arduino IoT Cloud LPWAN - configuration info *****");
Debug.print(DBG_INFO, "Thing ID: %s", getThingId().c_str());
DBG_INFO("***** Arduino IoT Cloud LPWAN - configuration info *****");
DBG_INFO("Thing ID: %s", getThingId().c_str());
}

/******************************************************************************
Expand Down
22 changes: 11 additions & 11 deletions src/ArduinoIoTCloudTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* INCLUDE
******************************************************************************/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>

#ifdef HAS_TCP
#include <ArduinoIoTCloudTCP.h>
Expand Down Expand Up @@ -119,9 +119,9 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
_brokerPort = brokerPort;

#ifdef BOARD_HAS_ECCX08
if (!ECCX08.begin()) { Debug.print(DBG_ERROR, "Cryptography processor failure. Make sure you have a compatible board."); return 0; }
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { Debug.print(DBG_ERROR, "Cryptography processor read failure."); return 0; }
if (!CryptoUtil::reconstructCertificate(_eccx08_cert, getDeviceId(), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { Debug.print(DBG_ERROR, "Cryptography certificate reconstruction failure."); return 0; }
if (!ECCX08.begin()) { DBG_ERROR("Cryptography processor failure. Make sure you have a compatible board."); return 0; }
if (!CryptoUtil::readDeviceId(ECCX08, getDeviceId(), ECCX08Slot::DeviceId)) { DBG_ERROR("Cryptography processor read failure."); return 0; }
if (!CryptoUtil::reconstructCertificate(_eccx08_cert, getDeviceId(), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { DBG_ERROR("Cryptography certificate reconstruction failure."); return 0; }
_sslClient.setClient(_connection->getClient());
_sslClient.setEccSlot(static_cast<int>(ECCX08Slot::Key), _eccx08_cert.bytes(), _eccx08_cert.length());
#elif defined(BOARD_ESP)
Expand Down Expand Up @@ -219,10 +219,10 @@ int ArduinoIoTCloudTCP::connected()

void ArduinoIoTCloudTCP::printDebugInfo()
{
Debug.print(DBG_INFO, "***** Arduino IoT Cloud - configuration info *****");
Debug.print(DBG_INFO, "Device ID: %s", getDeviceId().c_str());
Debug.print(DBG_INFO, "Thing ID: %s", getThingId().c_str());
Debug.print(DBG_INFO, "MQTT Broker: %s:%d", _brokerAddress.c_str(), _brokerPort);
DBG_INFO("***** Arduino IoT Cloud - configuration info *****");
DBG_INFO("Device ID: %s", getDeviceId().c_str());
DBG_INFO("Thing ID: %s", getThingId().c_str());
DBG_INFO("MQTT Broker: %s:%d", _brokerAddress.c_str(), _brokerPort);
}

#if OTA_ENABLED
Expand Down Expand Up @@ -342,7 +342,7 @@ ArduinoIoTConnectionStatus ArduinoIoTCloudTCP::checkCloudConnection()
case ArduinoIoTConnectionStatus::DISCONNECTED: next_iot_status = ArduinoIoTConnectionStatus::RECONNECTING; break;
case ArduinoIoTConnectionStatus::CONNECTING:
{
Debug.print(DBG_INFO, "Arduino IoT Cloud connecting ...");
DBG_INFO("Arduino IoT Cloud connecting ...");
int const ret = connect();
if (ret == CONNECT_SUCCESS)
{
Expand All @@ -352,14 +352,14 @@ ArduinoIoTConnectionStatus ArduinoIoTCloudTCP::checkCloudConnection()
}
else if (ret == CONNECT_FAILURE_SUBSCRIBE)
{
Debug.print(DBG_ERROR, "ERROR - Please verify your THING ID");
DBG_ERROR("ERROR - Please verify your THING ID");
}
}
break;

case ArduinoIoTConnectionStatus::RECONNECTING:
{
Debug.print(DBG_INFO, "Arduino IoT Cloud reconnecting ...");
DBG_INFO("Arduino IoT Cloud reconnecting ...");
if (reconnect() == CONNECT_SUCCESS)
{
next_iot_status = ArduinoIoTConnectionStatus::CONNECTED;
Expand Down
2 changes: 1 addition & 1 deletion src/ArduinoIoTCloudTCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* INCLUDE
******************************************************************************/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>

#include <ArduinoIoTCloud.h>

Expand Down
2 changes: 1 addition & 1 deletion src/CloudSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* INCLUDE
******************************************************************************/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>

#ifndef HAS_LORA

Expand Down
2 changes: 1 addition & 1 deletion src/tls/BearSSLClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include <ArduinoECCX08.h>
Expand Down
2 changes: 1 addition & 1 deletion src/tls/BearSSLClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef _BEAR_SSL_CLIENT_H_
#define _BEAR_SSL_CLIENT_H_

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#ifndef BEAR_SSL_CLIENT_OBUF_SIZE
Expand Down
2 changes: 1 addition & 1 deletion src/tls/BearSSLTrustAnchors.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* INCLUDE
******************************************************************************/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "bearssl/bearssl_ssl.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_big_cbcdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_big_cbcenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_big_ctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_big_ctrcbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_big_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_big_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64_cbcdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64_cbcenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64_ctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64_ctrcbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct64_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct_cbcdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct_cbcenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct_ctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct_ctrcbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tls/bearssl/aes_ct_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

#include <ArduinoIoTCloud_Config.h>
#include <AIoTC_Config.h>
#ifdef BOARD_HAS_ECCX08

#include "inner.h"
Expand Down
Loading