repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: put the message processing code from WaitForAck() in ParseMessage(). fixes missi...
[deb_libcec.git]
/
src
/
lib
/
LibCEC.cpp
diff --git
a/src/lib/LibCEC.cpp
b/src/lib/LibCEC.cpp
index 2f768157887c6e7fa176af4550462967916e9690..0c4b89de220d0a7ebff81bc0f4e5189d20a84718 100644
(file)
--- a/
src/lib/LibCEC.cpp
+++ b/
src/lib/LibCEC.cpp
@@
-78,7
+78,17
@@
bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = 10000 */)
return false;
}
return false;
}
- if (!m_comm->Open(strPort, 38400, iTimeoutMs))
+ int64_t iNow = GetTimeMs();
+ int64_t iTarget = iNow + iTimeoutMs;
+
+ bool bOpened(false);
+ while (!bOpened && iNow < iTarget)
+ {
+ bOpened = m_comm->Open(strPort, 38400, iTimeoutMs);
+ iNow = GetTimeMs();
+ }
+
+ if (!bOpened)
{
AddLog(CEC_LOG_ERROR, "could not open a connection");
return false;
{
AddLog(CEC_LOG_ERROR, "could not open a connection");
return false;
@@
-148,7
+158,7
@@
bool CLibCEC::GetNextCommand(cec_command *command)
return m_commandBuffer.Pop(*command);
}
return m_commandBuffer.Pop(*command);
}
-bool CLibCEC::Transmit(const cec_
frame
&data, bool bWaitForAck /* = true */)
+bool CLibCEC::Transmit(const cec_
command
&data, bool bWaitForAck /* = true */)
{
return m_cec ? m_cec->Transmit(data, bWaitForAck) : false;
}
{
return m_cec ? m_cec->Transmit(data, bWaitForAck) : false;
}
@@
-204,20
+214,12
@@
void CLibCEC::AddKey(void)
}
}
}
}
-void CLibCEC::AddCommand(cec_
logical_address source, cec_logical_address destination, cec_opcode opcode, cec_frame *parameters
)
+void CLibCEC::AddCommand(cec_
command &command
)
{
{
- cec_command command;
- command.clear();
-
- command.source = source;
- command.destination = destination;
- command.opcode = opcode;
- if (parameters)
- command.parameters = *parameters;
if (m_commandBuffer.Push(command))
{
CStdString strDebug;
if (m_commandBuffer.Push(command))
{
CStdString strDebug;
- strDebug.Format("stored command '%
d' in the command buffer. buffer size = %d",
opcode, m_commandBuffer.Size());
+ strDebug.Format("stored command '%
2x' in the command buffer. buffer size = %d", command.
opcode, m_commandBuffer.Size());
AddLog(CEC_LOG_DEBUG, strDebug);
}
else
AddLog(CEC_LOG_DEBUG, strDebug);
}
else