Skip to content

Commit 7e7121d

Browse files
committed
Restructuring connect/disconnect
1 parent ff99572 commit 7e7121d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Arduino_NBConnectionHandler.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@ NetworkConnectionState NBConnectionHandler::check() {
143143
return _netConnectionState;
144144
}
145145

146+
void NBConnectionHandler::connect()
147+
{
148+
if (_netConnectionState != NetworkConnectionState::INIT && _netConnectionState != NetworkConnectionState::CONNECTING)
149+
{
150+
_keep_alive = true;
151+
changeConnectionState(NetworkConnectionState::INIT);
152+
}
153+
}
154+
155+
void NBConnectionHandler::disconnect()
156+
{
157+
changeConnectionState(NetworkConnectionState::DISCONNECTING);
158+
_keep_alive = false;
159+
}
160+
161+
146162
/******************************************************************************
147163
PRIVATE MEMBER FUNCTIONS
148164
******************************************************************************/
@@ -194,20 +210,4 @@ void NBConnectionHandler::changeConnectionState(NetworkConnectionState _newState
194210
_netConnectionState = _newState;
195211
}
196212

197-
198-
void NBConnectionHandler::connect() {
199-
if (_netConnectionState == NetworkConnectionState::INIT || _netConnectionState == NetworkConnectionState::CONNECTING) {
200-
return;
201-
}
202-
_keep_alive = true;
203-
changeConnectionState(NetworkConnectionState::INIT);
204-
205-
}
206-
void NBConnectionHandler::disconnect() {
207-
//WiFi.end();
208-
209-
changeConnectionState(NetworkConnectionState::DISCONNECTING);
210-
_keep_alive = false;
211-
}
212-
213-
#endif /* #ifdef BOARD_HAS_NB */
213+
#endif /* #ifdef BOARD_HAS_NB */

0 commit comments

Comments
 (0)