Skip to content

Commit 984b4fd

Browse files
committed
GSM: add isConnected() method
1 parent d8add39 commit 984b4fd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libraries/GSM/src/GSM.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ bool arduino::GSMClass::setTime(unsigned long const epoch, int const timezone)
130130
return _device->set_time(epoch, timezone);
131131
}
132132

133+
bool arduino::GSMClass::isConnected()
134+
{
135+
if (_context) {
136+
return _context->is_connected();
137+
} else {
138+
return false;
139+
}
140+
}
141+
133142
static PlatformMutex trace_mutex;
134143

135144
static void trace_wait()

libraries/GSM/src/GSM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class GSMClass : public MbedSocketClass {
9191
int ping(const char* hostname, uint8_t ttl = 128);
9292
int ping(const String& hostname, uint8_t ttl = 128);
9393
int ping(IPAddress host, uint8_t ttl = 128);
94+
bool isConnected();
9495

9596
friend class GSMClient;
9697
friend class GSMUDP;

0 commit comments

Comments
 (0)