Author Topic: [BitCloud] End device StartNetworkReq  (Read 1383 times)

0 Members and 1 Guest are viewing this topic.

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
[BitCloud] End device StartNetworkReq
« on: May 06, 2016, 06:42:34 am »
Hi!

I'm doing now some test on my network with one ED and a C.
ED is polling periodically C to check if the connection is still alive or not.

If I stop the C (unpower it), ED receives ZDO_NETWORK_LOST_STATUS through ZDO_MgmtNwkUpdateNotf. That's great.
However when I restart the C (power it again, so it starts from scratch), ED is just don't want to realise it. In spite of my app (ED) constantly trying to ZDO_StartNetworkReq if the state is APP_STARTING_NETWORK_STATE (exactly like in WSNDemo). I waited 10 minutes, and nothing happened. CS_END_DEVICE_SLEEP_PERIOD is 60000.

If I reinit the ED with
Code: [Select]
PDS_DeleteAll(false);
HAL_WarmReset();

it can start the network succesfully.

What would be nice to check for investigate this one?

Thanks!
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11234
  • Country: us
    • Personal site
Re: [BitCloud] End device StartNetworkReq
« Reply #1 on: May 06, 2016, 06:58:06 am »
You need to wait for ZDO_NETWORK_LEFT_STATUS. ZDO_NETWORK_LOST_STATUS is just a notification that network is lost and stack will attempt to fix stuff. But technically (all the internal states) stack is still in the network.

I'm also pretty sure that ZDO_StartNetworkReq() in that case will return ZDO_INVALID_REQUEST or similar error code.
Alex
 

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] End device StartNetworkReq
« Reply #2 on: May 06, 2016, 07:26:05 am »
I see. Thank you.

So it's a very bad design idea from me to use ZDO_StartNetworkReq right after ZDO_NETWORK_LOST_STATUS.

2 questions remained:
1.) if I call ZDO_StartNetworkReq when ZDO_NETWORK_LOST_STATUS is received, is it possible that I prevent the stack to gracefully leave the network and reinit it? (It seems)
2.) The right way seems to do nothing when ZDO_NETWORK_LOST_STATUS is received but wait for ZDO_NETWORK_LEFT_STATUS. Can I be sure that after getting LOST status, also LEFT_STATUS will arrive sooner or later?


Thank you
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11234
  • Country: us
    • Personal site
Re: [BitCloud] End device StartNetworkReq
« Reply #3 on: May 06, 2016, 07:31:18 am »
1.) if I call ZDO_StartNetworkReq when ZDO_NETWORK_LOST_STATUS is received, is it possible that I prevent the stack to gracefully leave the network and reinit it? (It seems)
I'd need to check the code, but again, I'm pretty sure that ZDO_StartNetworkReq() will be confirmed with an error code and nothing bad will happen, stack will continue doing what it was doing, and ZDO_NETWORK_LEFT_STATUS will be called eventually.

2.) The right way seems to do nothing when ZDO_NETWORK_LOST_STATUS is received but wait for ZDO_NETWORK_LEFT_STATUS. Can I be sure that after getting LOST status, also LEFT_STATUS will arrive sooner or later?
Yes, 100%.

And if you are absolutely don't want to wait, there is ZDO_ResetNetworkReq(). That will bring everything into initial state no matter what stack is doing at the moment. But there should be no reason to use this at all.
Alex
 

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] End device StartNetworkReq
« Reply #4 on: May 06, 2016, 07:35:42 am »
Thank you.

I'm totally okay with waiting after ZDO_NETWORK_LOST_STATUS.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf