CCECProcessor::~CCECProcessor(void)
{
- StopThread();
+ Close();
- delete m_communication;
- m_communication = NULL;
- m_controller = NULL;
for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
delete m_busDevices[iPtr];
}
+void CCECProcessor::Close(void)
+{
+ StopThread();
+
+ CLockObject lock(m_mutex);
+ if (m_communication)
+ {
+ m_communication->Close();
+ delete m_communication;
+ m_communication = NULL;
+ }
+}
+
bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint32_t iTimeoutMs)
{
bool bReturn(false);
Sleep(5);
}
- if (m_communication)
- {
- m_communication->Close();
- delete m_communication;
- m_communication = NULL;
- }
-
return NULL;
}
virtual bool Start(const char *strPort, uint16_t iBaudRate = 38400, uint32_t iTimeoutMs = 10000);
virtual void *Process(void);
+ virtual void Close(void);
virtual bool OnCommandReceived(const cec_command &command);