P
- the peripheral type the descriptor is defined for.public abstract class AbstractPeripheral<P extends Peripheral<? super P>> extends java.lang.Object implements Peripheral<P>
AbstractPeripheral
class is the base implementation for
Peripheral
-implementing classes instantiated by PeripheralProvider
.
PeripheralDescriptor
of Peripheral
instances.BIG_ENDIAN, LITTLE_ENDIAN, MIXED_ENDIAN
Constructor and Description |
---|
AbstractPeripheral() |
Modifier and Type | Method and Description |
---|---|
<U extends P> |
getDescriptor()
Retrieves the identifying and descriptive information of this peripheral
device.
|
void |
tryLock(int timeout)
Attempts to lock for (platform-wide) exclusive access the underlying
peripheral device resource.
|
void |
unlock()
Releases from (platform-wide) exclusive access the underlying peripheral
device resource.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isOpen
public void tryLock(int timeout) throws UnavailablePeripheralException, ClosedPeripheralException, java.io.IOException
timeout
of 0
means to wait forever.
This method returns silently if the underlying peripheral device resource
is currently acquired for exclusive access.tryLock
in interface Peripheral<P extends Peripheral<? super P>>
timeout
- the timeout in milliseconds.java.lang.IllegalArgumentException
- if timeout
is negative.UnavailablePeripheralException
- if this peripheral is not
currently available.ClosedPeripheralException
- if this peripheral has been closed.java.io.IOException
- if any other I/O error occurred.public void unlock() throws java.io.IOException
unlock
in interface Peripheral<P extends Peripheral<? super P>>
java.io.IOException
- if any other I/O error occurred.public final <U extends P> PeripheralDescriptor<U> getDescriptor()
getDescriptor
in interface Peripheral<P extends Peripheral<? super P>>
U
- this Peripheral
type or a subtype of it (allows for
subclassing Peripheral
types - see
UART
and
ModemUART
).PeripheralDescriptor
which encapsulates the
identifying and descriptive information of this peripheral device.Copyright © 2012, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices