當前位置: 首頁>>代碼示例>>Java>>正文


Java UsbDeviceEvent類代碼示例

本文整理匯總了Java中javax.usb.event.UsbDeviceEvent的典型用法代碼示例。如果您正苦於以下問題:Java UsbDeviceEvent類的具體用法?Java UsbDeviceEvent怎麽用?Java UsbDeviceEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UsbDeviceEvent類屬於javax.usb.event包,在下文中一共展示了UsbDeviceEvent類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: usbDeviceDetached

import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
/**
 *
 * @param ude
 */
@Override
public void usbDeviceDetached(UsbDeviceEvent ude)
{
    Logger.getLogger(UsbRobotArm.class.getName()).log(Level.WARNING,
            ude.getUsbDevice().toString() + "\n", ude);

    this.resetStates();
    this.usbDevice = null;
    this.fireRobotArmDetached();
}
 
開發者ID:swordmaster2k,項目名稱:robotarmedge,代碼行數:15,代碼來源:UsbRobotArm.java

示例2: setParentUsbPort

import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
/**
 * Sets the parent USB port. If port is unset then a usbDeviceDetached event
 * is send.
 * 
 * @param port
 *            The port to set. Null to unset.
 */
final void setParentUsbPort(final UsbPort port)
{
    if (this.port == null && port == null)
        throw new IllegalStateException("Device already detached");
    if (this.port != null && port != null)
        throw new IllegalStateException("Device already attached");

    // Disconnect client devices
    if (port == null && isUsbHub())
    {
        final Hub hub = (Hub) this;
        for (final AbstractDevice device: hub.getAttachedUsbDevices())
        {
            hub.disconnectUsbDevice(device);
        }
    }

    this.port = port;

    final Services services = Services.getInstance();

    if (port == null)
    {
        this.listeners.usbDeviceDetached(new UsbDeviceEvent(this));
        services.usbDeviceDetached(this);
    }
    else
    {
        services.usbDeviceAttached(this);
    }
}
 
開發者ID:usb4java,項目名稱:usb4java-javax,代碼行數:39,代碼來源:AbstractDevice.java

示例3: usbDeviceDetached

import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
@Override
public void usbDeviceDetached(final UsbDeviceEvent event)
{
    for (final UsbDeviceListener listener: toArray())
    {
        listener.usbDeviceDetached(event);
    }
}
 
開發者ID:usb4java,項目名稱:usb4java-javax,代碼行數:9,代碼來源:DeviceListenerList.java

示例4: testAbstractMethods

import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
/**
 * Ensure the existence of the needed methods.
 */
@Test
public void testAbstractMethods()
{
    final UsbDeviceListener adapter = new UsbDeviceAdapter()
    {
        // Empty
    };
    adapter.usbDeviceDetached((UsbDeviceEvent) null);
    adapter.dataEventOccurred((UsbDeviceDataEvent) null);
    adapter.errorEventOccurred((UsbDeviceErrorEvent) null);
}
 
開發者ID:usb4java,項目名稱:usb4java-javax,代碼行數:15,代碼來源:UsbDeviceAdapterTest.java

示例5: usbDeviceDetached

import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
@Override
public void usbDeviceDetached(UsbDeviceEvent event) {
	logger.debug("received detach event from device {}", event);
	if (isGeneratedByAKnownDevice(event.getUsbDevice())) {
		Controller controller = extractUsbController(event.getUsbDevice());
		this.eventListener.onDisconnect(controller);
	}
}
 
開發者ID:quirinobrizi,項目名稱:jax10,代碼行數:9,代碼來源:X10EventListener.java

示例6: usbDeviceDetached

import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
@Override
public void usbDeviceDetached(final UsbDeviceEvent event)
{
    // Empty
}
 
開發者ID:usb4java,項目名稱:usb4java-javax,代碼行數:6,代碼來源:UsbDeviceAdapter.java


注:本文中的javax.usb.event.UsbDeviceEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。