Manages a static Libusb-1.0 MonoUsbSessionHandle and "handle_events" thread for simplified asynchronous IO.

This class contains its own MonoUsbSessionHandle that is initialized with one of the overloaded MonoUsbEventHandler.Init() functions.

This class contains a static thread that execute MonoUsbApi.HandleEventsTimeout. See the Start and Stop methods.

Exemplo n.º 1
0
 /// <summary>
 /// Calls <see cref="MonoUsbEventHandler.Init()"/> and <see cref="MonoUsbEventHandler.Start"/> if <see cref="MonoUsbEventHandler.IsStopped"/> = true.
 /// </summary>
 internal static void InitAndStart()
 {
     if (!MonoUsbEventHandler.IsStopped)
     {
         return;
     }
     MonoUsbEventHandler.Init();
     MonoUsbEventHandler.Start();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Calls <see cref="MonoUsbEventHandler.Stop"/> and <see cref="MonoUsbEventHandler.Exit"/>.
        /// </summary>
        internal static void StopAndExit()
        {
#if LIBUSBDOTNET
            if (LibUsbDotNet.LudnMonoLibUsb.MonoUsbDevice.mMonoUSBProfileList != null)
            {
                LibUsbDotNet.LudnMonoLibUsb.MonoUsbDevice.mMonoUSBProfileList.Close();
            }
            LibUsbDotNet.LudnMonoLibUsb.MonoUsbDevice.mMonoUSBProfileList = null;
#endif
            MonoUsbEventHandler.Stop(true);
            MonoUsbEventHandler.Exit();
        }