public abstract class AbstractDevice
extends java.lang.Object
implements com.lf.commons.model.ConfigurableUnit
SerialDevice
or USBDevice
.
All constants for configuration parameters are centralized here while specific fields are declared by the
subclasses (e.g. SerialPortWindow
references).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BARCODE_FORMAT_GENERIC
Represents the generic barcode reader format (configurable).
|
static java.lang.String |
BARCODE_FORMAT_TEXTCRLF
Represents the default barcode reader format with CRLF terminators.
|
static java.lang.String |
BARCODE_READER_FORMAT
Barcode reader specific parameter.
|
static java.lang.String |
BARCODE_READER_REGEX
Barcode reader specific parameter.
|
static java.lang.String |
BARCODE_READER_REGEX_GROUP
Barcode reader specific parameter.
|
static java.lang.String |
COMM_BAUDRATE
Serial communication baud rate (110,...,256000).
|
static java.lang.String |
COMM_DATABITS
Serial communication data bits (5,6,7,8).
|
static java.lang.String |
COMM_FLOWCONTROL
Serial communication set RTS (RTS,DTR).
|
static java.lang.String |
COMM_INTERFACE
Serial communication interface (RS-232,RS-485,... not USB!).
|
static java.lang.String |
COMM_PARITY
Serial communication parity (EVEN,MARK,NONE,ODD).
|
static java.lang.String |
COMM_STOPBITS
Serial communication stop bits (1,1.5,2).
|
static java.lang.String |
DEV_BARCODE_READER
Represents a bar code reader device.
|
static java.lang.String |
DEV_CHARGER
Represents a charger device.
|
static java.lang.String |
DEV_POWER
Represents a power switch device.
|
static java.lang.String |
DEV_RFID_READER
Represents a RFID reader device.
|
protected com.lf.commons.db.DatabaseConnector |
dvConnector
The database connector for this device (DEVICE.DVID).
|
protected int |
dvid
The database ID for this device.
|
protected java.net.URL |
figureURL
Device figure image (optional).
|
static java.lang.String |
RFID_CONVERT_10DEC
Represents the decimal format to convert from hexadecimal.
|
static java.lang.String |
RFID_CONVERT_10HEX
Represents the hexadecimal format to convert from decimal.
|
static java.lang.String |
RFID_CONVERT_8HEX
Represents the hexadecimal format to convert from decimal.
|
static java.lang.String |
RFID_FORMAT_10DEC_STX8ETX
Represents the decimal RFID tag format with length of 8 characters.
|
static java.lang.String |
RFID_FORMAT_10HEX_STX10CRLFETX
Represents the hexadecimal RFID tag format with length of 10 characters.
|
static java.lang.String |
RFID_FORMAT_8HEX_STX8CRLFETX
Represents the hexadecimal RFID tag format with length of 8 characters.
|
static java.lang.String |
RFID_FORMAT_GENERIC_DEC
Represents the generic decimal RFID tag format (configurable).
|
static java.lang.String |
RFID_FORMAT_GENERIC_HEX
Represents the generic hexadecimal RFID tag format (configurable).
|
static java.lang.String |
RFID_READER_CONVERT
RFID reader specific parameter.
|
static java.lang.String |
RFID_READER_FORMAT
RFID reader specific parameter.
|
static java.lang.String |
RFID_READER_REGEX
RFID reader specific parameter.
|
static java.lang.String |
RFID_READER_REGEX_GROUP
RFID reader specific parameter.
|
protected java.lang.String |
type
Device type identifier.
|
static java.lang.String |
USB_PRODUCT_ID
Hexadecimal USB device product identifier, see
USBIds.getProductNameByID() method. |
static java.lang.String |
USB_RELEASE
USB device release number (58.1, 2.0).
|
static java.lang.String |
USB_VENDOR_ID
Hexadecimal USB device vendor identifier, see
USBIds.getVendorNameByID() method. |
static java.lang.String |
USB_VERSION
USB interface version (1.1, 2.0), see
getUSBVersionDescription() method. |
Constructor and Description |
---|
AbstractDevice()
Constructor method for i18n purposes only.
|
AbstractDevice(java.lang.String type,
java.net.URL figureurl)
Constructs an instance based on the parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
configureUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Restores values from persistent data stores.
|
static AbstractDevice |
createDevice(java.lang.String type,
int dvid,
com.lf.commons.db.DatabaseConnector connector)
Creates a new instance of the given device type.
|
com.lf.commons.db.DatabaseConnector |
getConnector()
Provides the database connector for this device.
|
abstract java.lang.String |
getDeviceClass()
Provides the class type of this device (charger, RFID reader, ...).
|
static java.lang.String |
getDeviceClass(java.lang.String type)
Provides an appropriate device class for the given device type.
|
static javax.swing.ImageIcon |
getDeviceIcon(java.lang.String devclass)
Provides an appropriate icon for the given device class.
|
int |
getDeviceID()
Provides the ID for this device.
|
static java.lang.String |
getDeviceToolTip(java.lang.String devclass)
Provides an appropriate tooltip for the given device class.
|
abstract java.awt.Component |
getFigureDisplay()
Provides the canvas to display the device figure.
|
abstract java.awt.Component |
getLiveDisplay()
Provides the canvas to display the device live data.
|
abstract java.awt.Component |
getOptionsDisplay()
Provides the canvas to display additional device options.
|
abstract java.util.Properties |
getParams()
Provides the parameters to configure the serial port.
|
abstract boolean |
getParamsConfigurable()
May the parameters of this device be configured?
|
static java.lang.String |
getSupportedBarcodeFormatDescription(java.lang.String format)
Provides the barcode data tag format description for the given format.
|
static java.lang.String[] |
getSupportedBarcodeFormatDescriptions()
Provides the supported barcode data format descriptions.
|
static java.lang.String[] |
getSupportedBarcodeFormatRegex(java.lang.String format)
Provides the preset values (regex and group) for a certain barcode data format.
|
static java.lang.String[] |
getSupportedBarcodeFormats()
Provides the supported barcode data formats (default types).
|
static java.lang.Integer[] |
getSupportedBaudrates()
Provides the supported device baud rates.
|
static java.lang.String[] |
getSupportedBays()
Provides the list of supported device bays (chargers only).
|
static java.lang.String[] |
getSupportedBays(java.lang.String type)
Provides the list of supported device bays (special type.
|
static java.lang.Integer[] |
getSupportedDatabits()
Provides the supported device databits.
|
static java.lang.String |
getSupportedFlowControlDescription(java.lang.String value)
Provides the flow control description for the given numeric value.
|
static java.lang.String[] |
getSupportedFlowControlDescriptions()
Provides the supported device flow control value descriptions.
|
static java.lang.Integer[] |
getSupportedFlowControls()
Provides the supported device flow control values.
|
static java.lang.String[] |
getSupportedInterfaces()
Provides the supported device interfaces.
|
static java.lang.Integer[] |
getSupportedParities()
Provides the supported device parity values.
|
static java.lang.String |
getSupportedParityDescription(java.lang.String value)
Provides the parity description for the given numeric value.
|
static java.lang.String[] |
getSupportedParityDescriptions()
Provides the supported device parity value descriptions.
|
static java.lang.String[] |
getSupportedPrograms()
Provides the list of supported device programs (chargers only).
|
static java.lang.String[] |
getSupportedPrograms(java.lang.String type)
Provides the list of supported device programs (special type.
|
static java.lang.String |
getSupportedRFIDConvertFormatDescription(java.lang.String format)
Provides the RFID tag format description for the given convert format.
|
static java.lang.String[] |
getSupportedRFIDConvertFormatDescriptions()
Provides the supported RFID tag format descriptions.
|
static java.lang.String[] |
getSupportedRFIDConvertFormats()
Provides the supported RFID tag formats (target types for auto-convert).
|
static java.lang.String |
getSupportedRFIDFormatDescription(java.lang.String format)
Provides the RFID tag format description for the given format.
|
static java.lang.String[] |
getSupportedRFIDFormatDescriptions()
Provides the supported RFID tag format descriptions.
|
static java.lang.String[] |
getSupportedRFIDFormatRegex(java.lang.String format)
Provides the preset values (regex and group) for a certain RFID tag format.
|
static java.lang.String[] |
getSupportedRFIDFormats()
Provides the supported RFID tag formats (default types).
|
static java.lang.String[] |
getSupportedStatus()
Provides the list of supported device status values (chargers only).
|
static java.lang.String[] |
getSupportedStatus(java.lang.String type)
Provides the list of supported device status values (special type.
|
static java.lang.String |
getSupportedStopbitDescription(java.lang.String value)
Provides the stopbit description for the given numeric value.
|
static java.lang.String[] |
getSupportedStopbitDescriptions()
Provides the supported device stopbit value descriptions.
|
static java.lang.Integer[] |
getSupportedStopbits()
Provides the supported device stopbits.
|
java.lang.String |
getType()
Provides the type of this device.
|
static java.lang.String |
getUSBVersionDescription(java.lang.String version)
Provides the display text for the given USB standard.
|
abstract boolean |
isFunctional()
Checks if this device can be used.
|
void |
setDevice(int dvid,
com.lf.commons.db.DatabaseConnector connector)
Sets the database entry data for this device.
|
void |
storeUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
abstract void |
updateStatus()
Called regularly by a separate thread e.g. to update connected status icon.
|
public static final java.lang.String DEV_CHARGER
public static final java.lang.String DEV_RFID_READER
public static final java.lang.String DEV_POWER
public static final java.lang.String DEV_BARCODE_READER
public static final java.lang.String COMM_INTERFACE
public static final java.lang.String COMM_BAUDRATE
public static final java.lang.String COMM_DATABITS
public static final java.lang.String COMM_STOPBITS
public static final java.lang.String COMM_PARITY
public static final java.lang.String COMM_FLOWCONTROL
public static final java.lang.String RFID_FORMAT_GENERIC_HEX
public static final java.lang.String RFID_FORMAT_GENERIC_DEC
public static final java.lang.String RFID_FORMAT_8HEX_STX8CRLFETX
public static final java.lang.String RFID_FORMAT_10HEX_STX10CRLFETX
public static final java.lang.String RFID_FORMAT_10DEC_STX8ETX
public static final java.lang.String RFID_CONVERT_8HEX
public static final java.lang.String RFID_CONVERT_10HEX
public static final java.lang.String RFID_CONVERT_10DEC
public static final java.lang.String RFID_READER_FORMAT
public static final java.lang.String RFID_READER_REGEX
public static final java.lang.String RFID_READER_REGEX_GROUP
public static final java.lang.String RFID_READER_CONVERT
public static final java.lang.String BARCODE_FORMAT_GENERIC
public static final java.lang.String BARCODE_FORMAT_TEXTCRLF
public static final java.lang.String BARCODE_READER_FORMAT
public static final java.lang.String BARCODE_READER_REGEX
public static final java.lang.String BARCODE_READER_REGEX_GROUP
public static final java.lang.String USB_VERSION
getUSBVersionDescription()
method.public static final java.lang.String USB_VENDOR_ID
USBIds.getVendorNameByID()
method.public static final java.lang.String USB_PRODUCT_ID
USBIds.getProductNameByID()
method.public static final java.lang.String USB_RELEASE
protected java.lang.String type
protected java.net.URL figureURL
protected int dvid
protected com.lf.commons.db.DatabaseConnector dvConnector
public AbstractDevice() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic AbstractDevice(java.lang.String type, java.net.URL figureurl)
type
- The device type identifier, requiredfigureurl
- The device figure (optional)java.lang.NullPointerException
- If a parameter is null
public static java.lang.String[] getSupportedBays()
public static java.lang.String[] getSupportedBays(java.lang.String type)
type
- The official device typejava.lang.NullPointerException
- If a parameter is null
public static java.lang.String[] getSupportedPrograms()
public static java.lang.String[] getSupportedPrograms(java.lang.String type)
type
- The official device typejava.lang.NullPointerException
- If a parameter is null
public static java.lang.String[] getSupportedStatus()
public static java.lang.String[] getSupportedStatus(java.lang.String type)
type
- The official device typejava.lang.NullPointerException
- If a parameter is null
public static java.lang.String[] getSupportedInterfaces()
public static java.lang.Integer[] getSupportedBaudrates()
public static java.lang.Integer[] getSupportedDatabits()
public static java.lang.Integer[] getSupportedStopbits()
public static java.lang.String[] getSupportedStopbitDescriptions()
public static java.lang.String getSupportedStopbitDescription(java.lang.String value)
value
- The value 0, 1, ...null
otherwisepublic static java.lang.Integer[] getSupportedParities()
public static java.lang.String[] getSupportedParityDescriptions()
public static java.lang.String getSupportedParityDescription(java.lang.String value)
value
- The value 0, 1, ...null
otherwisepublic static java.lang.Integer[] getSupportedFlowControls()
public static java.lang.String[] getSupportedFlowControlDescriptions()
public static java.lang.String getSupportedFlowControlDescription(java.lang.String value)
value
- The value 0, 1, ...null
otherwisepublic static java.lang.String[] getSupportedRFIDFormats()
public static java.lang.String[] getSupportedRFIDFormatDescriptions()
public static java.lang.String getSupportedRFIDFormatDescription(java.lang.String format)
format
- The tag format ID like "8HEX_STX8CRLFETX"null
otherwisepublic static java.lang.String[] getSupportedRFIDFormatRegex(java.lang.String format)
format
- The tag format ID like "8HEX_STX8CRLFETX"null
otherwisepublic static java.lang.String[] getSupportedRFIDConvertFormats()
public static java.lang.String[] getSupportedRFIDConvertFormatDescriptions()
public static java.lang.String getSupportedRFIDConvertFormatDescription(java.lang.String format)
format
- The convert format ID like "CONVERT_10HEX"null
otherwisepublic static java.lang.String[] getSupportedBarcodeFormats()
public static java.lang.String[] getSupportedBarcodeFormatDescriptions()
public static java.lang.String getSupportedBarcodeFormatDescription(java.lang.String format)
format
- The tag format ID like "8HEX_STX8CRLFETX"null
otherwisepublic static java.lang.String[] getSupportedBarcodeFormatRegex(java.lang.String format)
format
- The tag format ID like "8HEX_STX8CRLFETX"null
otherwisepublic static java.lang.String getUSBVersionDescription(java.lang.String version)
version
- The USB version 1.0, 2.0 etc.null
if not availablejava.lang.NullPointerException
- If a parameter is null
public java.lang.String getType()
public void setDevice(int dvid, com.lf.commons.db.DatabaseConnector connector)
dvid
- The database ID for this device, -1 = unknownconnector
- The database connector for this device (DEVICE.DVID)public int getDeviceID()
public com.lf.commons.db.DatabaseConnector getConnector()
null
otherwisepublic static AbstractDevice createDevice(java.lang.String type, int dvid, com.lf.commons.db.DatabaseConnector connector)
type
- The type identifierdvid
- The database ID for this device, -1 = unknownconnector
- The database connector for this device (DEVICE.DVID)null
if not availablejava.lang.NullPointerException
- If a parameter is null
public static javax.swing.ImageIcon getDeviceIcon(java.lang.String devclass)
devclass
- The device class DEV_BARCODE_READER
, ...null
if not availablepublic static java.lang.String getDeviceToolTip(java.lang.String devclass)
devclass
- The device class DEV_BARCODE_READER
, ...null
if not availablepublic static java.lang.String getDeviceClass(java.lang.String type)
type
- The device type Barcode Reader (RS-232)
, ...DEV_BARCODE_READER
, null
if not availablepublic void configureUnit(java.lang.String id, com.lf.commons.config.Configuration config)
configureUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, com.lf.commons.config.Configuration config)
storeUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void unitRegistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitRegistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitUnregistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic abstract java.util.Properties getParams()
public abstract boolean getParamsConfigurable()
public abstract java.lang.String getDeviceClass()
public abstract java.awt.Component getOptionsDisplay()
null
public abstract java.awt.Component getFigureDisplay()
null
public abstract java.awt.Component getLiveDisplay()
null
public abstract boolean isFunctional()
public abstract void updateStatus()
Copyright © 2013-2015 Leisenfels UG. All rights reserved.