Skip to content
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

GSM: do not check for __has_include in library main include #778

Merged
merged 1 commit into from
Dec 4, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libraries/GSM/src/GSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "GSM.h"
#include "GSMDebug.h"

#include "mbed.h"
#include "CellularLog.h"
Expand Down
24 changes: 1 addition & 23 deletions libraries/GSM/src/GSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,6 @@
#endif
#endif

#if defined __has_include
#if __has_include ("Arduino_DebugUtils.h")
#include "Arduino_DebugUtils.h"
#define GSM_DEBUG_ENABLE 1
#else
#define DEBUG_ERROR(fmt, ...)
#define DEBUG_WARNING(fmt, ...)
#define DEBUG_INFO(fmt, ...)
#define DEBUG_DEBUG(fmt, ...)
#define DEBUG_VERBOSE(fmt, ...)
#define GSM_DEBUG_ENABLE 0
#endif
#else
#define DEBUG_ERROR(fmt, ...)
#define DEBUG_WARNING(fmt, ...)
#define DEBUG_INFO(fmt, ...)
#define DEBUG_DEBUG(fmt, ...)
#define DEBUG_VERBOSE(fmt, ...)
#define GSM_DEBUG_ENABLE 0
#endif

namespace arduino {

typedef void* (*voidPrtFuncPtr)(void);
Expand Down Expand Up @@ -159,7 +138,6 @@ class GSMClass : public MbedSocketClass {
*/
const uint16_t _retry_timeout[6] = {1, 2, 4, 8, 16, 32};

#if GSM_DEBUG_ENABLE
static constexpr int RSSI_UNKNOWN = 99;
static const char * const sim_state_str[];
static const char * const reg_type_str[];
Expand All @@ -172,7 +150,7 @@ class GSMClass : public MbedSocketClass {
static const char * getSIMStateString(const mbed::CellularDevice::SimState state);
static const char * getRegistrationStateString(const mbed::CellularNetwork::RegistrationStatus state);
void onStatusChange(nsapi_event_t ev, intptr_t in);
#endif

void reset();
bool isReady(const int timeout = 5000);
};
Expand Down
1 change: 1 addition & 0 deletions libraries/GSM/src/GSMDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <GSM.h>
#include <GSMDebug.h>

#if GSM_DEBUG_ENABLE

Expand Down
44 changes: 44 additions & 0 deletions libraries/GSM/src/GSMDebug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
GSMDebug.h
Copyright (c) 2021 Arduino SA. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef GSMDEBUG_H
#define GSMDEBUG_H

#if defined __has_include
#if __has_include ("Arduino_DebugUtils.h")
#include "Arduino_DebugUtils.h"
#define GSM_DEBUG_ENABLE 1
#else
#define DEBUG_ERROR(fmt, ...)
#define DEBUG_WARNING(fmt, ...)
#define DEBUG_INFO(fmt, ...)
#define DEBUG_DEBUG(fmt, ...)
#define DEBUG_VERBOSE(fmt, ...)
#define GSM_DEBUG_ENABLE 0
#endif
#else
#define DEBUG_ERROR(fmt, ...)
#define DEBUG_WARNING(fmt, ...)
#define DEBUG_INFO(fmt, ...)
#define DEBUG_DEBUG(fmt, ...)
#define DEBUG_VERBOSE(fmt, ...)
#define GSM_DEBUG_ENABLE 0
#endif

#endif /* GSMDEBUG_H*/
Loading