1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- // BusThread.cpp : 定义 DLL 应用程序的导出函数。
- //
- #include "stdafx.h"
- #include "BusThread.h"
- #include "Logger.h"
- #include "CDInterface.h"
- #include <iostream>
- BusThread::BusThread(void)
- {
- m_bLocal = true;
- }
- BusThread::~BusThread(void)
- {
- }
- //work
- bool BusThread::Exec()
- {
- while (WaitForInQue())
- {
- bool status = true;
- //pump In&Out que
- while (status)
- {
- ResDataObject Packet;
- status = false;
- //check req first
- if (PopReqDataObject(Packet))
- {
- status = true;
- //send it to cdi
- std::cout << "From Ebus" << Packet.encode() << endl;
- #ifndef TEMP_COMP
- CDInterface *p = CDInterface::GetCDI();
- if (m_bLocal)
- {
- p->ReceivedFromLocalBus(Packet);
- }
- else
- {
- p->ReceivedFromEthBus(Packet);
- }
- //p->ReceivedFromBus(Packet);
- #endif
- }
- }
- }
- return true;
- }
- bool BusThread::OnStartThread(void)
- {
- printf("========== BusThread::OnStartThread 0X%08X \n", GetCurrentThreadId());
- #ifndef TEMP_COMP
- TPRINTA_INFO("Bus Thread Begin Entry.....");
- #endif
- return true;
- }
- bool BusThread::OnEndThread(void)
- {
- printf("========== BusThread::OnEndThread 0X%08X \n", GetCurrentThreadId());
- #ifndef TEMP_COMP
- Logger *pLog = (Logger*)m_pThreadLogger;
- PRINTA_INFO(pLog, "Bus Thread End Exit.....");
- #endif
- return true;
- }
|