12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #include "stdafx.h"
- #include "CommonLogicClient.h"
- CommonLogicClient::CommonLogicClient()
- {
- pLogicDeivce = (LogicDevice*)this;
- m_pSysIF->SetLogicDevice(pLogicDeivce);
- }
- CommonLogicClient::~CommonLogicClient()
- {
- }
- CommonLogicClient& CommonLogicClient::operator = (const CommonLogicClient &tValue)
- {
- //strongly recommended do not assign a client to another one
- if (this != &tValue)
- {
- m_FileFlags = tValue.m_FileFlags;
- (*m_pFilePath) = (*(tValue.m_pFilePath));
- //do open
- if (tValue.m_ClosedFlag == false)
- {
- if (Open((tValue.m_pFilePath)->c_str(), (CCOS_FILE_FLAGS)tValue.m_FileFlags) <= 0)
- {
- //failed here
- //put some log
- printf("Thread:%d,Open Failed\n", GetCurrentThreadId());
- }
- }
- }
- return (*this);
- }
- PACKET_CMD CommonLogicClient::ReadCmd(ResDataObject &CmdObject)
- {
- PACKET_CMD ret = PACKET_CMD_NONE;
- while (IsDataArrived())
- {
- ret = LogicClient::ReadCmd(CmdObject);
- if (ret != PACKET_CMD_NONE)
- {
- return ret;
- }
- }
- return ret;
- }
- bool SYSTEM_CALL CommonLogicClient::GetDeviceType(GUID &DevType)
- {
- if (IsClosed())
- {
- return RET_FAILED;
- }
- return (LogicClient::GetDeviceType(DevType) == RET_SUCCEED);
- }
- //get device resource
- RET_STATUS SYSTEM_CALL CommonLogicClient::GetDeviceResource(ResDataObject PARAM_OUT *pDeviceResource)
- {
- if (IsClosed())
- {
- return RET_FAILED;
- }
- return LogicClient::GetDeviceResource(pDeviceResource);
- }
- //ResourceCommand Request In and Response Out
- RET_STATUS SYSTEM_CALL CommonLogicClient::Request(ResDataObject PARAM_IN *pRequest, ResDataObject PARAM_OUT *pResponse)
- {
- //do nothing
- return RET_NOSUPPORT;
- }
- //notify to lower layer
- //notify&response from real logic device
- RET_STATUS SYSTEM_CALL CommonLogicClient::CmdToLogicDev(ResDataObject PARAM_IN *pCmd)
- {
- //response and notify comes here
- //printf("Driver Thread:%d,CommonLogicClient got Packet\n", GetCurrentThreadId());
- PacketArrived(pCmd);
- return RET_SUCCEED;
- }
|