public class DataManSystem
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
DataManSystem.OnBatchCommandsCompletedListener
Interface definition for a callback to be invoked when a response for a commands is received in a bulk sending.
|
static interface |
DataManSystem.OnBinaryDataTransferProgressListener
Interface definition for a callback to be invoked when a certain amount of binary data
has been transferred.
|
static interface |
DataManSystem.OnCodeQualityDataArrivedListener
Interface definition for a callback to be invoked when a code quality data XML is arrived.
|
static interface |
DataManSystem.OnConnectedListener
Interface definition for a callback to be invoked when successfully connecting to a reader.
|
static interface |
DataManSystem.OnConnectionErrorListener
Interface definition for a callback to be invoked when an error occurs while connecting to a reader.
|
static interface |
DataManSystem.OnDisconnectedListener
Interface definition for a callback to be invoked when disconnecting from a reader.
|
static interface |
DataManSystem.OnHeartbeatResponseMissedListener
Interface definition for a callback to be invoked when a response to a heartbeat
command is missed.
|
static interface |
DataManSystem.OnImageArrivedListener
Interface definition for a callback to be invoked when a read image is arrived.
|
static interface |
DataManSystem.OnImageGraphicsArrivedListener
Interface definition for a callback to be invoked when an image graphics XML is arrived.
|
static interface |
DataManSystem.OnLiveImageArrivedListener
Interface definition for a callback to be invoked when a live image is arrived.
|
static interface |
DataManSystem.OnOffProtocolByteReceivedListener
Interface definition for a callback to be invoked when an off protocol byte is received.
|
static interface |
DataManSystem.OnReadStringArrivedListener
Interface definition for a callback to be invoked when a simple read string is arrived.
|
static interface |
DataManSystem.OnResponseReceivedListener
Interface definition for a callback to be invoked when a response is received.
|
static interface |
DataManSystem.OnStatusEventArrivedListener
Interface definition for a callback to be invoked when the status event is arrived.
|
static interface |
DataManSystem.OnSystemWentOfflineListener
Interface definition for a callback to be invoked when reader goes offline.
|
static interface |
DataManSystem.OnSystemWentOnlineListener
Interface definition for a callback to be invoked when reader goes online.
|
static interface |
DataManSystem.OnTrainingResultArrivedListener
Interface definition for a callback to be invoked when a training result XML is arrived.
|
static interface |
DataManSystem.OnXmlResultArrivedListener
Interface definition for a callback to be invoked when a read result in XML format is arrived.
|
static interface |
DataManSystem.OnXmlStatisticsArrivedListener
Interface definition for a callback to be invoked a the read statistics in XML format is arrived.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
connect()
Initiates a connection to the device with default user name, password and timeout.
|
boolean |
connect(java.lang.String userName,
java.lang.String password)
Initiates a connection to the device with the given user name and password and with the default
timeout.
|
static DataManSystem |
createDataManSystemForMXDevice(android.content.Context context)
Creates a
DataManSystem object for a connected MX device. |
static DataManSystem |
createDataManSystemForMXDevice(android.content.Context context,
android.os.Handler handler)
Creates a
DataManSystem object for a connected MX device. |
static DataManSystem |
createDataManSystemOverBlutooth(android.bluetooth.BluetoothDevice device)
Creates a
DataManSystem object to a Cognex Bluetooth device. |
static DataManSystem |
createDataManSystemOverBlutooth(android.bluetooth.BluetoothDevice device,
android.os.Handler handler)
Creates a
DataManSystem object to a Cognex Bluetooth device. |
static DataManSystem |
createDataManSystemOverCamera(android.content.Context context,
int cameraMode,
int previewOptions,
android.view.ViewGroup previewContainer)
Creates a
DataManSystem object for a Phone camera. |
static DataManSystem |
createDataManSystemOverEthernet(java.net.InetAddress address)
Creates a
DataManSystem object with an underlying Ethernet transport. |
static DataManSystem |
createDataManSystemOverEthernet(java.net.InetAddress address,
android.os.Handler handler)
Creates a
DataManSystem object with an underlying Ethernet transport. |
static DataManSystem |
createDataManSystemOverEthernet(java.net.InetAddress address,
int port)
Creates a
DataManSystem object with an underlying Ethernet transport. |
static DataManSystem |
createDataManSystemOverEthernet(java.net.InetAddress address,
int port,
android.os.Handler handler)
Creates a
DataManSystem object with an underlying Ethernet transport. |
static DataManSystem |
createDataManSystemOverUsb(android.content.Context context,
android.hardware.usb.UsbDevice device)
Deprecated.
use
createDataManSystemForMXDevice |
static DataManSystem |
createDataManSystemOverUsb(android.content.Context context,
android.hardware.usb.UsbDevice device,
android.os.Handler handler)
Deprecated.
use
createDataManSystemForMXDevice |
static DataManSystem |
createDataManSystemOverUsbAccessory(android.content.Context context,
android.hardware.usb.UsbAccessory accessory)
Deprecated.
use
createDataManSystemForMXDevice |
static DataManSystem |
createDataManSystemOverUsbAccessory(android.content.Context context,
android.hardware.usb.UsbAccessory accessory,
android.os.Handler handler)
Deprecated.
use
createDataManSystemForMXDevice |
void |
disableHeartbeat()
Disables heartbeat and stops sending heartbeat commands.
|
void |
disableLiveImage()
Disables live image mode and stops requesting live images.
|
void |
disconnect()
Initiates a disconnection from the device.
|
void |
enableHeartbeat(int interval)
Enables heartbeat and start sending heartbeat commands in every
interval milliseconds. |
void |
enableLiveImage(com.cognex.dataman.sdk.ImageFormat imageFormat,
com.cognex.dataman.sdk.ImageSize imageSize,
com.cognex.dataman.sdk.ImageQuality imageQuality,
DataManSystem.OnLiveImageArrivedListener listener)
Enables live image mode and start requesting live images.
|
java.nio.charset.Charset |
getCharset()
Gets the
Charset object used when converting a series of bytes from the
reader to a string. |
com.cognex.dataman.sdk.ConnectionState |
getConnectionState()
Returns the connection state of the system.
|
boolean |
getExpectReadStringAsResponse()
Gets the value indicating whether the new syntax is expected for DMCC results arriving.
|
java.lang.String |
getExtraHeaderData()
Gets the extra header data sent with all commands.
|
java.util.EnumSet<com.cognex.dataman.sdk.ResultType> |
getResultTypes()
Gets the result types that should be handled by the SDK.
|
com.cognex.dataman.sdk.ConnectionState |
getState()
Gets the current connection state of this
DataManSystem instance. |
int |
getTimeout()
Gets the timeout value (in milliseconds) used in operations that can time out.
|
static java.lang.String |
getVersion()
Gets the current version of the SDK.
|
boolean |
isConnected()
Indicates the status of the connection.
|
boolean |
isFlushBufferEnabled()
Returns if buffer flushing was enabled or disabled on connecting to the device.
|
boolean |
isHeartbeatEnabled()
Indicates whether heartbeat is enabled or not.
|
boolean |
isLiveImageEnabled()
Indicates whether Live Image mode is enabled or not.
|
void |
sendBatchCommands(java.util.List<java.lang.String> commands,
DataManSystem.OnBatchCommandsCompletedListener listener)
Sends the commands provided in a List to the connected device serially with the default timeout.
|
void |
sendCommand(java.lang.String command)
Sends a command to the connected device with the default timeout.
|
void |
sendCommand(java.lang.String command,
byte[] data,
int timeout,
boolean expectBinaryResponse,
DataManSystem.OnResponseReceivedListener listener)
Sends a command and the specified binary data to the connected device with the given
timeout value.
|
void |
sendCommand(java.lang.String command,
DataManSystem.OnResponseReceivedListener listener)
Sends a command to the connected device with the default timeout.
|
com.cognex.dataman.sdk.DmccResponse |
sendCommandSync(java.lang.String command,
byte[] data,
int timeout,
boolean expectBinaryResponse)
Sends a command and the specified binary data to the connected device with the given
timeout value.
|
void |
setCharset(java.nio.charset.Charset charset)
Sets the
Charset object used when converting a series of bytes from the
reader to a string. |
void |
setExpectReadStringAsResponse(boolean value)
Sets the value indicating whether the new syntax should be used when handling DMCC results.
|
void |
setExtraHeaderData(java.lang.String extraHeaderData)
Sets the extra header data sent with all commands.
|
void |
setFlushBufferEnabled(boolean enabled)
Enables or disables buffer flushing on the device.
|
void |
setLogger(com.cognex.dataman.sdk.Logger logger)
Sets the optional logger which can be used for debugging purposes.
|
void |
setOnBinaryDataTransferProgressListener(DataManSystem.OnBinaryDataTransferProgressListener listener)
Register a callback to be invoked to report binary data transfer progress.
|
void |
setOnCodeQualityDataArrivedListener(DataManSystem.OnCodeQualityDataArrivedListener listener)
Register a callback to be invoked when a code quality data in XML format is arrived.
|
void |
setOnConnectedListener(DataManSystem.OnConnectedListener listener)
Registers a callback to be invoked when a connection to a reader is successfully established.
|
void |
setOnConnectionErrorListener(DataManSystem.OnConnectionErrorListener listener)
Register a callback to be invoked when a connection error occurs during connecting to a reader.
|
void |
setOnDisconnectedListener(DataManSystem.OnDisconnectedListener listener)
Register a callback to be invoked when disconnected from a reader.
|
void |
setOnHeartbeatResponseMissedListener(DataManSystem.OnHeartbeatResponseMissedListener listener)
Register a callback to be invoked when the response of a heartbeat command is missed.
|
void |
setOnImageArrivedListener(DataManSystem.OnImageArrivedListener listener)
Register a callback to be invoked when a read image is arrived.
|
void |
setOnImageGraphicsArrivedListener(DataManSystem.OnImageGraphicsArrivedListener listener)
Register a callback to be invoked when an image graphics in XML format is arrived.
|
void |
setOnOffProtocolByteReceivedListener(DataManSystem.OnOffProtocolByteReceivedListener listener)
Register a callback to be invoked when an off protocol byte is received.
|
void |
setOnReadStringArrivedListener(DataManSystem.OnReadStringArrivedListener listener)
Register a callback to be invoked when a simple read string is arrived.
|
void |
setOnStatusEventArrivedListener(DataManSystem.OnStatusEventArrivedListener listener)
Register a callback to be invoked when a status event is arrived.
|
void |
setOnSystemWentOfflineListener(DataManSystem.OnSystemWentOfflineListener listener)
Register a callback to be invoked when the reader went offline.
|
void |
setOnSystemWentOnlineListener(DataManSystem.OnSystemWentOnlineListener listener)
Register a callback to be invoked when the reader went online.
|
void |
setOnTrainingResultArrivedListener(DataManSystem.OnTrainingResultArrivedListener listener)
Register a callback to be invoked when a training result in XML format is arrived.
|
void |
setOnXmlResultArrivedListener(DataManSystem.OnXmlResultArrivedListener listener)
Register a callback to be invoked when a read result in XML format is arrived.
|
void |
setOnXmlStatisticsArrivedListener(DataManSystem.OnXmlStatisticsArrivedListener listener)
Register a callback to be invoked when a read statistics in XML format is arrived.
|
void |
setResultTypes(java.util.EnumSet<com.cognex.dataman.sdk.ResultType> resultTypes)
Sets the result types that should be handled by the SDK.
|
void |
setTimeout(int timeout)
Sets the timeout value (in milliseconds) used in operations that can time out.
|
public static DataManSystem createDataManSystemOverEthernet(java.net.InetAddress address)
DataManSystem object with an underlying Ethernet transport.address - The IP address of the host to connect to.DataManSystem object.public static DataManSystem createDataManSystemOverEthernet(java.net.InetAddress address, android.os.Handler handler)
DataManSystem object with an underlying Ethernet transport.address - The IP address of the host to connect to.handler - The Handler object to be used to execute the listeners on its thread.DataManSystem object.public static DataManSystem createDataManSystemOverEthernet(java.net.InetAddress address, int port)
DataManSystem object with an underlying Ethernet transport.address - The IP address of the host to connect to.port - The port of the host to connect to.DataManSystem object.public static DataManSystem createDataManSystemOverEthernet(java.net.InetAddress address, int port, android.os.Handler handler)
DataManSystem object with an underlying Ethernet transport.address - The IP address of the host to connect to.port - The port of the host to connect to.handler - The Handler object to be used to execute the listeners on its thread.DataManSystem object.public static DataManSystem createDataManSystemForMXDevice(android.content.Context context)
DataManSystem object for a connected MX device.context - The application's environment.DataManSystem object.public static DataManSystem createDataManSystemForMXDevice(android.content.Context context, android.os.Handler handler)
DataManSystem object for a connected MX device.context - The application's environment.handler - The Handler object to be used to execute the listeners on its thread.DataManSystem object.public static DataManSystem createDataManSystemOverCamera(android.content.Context context, int cameraMode, int previewOptions, android.view.ViewGroup previewContainer)
DataManSystem object for a Phone camera.context - The application's environment.cameraMode - The CameraMode when using the Mobile device camera.previewOptions - The PreviewOption when using the Mobile device camera.previewContainer - The container where the camera preview will be placed.DataManSystem object.@Deprecated public static DataManSystem createDataManSystemOverUsb(android.content.Context context, android.hardware.usb.UsbDevice device)
createDataManSystemForMXDeviceDataManSystem object with and underlying USB transport.context - The application's environment.device - The UsbDevice object to connect to.DataManSystem object.@Deprecated public static DataManSystem createDataManSystemOverUsb(android.content.Context context, android.hardware.usb.UsbDevice device, android.os.Handler handler)
createDataManSystemForMXDeviceDataManSystem object with and underlying USB transport.context - The application's environment.device - The UsbDevice object to connect to.handler - The Handler object to be used to execute the listeners on its thread.DataManSystem object.@Deprecated public static DataManSystem createDataManSystemOverUsbAccessory(android.content.Context context, android.hardware.usb.UsbAccessory accessory)
createDataManSystemForMXDeviceDataManSystem object with and underlying USB accessory transport.context - The application's environment.accessory - The UsbAccessory object to connect to.DataManSystem object.@Deprecated public static DataManSystem createDataManSystemOverUsbAccessory(android.content.Context context, android.hardware.usb.UsbAccessory accessory, android.os.Handler handler)
createDataManSystemForMXDeviceDataManSystem object with and underlying USB accessory transport.context - The application's environment.accessory - The UsbAccessory object to connect to.handler - The Handler object to be used to execute the listeners on its thread.DataManSystem object.public static DataManSystem createDataManSystemOverBlutooth(android.bluetooth.BluetoothDevice device)
DataManSystem object to a Cognex Bluetooth device.device - The BluetoothDevice object to connect to.DataManSystem object.public static DataManSystem createDataManSystemOverBlutooth(android.bluetooth.BluetoothDevice device, android.os.Handler handler)
DataManSystem object to a Cognex Bluetooth device.device - The BluetoothDevice object to connect to.handler - The Handler object to be used to execute the listeners on its thread.DataManSystem object.public static java.lang.String getVersion()
public void setFlushBufferEnabled(boolean enabled)
enabled - enables or disables buffer flushingpublic boolean isFlushBufferEnabled()
public boolean getExpectReadStringAsResponse()
setExpectReadStringAsResponse(boolean)public void setExpectReadStringAsResponse(boolean value)
value - The value indicating whether the new syntax should be used when handling DMCC results.getExpectReadStringAsResponse()public int getTimeout()
setTimeout(int),
connect(),
connect(String, String),
sendCommand(String),
sendCommand(String, OnResponseReceivedListener)public void setTimeout(int timeout)
timeout - The value to be used as timeout.getTimeout(),
connect(),
connect(String, String),
sendCommand(String),
sendCommand(String, OnResponseReceivedListener)public java.lang.String getExtraHeaderData()
setExtraHeaderData(String)public void setExtraHeaderData(java.lang.String extraHeaderData)
extraHeaderData - The extra header data to be send with all commands.getExtraHeaderData()public java.util.EnumSet<com.cognex.dataman.sdk.ResultType> getResultTypes()
ResultType,
setResultTypes(EnumSet)public void setResultTypes(java.util.EnumSet<com.cognex.dataman.sdk.ResultType> resultTypes)
resultTypes - The result types to be handled by the SDK.ResultType,
getResultTypes()public java.nio.charset.Charset getCharset()
Charset object used when converting a series of bytes from the
reader to a string.Charset object used when converting a series of bytes from
the reader to a string.setCharset(Charset)public void setCharset(java.nio.charset.Charset charset)
Charset object used when converting a series of bytes from the
reader to a string.charset - The Charset object to be used when converting a series
of bytes from the reader to a string.getCharset()public boolean isLiveImageEnabled()
true if Live Image mode is enabled, otherwise false.enableLiveImage(ImageFormat, ImageSize, ImageQuality, OnLiveImageArrivedListener),
disableLiveImage()public boolean isHeartbeatEnabled()
true if heartbeat is enabled, otherwise false.enableHeartbeat(int),
disableHeartbeat()public void setLogger(com.cognex.dataman.sdk.Logger logger)
logger - The logger object to be used for logging.public void setOnConnectedListener(DataManSystem.OnConnectedListener listener)
listener - The callback that will be invoked.connect(),
connect(String, String)public void setOnConnectionErrorListener(DataManSystem.OnConnectionErrorListener listener)
listener - The callback that will be invoked.connect(),
connect(String, String)public void setOnDisconnectedListener(DataManSystem.OnDisconnectedListener listener)
listener - The callback that will be invoked.disconnect()public void setOnBinaryDataTransferProgressListener(DataManSystem.OnBinaryDataTransferProgressListener listener)
listener - The callback that will be invoked.public void setOnOffProtocolByteReceivedListener(DataManSystem.OnOffProtocolByteReceivedListener listener)
listener - The callback that will be invoked.public void setOnReadStringArrivedListener(DataManSystem.OnReadStringArrivedListener listener)
listener - The callback that will be invoked.public void setOnXmlResultArrivedListener(DataManSystem.OnXmlResultArrivedListener listener)
listener - The callback that will be invoked.public void setOnXmlStatisticsArrivedListener(DataManSystem.OnXmlStatisticsArrivedListener listener)
listener - The callback that will be invoked.public void setOnImageArrivedListener(DataManSystem.OnImageArrivedListener listener)
listener - The callback that will be invoked.public void setOnImageGraphicsArrivedListener(DataManSystem.OnImageGraphicsArrivedListener listener)
listener - The callback that will be invoked.public void setOnTrainingResultArrivedListener(DataManSystem.OnTrainingResultArrivedListener listener)
listener - The callback that will be invoked.public void setOnCodeQualityDataArrivedListener(DataManSystem.OnCodeQualityDataArrivedListener listener)
listener - The callback that will be invoked.public void setOnStatusEventArrivedListener(DataManSystem.OnStatusEventArrivedListener listener)
listener - The callback that will be invoked.public void setOnSystemWentOnlineListener(DataManSystem.OnSystemWentOnlineListener listener)
listener - The callback that will be invoked.public void setOnSystemWentOfflineListener(DataManSystem.OnSystemWentOfflineListener listener)
listener - The callback that will be invoked.public void setOnHeartbeatResponseMissedListener(DataManSystem.OnHeartbeatResponseMissedListener listener)
listener - The callback that will be invoked.enableHeartbeat(int)public com.cognex.dataman.sdk.ConnectionState getState()
DataManSystem instance.ConnectionStatepublic boolean connect()
DataManSystem.OnConnectedListener. If an error occurs during
connecting, the user is notified via the DataManSystem.OnConnectionErrorListener.true if the connection could be initiated (the state of the connection was
ConnectionState.Disconnected, otherwise false.setTimeout(int),
setOnConnectedListener(OnConnectedListener),
setOnConnectionErrorListener(OnConnectionErrorListener)public boolean connect(java.lang.String userName,
java.lang.String password)
DataManSystem.OnConnectedListener. If an
error occurs during connecting, the user is notified via the DataManSystem.OnConnectionErrorListener.userName - The user name to authenticate with the remote system.password - The password to authenticate with the remote system.true if the connection could be initiated (the state of the connection
was ConnectionState.Disconnected, otherwise false.setTimeout(int),
setOnConnectedListener(OnConnectedListener),
setOnConnectionErrorListener(OnConnectionErrorListener)public void disconnect()
DataManSystem.OnDisconnectedListener is set,
it will be invoked after the device is disconnected.public boolean isConnected()
true if the system is connected, otherwise false.public com.cognex.dataman.sdk.ConnectionState getConnectionState()
public void sendCommand(java.lang.String command)
command - The command to be send.sendCommand(String, OnResponseReceivedListener),
sendCommand(String, byte[], int, boolean, OnResponseReceivedListener),
setTimeout(int)public void sendCommand(java.lang.String command,
DataManSystem.OnResponseReceivedListener listener)
DataManSystem.OnResponseReceivedListener.command - The command to be send.listener - The callback to be invoked when the answer to the command arrives.DataManSystem.OnResponseReceivedListener,
sendCommand(String),
sendCommand(String, byte[], int, boolean, OnResponseReceivedListener),
setTimeout(int)public void sendCommand(java.lang.String command,
byte[] data,
int timeout,
boolean expectBinaryResponse,
DataManSystem.OnResponseReceivedListener listener)
DataManSystem.OnResponseReceivedListener.command - The command to be send.data - Binary data to be send to the remote system.timeout - Timeout for the command.expectBinaryResponse - Value to indicate if we expect binary response.listener - The callback to be invoked when the answer to the command arrives.DataManSystem.OnResponseReceivedListener,
sendCommand(String),
sendCommand(String, OnResponseReceivedListener)public com.cognex.dataman.sdk.DmccResponse sendCommandSync(java.lang.String command,
byte[] data,
int timeout,
boolean expectBinaryResponse)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException
command - The command to be send.data - Binary data to be send to the remote system.timeout - Timeout for the command.expectBinaryResponse - Value to indicate if we expect binary response.DmccResponse Reader response for the sent command.java.lang.InterruptedException - if the command sending is interruptedjava.util.concurrent.TimeoutException - if the command has timed outpublic void sendBatchCommands(java.util.List<java.lang.String> commands,
DataManSystem.OnBatchCommandsCompletedListener listener)
DataManSystem.OnBatchCommandsCompletedListener.commands - The List of commands to be sent to the reader.listener - The callback to be invoked when the response to a specific command arrives.DataManSystem.OnBatchCommandsCompletedListenerpublic void enableLiveImage(com.cognex.dataman.sdk.ImageFormat imageFormat,
com.cognex.dataman.sdk.ImageSize imageSize,
com.cognex.dataman.sdk.ImageQuality imageQuality,
DataManSystem.OnLiveImageArrivedListener listener)
imageFormat - The ImageFormat object to specify the image type.imageSize - The ImageSize object to specify the image size.imageQuality - The ImageQuality object to specify the image quality.listener - The callback to be invoked when the live image arrives.disableLiveImage(),
DataManSystem.OnLiveImageArrivedListenerpublic void disableLiveImage()
public void enableHeartbeat(int interval)
interval milliseconds.
If a response to a heartbeat command is not received, the DataManSystem.OnHeartbeatResponseMissedListener
is invoked if set.interval - The interval (in milliseconds) between heartbeat commands.disableHeartbeat(),
setOnHeartbeatResponseMissedListener(OnHeartbeatResponseMissedListener)public void disableHeartbeat()
enableHeartbeat(int)