Skip to content

Commit 9d35b94

Browse files
committed
GSM: allow to enable and disable AT messages trace
1 parent 5e507f0 commit 9d35b94

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

libraries/GSM/src/GSM.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
7575

7676
_device = _context->get_device();
7777

78+
_device->modem_debug_on(_at_debug);
79+
7880
_device->set_cmux_status_flag(_cmuxGSMenable);
7981

8082
_context->set_sim_pin(pin);

libraries/GSM/src/GSM.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class GSMClass : public MbedSocketClass {
110110
bool isCmuxEnable();
111111
#if MBED_CONF_MBED_TRACE_ENABLE
112112
void trace(Stream& stream);
113-
void setTraceLevel(int trace_level, bool timestamp = false);
113+
void setTraceLevel(int trace_level, bool timestamp = false, bool at_trace = false);
114114
#endif
115115
int ping(const char* hostname, uint8_t ttl = 128);
116116
int ping(const String& hostname, uint8_t ttl = 128);
@@ -133,6 +133,7 @@ class GSMClass : public MbedSocketClass {
133133
NetworkInterface* gsm_if = nullptr;
134134
mbed::CellularContext* _context = nullptr;
135135
mbed::CellularDevice* _device = nullptr;
136+
bool _at_debug = false;
136137
};
137138

138139
}

libraries/GSM/src/GSMTrace.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static void trace_println(const char* c) {
4747
}
4848
#endif
4949

50-
void arduino::GSMClass::setTraceLevel(int trace_level, bool timestamp) {
50+
void arduino::GSMClass::setTraceLevel(int trace_level, bool timestamp, bool at_trace) {
5151
#if MBED_CONF_MBED_TRACE_ENABLE
5252
switch(trace_level) {
5353
case 0: mbed_trace_config_set(TRACE_ACTIVE_LEVEL_NONE); break;
@@ -60,6 +60,8 @@ void arduino::GSMClass::setTraceLevel(int trace_level, bool timestamp) {
6060
default: mbed_trace_config_set(TRACE_ACTIVE_LEVEL_ALL); break;
6161
}
6262

63+
_at_debug = at_trace;
64+
6365
if (timestamp) {
6466
mbed_trace_prefix_function_set( &trace_time );
6567
}

0 commit comments

Comments
 (0)