m_strDeviceName(strDeviceName),
m_communication(serComm),
m_controller(controller),
- m_bMonitor(false)
+ m_bMonitor(false),
+ m_busScan(NULL)
{
m_logicalAddresses.Clear();
m_logicalAddresses.Set(iLogicalAddress);
CCECProcessor::~CCECProcessor(void)
{
+ if (m_busScan)
+ {
+ m_busScan->StopThread();
+ delete m_busScan;
+ }
+
m_startCondition.Broadcast();
StopThread();
+
m_communication = NULL;
m_controller = NULL;
for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
if (SetAckMask(m_logicalAddresses.AckMask()) &&
SetHDMIPort(m_iHDMIPort, true))
{
- ScanCECBus();
+ m_busScan = new CCECBusScan(this);
+ m_busScan->CreateThread(true);
return true;
}
}
return bReturn;
}
-void CCECProcessor::ScanCECBus(void)
-{
- CCECBusDevice *device(NULL);
- for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
- {
- device = m_busDevices[iPtr];
- if (device && device->GetStatus() == CEC_DEVICE_STATUS_PRESENT)
- {
- device->GetPhysicalAddress();
- Sleep(5);
- device->GetCecVersion();
- Sleep(5);
- device->GetVendorId();
- Sleep(5);
- }
- }
-}
-
bool CCECProcessor::CheckPhysicalAddress(uint16_t iPhysicalAddress)
{
for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
{
return m_busDevices[iDestination]->SendKeyRelease(bWait);
}
+
+void *CCECBusScan::Process(void)
+{
+ CCECBusDevice *device(NULL);
+ for (unsigned int iPtr = 0; iPtr < 15 && !IsStopped(); iPtr++)
+ {
+ device = m_processor->m_busDevices[iPtr];
+ if (device && device->GetStatus() == CEC_DEVICE_STATUS_PRESENT)
+ {
+ if (!IsStopped())
+ device->GetPhysicalAddress();
+ Sleep(5);
+
+ if (!IsStopped())
+ device->GetCecVersion();
+ Sleep(5);
+
+ if (!IsStopped())
+ device->GetVendorId();
+ Sleep(5);
+ }
+ }
+ return NULL;
+}
bool m_bMonitor;
CecBuffer<cec_command> m_commandBuffer;
cec_keypress m_previousKey;
+ CThread * m_busScan;
+ };
+
+ class CCECBusScan : public CThread
+ {
+ public:
+ CCECBusScan(CCECProcessor *processor) { m_processor = processor; }
+ virtual ~CCECBusScan(void) {}
+ virtual void *Process(void);
+
+ private:
+ CCECProcessor *m_processor;
};
};