本文整理匯總了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();
}
示例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);
}
}
示例3: usbDeviceDetached
import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
@Override
public void usbDeviceDetached(final UsbDeviceEvent event)
{
for (final UsbDeviceListener listener: toArray())
{
listener.usbDeviceDetached(event);
}
}
示例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);
}
示例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);
}
}
示例6: usbDeviceDetached
import javax.usb.event.UsbDeviceEvent; //導入依賴的package包/類
@Override
public void usbDeviceDetached(final UsbDeviceEvent event)
{
// Empty
}