From 02615b7dd78104556a48fe0008efff3a08e39d36 Mon Sep 17 00:00:00 2001 From: nmtoan91 Date: Mon, 30 Oct 2023 20:55:17 +0900 Subject: [PATCH] isNeedToBroadcastDiscoverImmediately --- examples/bridge-app/echonetlinux/EchonetDevicesManager.cpp | 3 ++- examples/bridge-app/echonetlinux/EchonetDevicesManager.h | 4 +++- examples/bridge-app/echonetlinux/main.cpp | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/bridge-app/echonetlinux/EchonetDevicesManager.cpp b/examples/bridge-app/echonetlinux/EchonetDevicesManager.cpp index 85148c2cda1fe0..26a777efc49ae1 100644 --- a/examples/bridge-app/echonetlinux/EchonetDevicesManager.cpp +++ b/examples/bridge-app/echonetlinux/EchonetDevicesManager.cpp @@ -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(); diff --git a/examples/bridge-app/echonetlinux/EchonetDevicesManager.h b/examples/bridge-app/echonetlinux/EchonetDevicesManager.h index 99e938cfd7048e..f90e41ab2d13c0 100644 --- a/examples/bridge-app/echonetlinux/EchonetDevicesManager.h +++ b/examples/bridge-app/echonetlinux/EchonetDevicesManager.h @@ -195,7 +195,9 @@ class EchonetDevicesManager map, EchonetEndpoint*> endpoints; OnAEchonetEndpointAddedDelegate onAEchonetEndpointAddedDelegate; OnAEchonetEndpointRemovedDelegate onAEchonetEndpointRemovedDelegate; - + public: + bool isNeedToBroadcastDiscoverImmediately = false; + public: EchonetDevicesManager(); int numDevices; diff --git a/examples/bridge-app/echonetlinux/main.cpp b/examples/bridge-app/echonetlinux/main.cpp index c92fcfedfa51bf..7b31040ce28c82 100644 --- a/examples/bridge-app/echonetlinux/main.cpp +++ b/examples/bridge-app/echonetlinux/main.cpp @@ -697,6 +697,10 @@ void * bridge_polling_thread(void * context) printf("=======================================\n\n"); } + else if(ch == 'b') + { + EchonetDevicesManager::GetInstance()->isNeedToBroadcastDiscoverImmediately = true; + } continue; }