2015-04-19 22:52:45 +00:00
|
|
|
#include "inputdev/CDeviceBase.hpp"
|
2015-04-21 04:02:43 +00:00
|
|
|
#include "inputdev/CDeviceToken.hpp"
|
|
|
|
#include "IHIDDevice.hpp"
|
|
|
|
|
2015-04-23 00:46:32 +00:00
|
|
|
CDeviceBase::CDeviceBase(CDeviceToken* token, IHIDDevice* hidDev)
|
|
|
|
: m_token(token), m_hidDev(hidDev)
|
|
|
|
{
|
|
|
|
hidDev->_setDeviceImp(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
CDeviceBase::~CDeviceBase()
|
|
|
|
{
|
|
|
|
delete m_hidDev;
|
|
|
|
}
|
2015-04-21 04:02:43 +00:00
|
|
|
|
|
|
|
void CDeviceBase::_deviceDisconnected()
|
|
|
|
{
|
2015-04-22 21:48:23 +00:00
|
|
|
deviceDisconnected();
|
2015-04-21 04:02:43 +00:00
|
|
|
m_token = NULL;
|
2015-04-23 00:46:32 +00:00
|
|
|
if (m_hidDev)
|
|
|
|
{
|
|
|
|
m_hidDev->_deviceDisconnected();
|
|
|
|
delete m_hidDev;
|
|
|
|
m_hidDev = NULL;
|
|
|
|
}
|
2015-04-21 04:02:43 +00:00
|
|
|
}
|
|
|
|
|
2015-04-19 22:52:45 +00:00
|
|
|
|
2015-04-22 21:48:23 +00:00
|
|
|
void CDeviceBase::closeDevice()
|
|
|
|
{
|
|
|
|
if (m_token)
|
|
|
|
m_token->_deviceClose();
|
|
|
|
}
|
|
|
|
|
|
|
|
|