27
27
28
28
ConnectionHandler::ConnectionHandler (bool const keep_alive)
29
29
: _keep_alive{keep_alive}
30
- , _netConnectionState {NetworkConnectionState::INIT}
30
+ , _current_net_connection_state {NetworkConnectionState::INIT}
31
31
, _lastConnectionTickTime{millis ()}
32
32
{
33
33
@@ -40,40 +40,40 @@ ConnectionHandler::ConnectionHandler(bool const keep_alive)
40
40
NetworkConnectionState ConnectionHandler::check ()
41
41
{
42
42
unsigned long const now = millis ();
43
- unsigned int const connectionTickTimeInterval = CHECK_INTERVAL_TABLE[static_cast <unsigned int >(_netConnectionState )];
43
+ unsigned int const connectionTickTimeInterval = CHECK_INTERVAL_TABLE[static_cast <unsigned int >(_current_net_connection_state )];
44
44
45
45
if ((now - _lastConnectionTickTime) > connectionTickTimeInterval)
46
46
{
47
47
_lastConnectionTickTime = now;
48
48
49
- switch (_netConnectionState )
49
+ switch (_current_net_connection_state )
50
50
{
51
- case NetworkConnectionState::INIT: _netConnectionState = update_handleInit (); break ;
52
- case NetworkConnectionState::CONNECTING: _netConnectionState = update_handleConnecting (); break ;
53
- case NetworkConnectionState::CONNECTED: _netConnectionState = update_handleConnected (); break ;
54
- case NetworkConnectionState::DISCONNECTING: _netConnectionState = update_handleDisconnecting (); break ;
55
- case NetworkConnectionState::DISCONNECTED: _netConnectionState = update_handleDisconnected (); break ;
56
- case NetworkConnectionState::ERROR: break ;
57
- case NetworkConnectionState::CLOSED: break ;
51
+ case NetworkConnectionState::INIT: _current_net_connection_state = update_handleInit (); break ;
52
+ case NetworkConnectionState::CONNECTING: _current_net_connection_state = update_handleConnecting (); break ;
53
+ case NetworkConnectionState::CONNECTED: _current_net_connection_state = update_handleConnected (); break ;
54
+ case NetworkConnectionState::DISCONNECTING: _current_net_connection_state = update_handleDisconnecting (); break ;
55
+ case NetworkConnectionState::DISCONNECTED: _current_net_connection_state = update_handleDisconnected (); break ;
56
+ case NetworkConnectionState::ERROR: break ;
57
+ case NetworkConnectionState::CLOSED: break ;
58
58
}
59
59
}
60
60
61
- return _netConnectionState ;
61
+ return _current_net_connection_state ;
62
62
}
63
63
64
64
void ConnectionHandler::connect ()
65
65
{
66
- if (_netConnectionState != NetworkConnectionState::INIT && _netConnectionState != NetworkConnectionState::CONNECTING)
66
+ if (_current_net_connection_state != NetworkConnectionState::INIT && _current_net_connection_state != NetworkConnectionState::CONNECTING)
67
67
{
68
68
_keep_alive = true ;
69
- _netConnectionState = NetworkConnectionState::INIT;
69
+ _current_net_connection_state = NetworkConnectionState::INIT;
70
70
}
71
71
}
72
72
73
73
void ConnectionHandler::disconnect ()
74
74
{
75
75
_keep_alive = false ;
76
- _netConnectionState = NetworkConnectionState::DISCONNECTING;
76
+ _current_net_connection_state = NetworkConnectionState::DISCONNECTING;
77
77
}
78
78
79
79
void ConnectionHandler::addCallback (NetworkConnectionEvent const event, OnNetworkEventCallback callback)
0 commit comments