summaryrefslogtreecommitdiff
path: root/digital/beacon/src/network.c
diff options
context:
space:
mode:
authorFlorent Duchon2012-05-16 17:15:50 +0200
committerFlorent Duchon2012-05-16 17:43:10 +0200
commita55506ba721610388545ff868d291caffe95f49f (patch)
tree7061d4783dca93661a3b1e21f40cbc9dfd96a633 /digital/beacon/src/network.c
parent3d2da1ff79576010ede40a87679b75dd421db819 (diff)
digital/beacon: Improve deconnection/reconnection state machine
Diffstat (limited to 'digital/beacon/src/network.c')
-rw-r--r--digital/beacon/src/network.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/digital/beacon/src/network.c b/digital/beacon/src/network.c
index 51cb1ea2..eb334a89 100644
--- a/digital/beacon/src/network.c
+++ b/digital/beacon/src/network.c
@@ -144,7 +144,6 @@ void network_leave(void)
ZDO_MgmtLeaveReq_t *zdpLeaveReq = &leaveReq.req.reqPayload.mgmtLeaveReq;
APS_UnregisterEndpointReq_t unregEndpoint;
- appState = APP_NETWORK_LEAVING_STATE;
unregEndpoint.endpoint = endpointParams.simpleDescriptor->endpoint;
APS_UnregisterEndpointReq(&unregEndpoint);
@@ -164,9 +163,6 @@ void network_leave(void)
/* Leave network response */
void zdpLeaveResp(ZDO_ZdpResp_t *zdpResp)
{
- // Try to rejoin the network
- appState = APP_NETWORK_JOIN_REQUEST;
-
(void)zdpResp;
}
@@ -199,11 +195,7 @@ void ZDO_MgmtNwkUpdateNotf(ZDO_MgmtNwkUpdateNotf_t *nwkParams)
break;
case ZDO_NETWORK_LOST_STATUS:
{
- APS_UnregisterEndpointReq_t unregEndpoint;
- unregEndpoint.endpoint = endpointParams.simpleDescriptor->endpoint;
- APS_UnregisterEndpointReq(&unregEndpoint);
-
- // try to rejoin the network
+ network_leave();
appState = APP_NETWORK_JOIN_REQUEST;
break;
}
@@ -269,6 +261,7 @@ void APS_DataConf(APS_DataConf_t* confInfo)
if (MAX_RETRIES_BEFORE_REJOIN == retryCounter)
{
network_leave();
+ appState = APP_NETWORK_JOIN_REQUEST;
}
else
{