Skip to content

Commit

Permalink
isNeedToBroadcastDiscoverImmediately
Browse files Browse the repository at this point in the history
  • Loading branch information
nmtoan91 committed Oct 30, 2023
1 parent e36e427 commit 02615b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/bridge-app/echonetlinux/EchonetDevicesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ void * FindEchonetDevices_Thread(void * context)
sleep(1);
commutativeRequestAllDevices+=1;
commutativeGetData+=1;
if(commutativeRequestAllDevices>=threadholdRequestAllDevices)
if(manager->isNeedToBroadcastDiscoverImmediately || commutativeRequestAllDevices>=threadholdRequestAllDevices)
{
manager->isNeedToBroadcastDiscoverImmediately = false;
printf("Triggering request all EchonetLITE node instance list \n");
commutativeRequestAllDevices=0;
NodeProfile::Getter(NodeProfile::ECHO_CLASS_CODE, NodeProfile::INSTANCE_CODE, EchoSocket::MULTICAST_ADDRESS).reqGetSelfNodeInstanceListS().send();
Expand Down
4 changes: 3 additions & 1 deletion examples/bridge-app/echonetlinux/EchonetDevicesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ class EchonetDevicesManager
map<pair<string,unsigned int>, EchonetEndpoint*> endpoints;
OnAEchonetEndpointAddedDelegate onAEchonetEndpointAddedDelegate;
OnAEchonetEndpointRemovedDelegate onAEchonetEndpointRemovedDelegate;

public:
bool isNeedToBroadcastDiscoverImmediately = false;

public:
EchonetDevicesManager();
int numDevices;
Expand Down
4 changes: 4 additions & 0 deletions examples/bridge-app/echonetlinux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@ void * bridge_polling_thread(void * context)

printf("=======================================\n\n");
}
else if(ch == 'b')
{
EchonetDevicesManager::GetInstance()->isNeedToBroadcastDiscoverImmediately = true;
}
continue;
}

Expand Down

0 comments on commit 02615b7

Please sign in to comment.