Skip to content

Commit a2e77b3

Browse files
committed
- README
1 parent a86fd34 commit a2e77b3

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,17 @@ Lesser General Public License for more details.
2424
You should have received a copy of the GNU Lesser General Public
2525
License along with this library; if not, write to the Free Software
2626
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27+
28+
29+
### ConnectionHandler
30+
31+
**Connection Handler** is configured via a series of compiler directives, including the correct implementation of the class based on which board is selected.
32+
33+
### How to use it
34+
- Instantiate the class with `ConnectionHandler conHandler(SECRET_SSID, SECRET_PASS);` if you are using a WiFi board, otherwise replace **WiFi** with **GSM** or any future implementation minding to carefully pass the init parameters to the constructor (i.e.: for the GSM you'll need to pass PIN, APN, login, password).
35+
36+
- The `update()` method does all the work. It uses a finite state machine and is responsible for connection and reconnection to a network. The method is designed to be non-blocking by using time (milliseconds) to perform its tasks.
37+
38+
- `&getClient()` returns a reference to an instance of the `Client` class used to connect to the network.
39+
40+
- `getStatus()` returns the network connection status. The different states are defined in an `enum`

src/Arduino_GSMConnectionHandler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ void GSMConnectionHandler::update() {
112112
init();
113113
}
114114
break;
115+
115116
case NetworkConnectionState::CONNECTING: {
116117
// NOTE: Blocking Call when 4th parameter == true
117118
GSM3_NetworkStatus_t networkStatus;
@@ -216,7 +217,7 @@ void GSMConnectionHandler::changeConnectionState(NetworkConnectionState _newStat
216217

217218

218219
void GSMConnectionHandler::connect() {
219-
if(netConnectionState == NetworkConnectionState::INIT || netConnectionState == NetworkConnectionState::CONNECTING){
220+
if (netConnectionState == NetworkConnectionState::INIT || netConnectionState == NetworkConnectionState::CONNECTING) {
220221
return;
221222
}
222223
keepAlive = true;
@@ -225,7 +226,7 @@ void GSMConnectionHandler::connect() {
225226
}
226227
void GSMConnectionHandler::disconnect() {
227228
//WiFi.end();
228-
229+
229230
changeConnectionState(NetworkConnectionState::DISCONNECTING);
230231
keepAlive = false;
231232
}

0 commit comments

Comments
 (0)