if (CreateThread())
{
- m_controller->AddLog(CEC_LOG_DEBUG, "communication thread created");
+ m_startCondition.Wait(&m_mutex);
+ m_controller->AddLog(CEC_LOG_DEBUG, "communication thread started");
return true;
}
else
void CAdapterCommunication::Close(void)
{
CLockObject lock(&m_mutex);
- StopThread();
-
+ m_startCondition.Broadcast();
m_rcvCondition.Broadcast();
+ StopThread();
}
void *CAdapterCommunication::Process(void)
{
- m_controller->AddLog(CEC_LOG_DEBUG, "communication thread started");
+ {
+ CLockObject lock(&m_mutex);
+ m_startCondition.Signal();
+ }
while (!IsStopped())
{
bool CAdapterCommunication::IsOpen(void) const
{
- return !IsStopped() && m_port->IsOpen();
+ return !IsStopped() && m_port->IsOpen() && IsRunning();
}
using namespace std;
CCECProcessor::CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm, const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) :
- m_iLogicalAddress(iLogicalAddress),
+ m_iLogicalAddress(CECDEVICE_UNKNOWN),
m_strDeviceName(strDeviceName),
m_communication(serComm),
m_controller(controller),
CCECAdapterMessage msg;
CCECAdapterMessagePtr msgPtr;
+ m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress);
+
while (!IsStopped())
{
bool bParseFrame(false);