repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
win32: don't include the .pdb in the installer. only include include/cec*
[deb_libcec.git]
/
src
/
lib
/
AdapterCommunication.cpp
diff --git
a/src/lib/AdapterCommunication.cpp
b/src/lib/AdapterCommunication.cpp
index 3b0ca015454a1250a40da236358bf2f3e0206161..74597665cfb98910423ea35f01562adce47c2dc6 100644
(file)
--- a/
src/lib/AdapterCommunication.cpp
+++ b/
src/lib/AdapterCommunication.cpp
@@
-93,10
+93,10
@@
void CCECAdapterMessage::push_escaped(int16_t byte)
if (byte >= MSGESC && byte != MSGSTART)
{
push_back(MSGESC);
if (byte >= MSGESC && byte != MSGSTART)
{
push_back(MSGESC);
- push_back(
byte - ESCOFFSET
);
+ push_back(
(uint8_t) (byte - ESCOFFSET)
);
}
else
}
else
- push_back(byte);
+ push_back(
(uint8_t)
byte);
}
CAdapterCommunication::CAdapterCommunication(CLibCEC *controller) :
}
CAdapterCommunication::CAdapterCommunication(CLibCEC *controller) :
@@
-147,7
+147,8
@@
bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38
if (CreateThread())
{
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
return true;
}
else
@@
-161,14
+162,17
@@
bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38
void CAdapterCommunication::Close(void)
{
CLockObject lock(&m_mutex);
void CAdapterCommunication::Close(void)
{
CLockObject lock(&m_mutex);
- StopThread();
-
+ m_startCondition.Broadcast();
m_rcvCondition.Broadcast();
m_rcvCondition.Broadcast();
+ StopThread();
}
void *CAdapterCommunication::Process(void)
{
}
void *CAdapterCommunication::Process(void)
{
- m_controller->AddLog(CEC_LOG_DEBUG, "communication thread started");
+ {
+ CLockObject lock(&m_mutex);
+ m_startCondition.Signal();
+ }
while (!IsStopped())
{
while (!IsStopped())
{
@@
-256,7
+260,7
@@
bool CAdapterCommunication::Read(CCECAdapterMessage &msg, uint32_t iTimeout)
uint8_t buf = 0;
if (!m_inBuffer.Pop(buf))
{
uint8_t buf = 0;
if (!m_inBuffer.Pop(buf))
{
- if (!m_rcvCondition.Wait(&m_mutex,
iTarget - iNow
))
+ if (!m_rcvCondition.Wait(&m_mutex,
(uint32_t) (iTarget - iNow)
))
return false;
}
return false;
}
@@
-372,5
+376,5
@@
bool CAdapterCommunication::PingAdapter(void)
bool CAdapterCommunication::IsOpen(void) const
{
bool CAdapterCommunication::IsOpen(void) const
{
- return !IsStopped() && m_port->IsOpen();
+ return !IsStopped() && m_port->IsOpen()
&& IsRunning()
;
}
}