using System;
using System.Collections.Generic;
using System.Text;
using LibUsbDotNet;
using LibUsbDotNet.Main;
using LibUsbDotNet.DeviceNotify;

namespace Salamax
{
  public abstract class USBDevice
  {
    private WindowsDeviceNotifier _notifier = null;
    public abstract bool IsConnected { get; }
    public abstract void Find();
    public abstract void Disconnect();

    public USBDevice()
    {
      _notifier = new LibUsbDotNet.DeviceNotify.WindowsDeviceNotifier();
      _notifier.OnDeviceNotify += _notifier_OnDeviceNotify;
    }

    private void _notifier_OnDeviceNotify(object sender, DeviceNotifyEventArgs e)
    {
      Find();
    }
  }
}
