{
{
CLockObject lock(m_mutex);
- ReadFromDevice(50);
+ ReadFromDevice(5);
bCommandReceived = m_callback && Read(command, 0) && m_bInitialised;
}
pingTimeout.Init(CEC_ADAPTER_PING_TIMEOUT);
PingAdapter();
}
-
- if (!IsStopped())
- WriteNextCommand();
}
- /* notify all threads that are waiting on messages to be sent */
- CCECAdapterMessage *msg(NULL);
- while (m_outBuffer.Pop(msg))
- msg->event.Broadcast();
-
/* set the ackmask to 0 before closing the connection */
SetAckMaskInternal(0, true);
bool CUSBCECAdapterCommunication::Write(CCECAdapterMessage *data)
{
data->state = ADAPTER_MESSAGE_STATE_WAITING_TO_BE_SENT;
- m_outBuffer.Push(data);
+ SendMessageToAdapter(data);
data->event.Wait(5000);
if ((data->expectControllerAck && data->state != ADAPTER_MESSAGE_STATE_SENT_ACKED) ||
msg->event.Signal();
}
-void CUSBCECAdapterCommunication::WriteNextCommand(void)
-{
- CCECAdapterMessage *msg(NULL);
- if (m_outBuffer.Pop(msg))
- SendMessageToAdapter(msg);
-}
-
CStdString CUSBCECAdapterCommunication::GetPortName(void)
{
CStdString strName;
return retVal;
}
- Sleep(250); // TODO ReadFromDevice() isn't waiting for the timeout to pass on win32
ReadFromDevice(CEC_DEFAULT_TRANSMIT_WAIT, iResponseLength + 3 /* start + msgcode + iResponseLength + end */);
CCECAdapterMessage input;
if (Read(input, 0))