public static void native_yDeviceChangeCallback(YDEV_DESCR d)
    {
        PlugEvent ev;
        yDeviceSt infos = emptyDeviceSt();
        string errmsg = "";

        if (yChange == null)
            return;
        if (yapiGetDeviceInfo(d, ref infos, ref errmsg) != SUCCESS)
            return;
        YModule modul = YModule.FindModule(infos.serial + ".module");
        ev = new PlugEvent(PlugEvent.EVTYPE.CHANGE, modul);
        _PlugEvents.Add(ev);
    }
    private static void native_yDeviceArrivalCallback(YDEV_DESCR d)
    {
        yDeviceSt infos = emptyDeviceSt();
        PlugEvent ev;
        string errmsg = "";

        if (yapiGetDeviceInfo(d, ref infos, ref errmsg) != SUCCESS)
        {
            return;
        }
        YDevice.PlugDevice(d);
        YModule modul = YModule.FindModule(infos.serial + ".module");
        modul.setImmutableAttributes(ref infos);
        ev = new PlugEvent(PlugEvent.EVTYPE.ARRIVAL, modul);
        if (yArrival != null)
            _PlugEvents.Add(ev);
    }
 private static void native_yDeviceRemovalCallback(YDEV_DESCR d)
 {
     PlugEvent ev;
     yDeviceSt infos = emptyDeviceSt();
     string errmsg = "";
     if (yRemoval == null)
         return;
     infos.deviceid = 0;
     if (yapiGetDeviceInfo(d, ref infos, ref errmsg) != SUCCESS)
         return;
     YModule modul = YModule.FindModule(infos.serial + ".module");
     ev = new PlugEvent(PlugEvent.EVTYPE.REMOVAL, modul);
     _PlugEvents.Add(ev);
 }
 private static void native_HubDiscoveryCallback(IntPtr serial_ptr, IntPtr url_ptr)
 {
     String serial = Marshal.PtrToStringAnsi(serial_ptr);
     String url = Marshal.PtrToStringAnsi(url_ptr);
     PlugEvent ev = new PlugEvent(serial, url);
     _PlugEvents.Add(ev);
 }