From ae54110f1dfbf0a0772ab6e849c80025381454cb Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 8 Mar 2012 15:19:44 +0100 Subject: [PATCH] cec: ping the adapter every 15 seconds. bugzid: 541 --- src/lib/adapter/USBCECAdapterCommunication.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/adapter/USBCECAdapterCommunication.cpp b/src/lib/adapter/USBCECAdapterCommunication.cpp index f56bdf4..85c92f3 100644 --- a/src/lib/adapter/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/USBCECAdapterCommunication.cpp @@ -40,6 +40,8 @@ using namespace std; using namespace CEC; using namespace PLATFORM; +#define CEC_ADAPTER_PING_TIMEOUT 15000 + void *CUSBCECAdapterProcessor::Process(void) { cec_command command; @@ -221,6 +223,7 @@ void *CUSBCECAdapterCommunication::Process(void) cec_command command; command.Clear(); bool bCommandReceived(false); + CTimeout pingTimeout(CEC_ADAPTER_PING_TIMEOUT); while (!IsStopped()) { { @@ -233,6 +236,13 @@ void *CUSBCECAdapterCommunication::Process(void) if (!IsStopped() && bCommandReceived) m_messageProcessor->AddCommand(command); + /* ping the adapter every 15 seconds */ + if (pingTimeout.TimeLeft() == 0) + { + pingTimeout.Init(CEC_ADAPTER_PING_TIMEOUT); + PingAdapter(); + } + if (!IsStopped()) { Sleep(5); -- 2.34.1