cec: removed m_outBuffer in CUSBCECAdapterCommunication. bugzid: 654
[deb_libcec.git] / src / lib / adapter / USBCECAdapterCommunication.cpp
index c1645d047e37a35791a55674585aec4594409947..fb6f26707ab06c53f5bd5c5600dd433b0b10ef0d 100644 (file)
@@ -224,7 +224,7 @@ void *CUSBCECAdapterCommunication::Process(void)
   {
     {
       CLockObject lock(m_mutex);
-      ReadFromDevice(50);
+      ReadFromDevice(5);
       bCommandReceived = m_callback && Read(command, 0) && m_bInitialised;
     }
 
@@ -238,16 +238,8 @@ void *CUSBCECAdapterCommunication::Process(void)
       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);
 
@@ -304,7 +296,7 @@ cec_adapter_message_state CUSBCECAdapterCommunication::Write(const cec_command &
 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) ||
@@ -962,13 +954,6 @@ void CUSBCECAdapterCommunication::SendMessageToAdapter(CCECAdapterMessage *msg)
   msg->event.Signal();
 }
 
-void CUSBCECAdapterCommunication::WriteNextCommand(void)
-{
-  CCECAdapterMessage *msg(NULL);
-  if (m_outBuffer.Pop(msg))
-    SendMessageToAdapter(msg);
-}
-
 CStdString CUSBCECAdapterCommunication::GetPortName(void)
 {
   CStdString strName;
@@ -1026,7 +1011,6 @@ cec_datapacket CUSBCECAdapterCommunication::GetSetting(cec_adapter_messagecode m
     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))