You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
1 year ago
|
#include "frame/FrameFactory.h"
|
||
|
#include "frame/Frame.h"
|
||
|
#include "frame/SetTimeRequestFrame.h"
|
||
|
#include "frame/SetTimeResponseFrame.h"
|
||
|
|
||
|
FrameFactory *FrameFactory::m_pInstance = nullptr;
|
||
|
std::mutex FrameFactory::m_mutex;
|
||
|
|
||
|
|
||
|
// typeId: 设备类型Id
|
||
|
// id : 通道id
|
||
|
Frame *FrameFactory::createFrame(int cmd, int direct)
|
||
|
{
|
||
|
Frame *frame = nullptr;
|
||
|
if(m_pInstance)
|
||
|
{
|
||
|
switch (FRAME_TYPE(direct, cmd))
|
||
|
{
|
||
|
case FRAME_TYPE_SET_TIME_REQ:
|
||
|
frame = new SetTimeRequestFrame();
|
||
|
break;
|
||
|
|
||
|
case FRAME_TYPE_SET_TIME_RSP:
|
||
|
frame = new SetTimeResponseFrame();
|
||
|
break;
|
||
|
|
||
|
case FRAME_TYPE_GET_TIME_REQ:
|
||
|
case FRAME_TYPE_GET_TIME_RSP:
|
||
|
case FRAME_TYPE_SET_SERIAL_NUMBER_REQ:
|
||
|
case FRAME_TYPE_SET_SERIAL_NUMBER_RSP:
|
||
|
case FRAME_TYPE_GET_SERIAL_NUMBER_REQ:
|
||
|
case FRAME_TYPE_GET_SERIAL_NUMBER_RSP:
|
||
|
case FRAME_TYPE_SET_DEVICE_NAME_REQ:
|
||
|
case FRAME_TYPE_SET_DEVICE_NAME_RSP:
|
||
|
case FRAME_TYPE_GET_DEVICE_NAME_REQ:
|
||
|
case FRAME_TYPE_GET_DEVICE_NAME_RSP:
|
||
|
case FRAME_TYPE_SET_DEVICE_NUMBER_REQ:
|
||
|
case FRAME_TYPE_SET_DEVICE_NUMBER_RSP:
|
||
|
case FRAME_TYPE_GET_DEVICE_NUMBER_REQ:
|
||
|
case FRAME_TYPE_GET_DEVICE_NUMBER_RSP:
|
||
|
case FRAME_TYPE_SET_LOCK_STATUS_REQ:
|
||
|
case FRAME_TYPE_SET_LOCK_STATUS_RSP:
|
||
|
case FRAME_TYPE_SET_PASSWORD_REQ:
|
||
|
case FRAME_TYPE_SET_PASSWORD_RSP:
|
||
|
case FRAME_TYPE_SET_USAGE_COUNT_REQ:
|
||
|
case FRAME_TYPE_SET_USAGE_COUNT_RSP:
|
||
|
case FRAME_TYPE_GET_RECORD_REQ:
|
||
|
case FRAME_TYPE_GET_RECORD_RSP:
|
||
|
case FRAME_TYPE_SET_PARAM_REQ:
|
||
|
case FRAME_TYPE_SET_PARAM_RSP:
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return frame;
|
||
|
}
|