public final class ATDeviceConfig extends java.lang.Object implements DeviceConfig<ATDevice>, DeviceConfig.HardwareAddressing
ATDeviceConfig
class encapsulates the hardware addressing information, and static and
dynamic configuration parameters of an AT device.
Some hardware addressing, static or dynamic configuration parameters may be
set to UNASSIGNED
or null
(see
Unassigned, Default or Unused Parameter Values).
An instance of ATDeviceConfig
can be passed to the
open(DeviceConfig, ...)
and
open(Class, DeviceConfig, ...)
methods of the DeviceManager
to open the designated AT device
with the specified configuration. A InvalidDeviceConfigException
is thrown when
attempting to open a device with an invalid or unsupported configuration.
DeviceConfig.HardwareAddressing
DEFAULT, UNASSIGNED
Constructor and Description |
---|
ATDeviceConfig(int controllerNumber,
int channelNumber)
Creates a new
ATDeviceConfig with the specified hardware addressing information. |
ATDeviceConfig(java.lang.String controllerName,
int channelNumber)
Creates a new
ATDeviceConfig with the specified hardware addressing information. |
Modifier and Type | Method and Description |
---|---|
static ATDeviceConfig |
deserialize(java.io.InputStream in)
Creates a new
ATDeviceConfig whose state is deserialized from the specified InputStream . |
boolean |
equals(java.lang.Object obj)
Checks two
ATDeviceConfig objects for equality. |
int |
getChannelNumber()
Gets the configured channel number.
|
java.lang.String |
getControllerName()
Gets the configured controller name (such as its device file name on UNIX systems).
|
int |
getControllerNumber()
Gets the configured controller number.
|
int |
hashCode()
Returns the hash code value for this object.
|
int |
serialize(java.io.OutputStream out)
Serializes the state of this
ATDeviceConfig object to the specified OutputStream . |
public ATDeviceConfig(java.lang.String controllerName, int channelNumber)
ATDeviceConfig
with the specified hardware addressing information.
The controller number is set to UNASSIGNED
.
controllerName
- the controller name (such as its device file name on UNIX systems).channelNumber
- the hardware channel's number (a positive or zero integer) or UNASSIGNED
.java.lang.IllegalArgumentException
- if channelNumber
is not in the defined range.java.lang.NullPointerException
- if controller name
is null
.public ATDeviceConfig(int controllerNumber, int channelNumber)
ATDeviceConfig
with the specified hardware addressing information.
The controller name is set to null
.
controllerNumber
- the controller number (a positive or zero integer) or UNASSIGNED
.channelNumber
- the hardware channel's number (a positive or zero integer) or UNASSIGNED
.java.lang.IllegalArgumentException
- if channelNumber
is not in the defined range.public static ATDeviceConfig deserialize(java.io.InputStream in) throws java.io.IOException
ATDeviceConfig
whose state is deserialized from the specified InputStream
.
This method may be invoked to restore the state of a ATDeviceConfig
object from a persistent store.in
- the stream to read from.ATDeviceConfig
instance.java.io.IOException
- if an I/O error occurs or if the provided stream does not
contain a representation of a ATDeviceConfig
object.public int serialize(java.io.OutputStream out) throws java.io.IOException
ATDeviceConfig
object to the specified OutputStream
.
This method may be invoked by the DeviceManager
to save the state of this ATDeviceConfig
object to a persistent store.serialize
in interface DeviceConfig<ATDevice>
out
- the stream to write to.java.io.IOException
- if an I/O error occurs.DeviceProvider.deserialize(java.io.InputStream)
public int getChannelNumber()
UNASSIGNED
.public int getControllerNumber()
getControllerNumber
in interface DeviceConfig.HardwareAddressing
UNASSIGNED
.public java.lang.String getControllerName()
getControllerName
in interface DeviceConfig.HardwareAddressing
null
.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
ATDeviceConfig
objects for equality.equals
in class java.lang.Object
obj
- the object to test for equality with this object.true
if obj
is a ATDeviceConfig
and has the same hardware
addressing information and configuration parameter values as this
ATDeviceConfig
object; false
otherwise.Copyright © 2012, 2015, Oracle and/or its affiliates. All rights reserved.
Legal Notices