28 lines
569 B
C
28 lines
569 B
C
|
#pragma once
|
||
|
#include "inotify.h"
|
||
|
#include "autoevent.hpp"
|
||
|
#include <thread>
|
||
|
#include <queue>
|
||
|
#include <future>
|
||
|
#include <threadex.h>
|
||
|
|
||
|
class UsbDevice;
|
||
|
|
||
|
class UsbNotify : public INotify
|
||
|
{
|
||
|
public:
|
||
|
UsbNotify(std::shared_ptr<UsbDevice> usb);
|
||
|
virtual ~UsbNotify();
|
||
|
virtual void notify(void* data, int size);
|
||
|
virtual void clear();
|
||
|
|
||
|
private:
|
||
|
void run_notify();
|
||
|
|
||
|
std::shared_ptr<ThreadEx> runThread;
|
||
|
AutoEvent ae;
|
||
|
std::mutex mx;
|
||
|
std::queue<std::vector<unsigned char>> msgs;
|
||
|
std::shared_ptr<UsbDevice> usb;
|
||
|
volatile bool brun;
|
||
|
};
|