qt-correction-tool/hgdev/IGScanManager.h

47 lines
1.0 KiB
C++

#ifndef IGSCANMANAGER_H
#define IGSCANMANAGER_H
#ifndef _WIN32
#include <libusb-1.0/libusb.h>
#else
#include "UsbScanEx.h"
#endif
#include <thread>
#include "IUsb.h"
#include <memory>
#include <functional>
#include "jsonconfig.h"
class IGScan;
using namespace std;
class IGScanManager
{
public:
IGScanManager();
~IGScanManager();
std::vector<deviceinfo> getonlinedevices();
#ifndef _WIN32
void registehotplug();
private:
void initnotifythread();
void usbnotifymain();
static int OnUsbHotplugCallback(struct libusb_context* ctx,struct libusb_device* device,
libusb_hotplug_event event,
void* monitor);
int OnUsbHotplug(struct libusb_context* ctx,
struct libusb_device* device,
libusb_hotplug_event event);
#endif
private:
volatile bool brun;
std::vector<deviceinfo> supportdevice;
std::vector<deviceinfo> m_devices;
#ifndef _WIN32
shared_ptr<thread> m_usbnotifythread;
libusb_hotplug_callback_handle handle;
#endif
};
#endif // IGSCANMANAGER_H