You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for a reusable-way to use the library in async. Started with the GsmWebClient example, I tried to rewrite the first call GSM::begin(PINNUMBER) into synchronized function. My attempt is to sub-class GSM as AsyncGSM, and send synchronous=false to begin(). The overloaded function will take a callback (pointer-to-function) so that when begin() finished (whether success or failed), it will callback the caller.
To my understanding, I should rewrite the following code from GSM::begin() in my overloaded function, and run the code via main loop().
unsigned long start = millis();
while (ready() == 0) {
if (_timeout && !((millis() - start) < _timeout)) {
_state = ERROR;
break;
}
delay(100);
}
However, I cannot access _timeout as it is a private variable instead of protected. I believe, the whole library should consider using protected over private, or provide both getters and setters, so that we can extend the library by sub-classing.
The text was updated successfully, but these errors were encountered:
Hi @sandeepmistry, I'd like to do that. When I've got the library works in async, then I'll make a pull request.
I'm able to make class GSM works aysnc. But MODEM.begin() is a synchronized function and it takes 10 seconds to completed. Can class MODEM works in async mode? Is there an async-version MODEM?
As a test or indicator, I blink the onboard LED using a Timer. It stops blinking when MODEM.begin() called, and resumes when MODEM.begin() returned.
I'm looking for a reusable-way to use the library in async. Started with the
GsmWebClient
example, I tried to rewrite the first callGSM::begin(PINNUMBER)
into synchronized function. My attempt is to sub-classGSM
asAsyncGSM
, and sendsynchronous=false
tobegin()
. The overloaded function will take a callback (pointer-to-function) so that whenbegin()
finished (whether success or failed), it will callback the caller.To my understanding, I should rewrite the following code from
GSM::begin()
in my overloaded function, and run the code via mainloop()
.However, I cannot access
_timeout
as it is a private variable instead of protected. I believe, the whole library should consider usingprotected
overprivate
, or provide both getters and setters, so that we can extend the library by sub-classing.The text was updated successfully, but these errors were encountered: