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;
bool Read(CCECAdapterMessage &msg, uint32_t iTimeout = 1000);
bool ParseMessage(const CCECAdapterMessage &msg);
void SendMessageToAdapter(CCECAdapterMessage *msg);
- void WriteNextCommand(void);
void AddData(uint8_t *data, size_t iLen);
bool ReadFromDevice(uint32_t iTimeout, size_t iSize = 256);
bool WaitForAck(CCECAdapterMessage &message);
PLATFORM::ISocket * m_port;
CCECProcessor * m_processor;
PLATFORM::SyncedBuffer<CCECAdapterMessage *> m_inBuffer;
- PLATFORM::SyncedBuffer<CCECAdapterMessage *> m_outBuffer;
PLATFORM::CMutex m_mutex;
PLATFORM::CCondition<volatile bool> m_rcvCondition;
volatile bool m_bHasData;