repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: abi fixes (binary compat with v1.2)
[deb_libcec.git]
/
src
/
lib
/
CECProcessor.cpp
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index df04a237edba78ba755928757ed72c6f0590a1bb..4d4abba2ac93cca0fc6c2ee9bebb1cd531fc93ca 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-42,15
+42,18
@@
#include "implementations/CECCommandHandler.h"
#include "LibCEC.h"
#include "CECClient.h"
#include "implementations/CECCommandHandler.h"
#include "LibCEC.h"
#include "CECClient.h"
+#include "CECTypeUtils.h"
#include "platform/util/timeutils.h"
#include "platform/util/timeutils.h"
+#include "platform/util/util.h"
using namespace CEC;
using namespace std;
using namespace PLATFORM;
#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
using namespace CEC;
using namespace std;
using namespace PLATFORM;
#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
+#define ACTIVE_SOURCE_CHECK_INTERVAL 500
-#define ToString(x)
m_libcec->
ToString(x)
+#define ToString(x)
CCECTypeUtils::
ToString(x)
CCECProcessor::CCECProcessor(CLibCEC *libcec) :
m_bInitialised(false),
CCECProcessor::CCECProcessor(CLibCEC *libcec) :
m_bInitialised(false),
@@
-66,7
+69,7
@@
CCECProcessor::CCECProcessor(CLibCEC *libcec) :
CCECProcessor::~CCECProcessor(void)
{
Close();
CCECProcessor::~CCECProcessor(void)
{
Close();
-
delete m_busDevices
;
+
DELETE_AND_NULL(m_busDevices)
;
}
bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = CEC_SERIAL_DEFAULT_BAUDRATE */, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
}
bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = CEC_SERIAL_DEFAULT_BAUDRATE */, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
@@
-98,21
+101,13
@@
void CCECProcessor::Close(void)
StopThread();
// close the connection
StopThread();
// close the connection
- if (m_communication)
- {
- delete m_communication;
- m_communication = NULL;
- }
+ DELETE_AND_NULL(m_communication);
}
void CCECProcessor::ResetMembers(void)
{
// close the connection
}
void CCECProcessor::ResetMembers(void)
{
// close the connection
- if (m_communication)
- {
- delete m_communication;
- m_communication = NULL;
- }
+ DELETE_AND_NULL(m_communication);
// reset the other members to the initial state
m_iStandardLineTimeout = 3;
// reset the other members to the initial state
m_iStandardLineTimeout = 3;
@@
-212,7
+207,8
@@
void *CCECProcessor::Process(void)
{
m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started");
{
m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started");
- cec_command command;
+ cec_command command; command.Clear();
+ CTimeout activeSourceCheck(ACTIVE_SOURCE_CHECK_INTERVAL);
// as long as we're not being stopped and the connection is open
while (!IsStopped() && m_communication->IsOpen())
// as long as we're not being stopped and the connection is open
while (!IsStopped() && m_communication->IsOpen())
@@
-228,6
+224,14
@@
void *CCECProcessor::Process(void)
// check if we need to replace handlers
ReplaceHandlers();
// check if we need to replace handlers
ReplaceHandlers();
+
+ // check whether we need to activate a source, if it failed before
+ if (activeSourceCheck.TimeLeft() == 0)
+ {
+ if (CECInitialised())
+ TransmitPendingActiveSourceCommands();
+ activeSourceCheck.Init(ACTIVE_SOURCE_CHECK_INTERVAL);
+ }
}
}
}
}
@@
-397,6
+401,7
@@
bool CCECProcessor::Transmit(const cec_command &data)
m_iLastTransmission = GetTimeMs();
// set the number of tries
iMaxTries = initiator->GetHandler()->GetTransmitRetries() + 1;
m_iLastTransmission = GetTimeMs();
// set the number of tries
iMaxTries = initiator->GetHandler()->GetTransmitRetries() + 1;
+ initiator->MarkHandlerReady();
}
// and try to send the command
}
// and try to send the command
@@
-514,7
+519,7
@@
bool CCECProcessor::StartBootloader(const char *strPort /* = NULL */)
if (comm->IsOpen())
{
bReturn = comm->StartBootloader();
if (comm->IsOpen())
{
bReturn = comm->StartBootloader();
-
delete comm
;
+
DELETE_AND_NULL(comm)
;
}
return bReturn;
}
}
return bReturn;
}
@@
-549,7
+554,9
@@
bool CCECProcessor::HandleReceiveFailed(cec_logical_address initiator)
bool CCECProcessor::SetStreamPath(uint16_t iPhysicalAddress)
{
// stream path changes are sent by the TV
bool CCECProcessor::SetStreamPath(uint16_t iPhysicalAddress)
{
// stream path changes are sent by the TV
- return GetTV()->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
+ bool bReturn = GetTV()->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
+ GetTV()->MarkHandlerReady();
+ return bReturn;
}
bool CCECProcessor::CanPersistConfiguration(void)
}
bool CCECProcessor::CanPersistConfiguration(void)
@@
-629,6
+636,9
@@
bool CCECProcessor::RegisterClient(CCECClient *client)
return false;
}
return false;
}
+ // ensure that we know the vendor id of the TV
+ GetTV()->GetVendorId(CECDEVICE_UNREGISTERED);
+
// unregister the client first if it's already been marked as registered
if (client->IsRegistered())
UnregisterClient(client);
// unregister the client first if it's already been marked as registered
if (client->IsRegistered())
UnregisterClient(client);
@@
-656,6
+666,10
@@
bool CCECProcessor::RegisterClient(CCECClient *client)
m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
{
m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
{
+ // set the physical address of the device at this LA
+ if (CLibCEC::IsValidPhysicalAddress(configuration.iPhysicalAddress))
+ (*it)->SetPhysicalAddress(configuration.iPhysicalAddress);
+
// replace a previous client
CLockObject lock(m_mutex);
m_clients.erase((*it)->GetLogicalAddress());
// replace a previous client
CLockObject lock(m_mutex);
m_clients.erase((*it)->GetLogicalAddress());
@@
-665,7
+679,7
@@
bool CCECProcessor::RegisterClient(CCECClient *client)
// get the settings from the rom
if (configuration.bGetSettingsFromROM == 1)
{
// get the settings from the rom
if (configuration.bGetSettingsFromROM == 1)
{
- libcec_configuration config;
+ libcec_configuration config;
config.Clear();
m_communication->GetConfiguration(config);
CLockObject lock(m_mutex);
m_communication->GetConfiguration(config);
CLockObject lock(m_mutex);
@@
-704,6
+718,15
@@
bool CCECProcessor::RegisterClient(CCECClient *client)
client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
}
client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
}
+ // ensure that the command handler for the TV is initialised
+ if (bReturn)
+ {
+ CCECCommandHandler *handler = GetTV()->GetHandler();
+ if (handler)
+ handler->InitHandler();
+ GetTV()->MarkHandlerReady();
+ }
+
return bReturn;
}
return bReturn;
}