2018-10-07 03:36:44 +00:00
|
|
|
#pragma once
|
2015-04-19 20:16:50 +00:00
|
|
|
|
2015-08-18 22:43:30 +00:00
|
|
|
#include "boo/inputdev/DeviceToken.hpp"
|
2017-05-07 21:24:00 +00:00
|
|
|
#include "boo/inputdev/DeviceBase.hpp"
|
2017-09-15 17:20:52 +00:00
|
|
|
#include <memory>
|
2015-04-29 10:24:39 +00:00
|
|
|
|
2017-09-15 22:26:39 +00:00
|
|
|
#if _WIN32
|
|
|
|
#include <hidsdi.h>
|
|
|
|
#endif
|
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
namespace boo {
|
2015-04-21 04:02:43 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
class IHIDDevice : public std::enable_shared_from_this<IHIDDevice> {
|
|
|
|
friend class DeviceBase;
|
|
|
|
friend struct DeviceSignature;
|
|
|
|
virtual void _deviceDisconnected() = 0;
|
|
|
|
virtual bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) = 0;
|
|
|
|
virtual size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) = 0;
|
2017-09-15 22:26:39 +00:00
|
|
|
#if _WIN32
|
2017-12-06 03:20:59 +00:00
|
|
|
#if !WINDOWS_STORE
|
2018-12-08 05:17:51 +00:00
|
|
|
virtual const PHIDP_PREPARSED_DATA _getReportDescriptor() = 0;
|
2017-12-06 03:20:59 +00:00
|
|
|
#endif
|
2017-09-15 22:26:39 +00:00
|
|
|
#else
|
2018-12-08 05:17:51 +00:00
|
|
|
virtual std::vector<uint8_t> _getReportDescriptor() = 0;
|
2017-09-15 22:26:39 +00:00
|
|
|
#endif
|
2018-12-08 05:17:51 +00:00
|
|
|
virtual bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) = 0;
|
|
|
|
virtual size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) = 0;
|
|
|
|
virtual void _startThread() = 0;
|
|
|
|
|
2015-04-23 00:46:32 +00:00
|
|
|
public:
|
2018-12-08 05:17:51 +00:00
|
|
|
virtual ~IHIDDevice() = default;
|
2015-04-19 22:52:45 +00:00
|
|
|
};
|
2015-04-19 20:16:50 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
} // namespace boo
|