public final class TcpDevice extends Device
Device.EventDispatcher
Constructor and Description |
---|
TcpDevice(java.lang.String ip)
Default constructor.
|
TcpDevice(java.lang.String ip,
int tcpPort)
Create a TcpDevice instance and connect it to a remote device.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAlert(Alert alert)
Ask the remote device to add an Alert.
|
boolean |
addBadgeReader(java.lang.String serialNumber,
java.lang.String serialPortName,
boolean isMaster)
Allows virtually "plugging-in" a Badge Reader to this Device.
|
boolean |
addFingerprintReader(java.lang.String serialNumber,
boolean isMaster)
Allows virtually "plugging-in" a Fingerprint Reader to this Device.
|
boolean |
addTemperatureProbe(java.lang.String serialNumber,
int delay,
double eventDelta)
Try to connect and add a temperature probe with given serial number.
|
java.util.List<AlertReport> |
getAlertReports(java.util.Date from,
java.util.Date to,
java.util.List<Alert> alertsList)
Get alert reports (if any) made during a certain period, for given alerts.
|
java.util.List<Alert> |
getAlertsList() |
java.util.List<Authentication> |
getAuthentications(java.util.Date from,
java.util.Date to)
Allow getting authentications (if any) recorded during a certain period.
|
double |
getCurrentTemperature() |
DbConfiguration |
getDbConfiguration()
Get the configuration of the remote device database.
|
java.lang.String |
getHardwareVersion() |
DeviceStatus |
getImmediateStatus() |
java.util.List<Inventory> |
getInventories(java.util.Date from,
java.util.Date to)
Allow getting inventories (if any) recorded during a certain period.
|
Inventory |
getInventoryById(int id)
Deprecated.
Internal usage. Should not be used by SDK users.
Allow getting an inventory by its unique identifier. |
java.lang.String |
getIpAddress() |
AlertReport |
getLastAlertReport() |
Inventory |
getLastInventory()
Get the inventory (if any) resulting from the last scan operation.
|
ProbeSettings |
getProbeSettings()
Get the configuration of the temperature probe.
|
SmtpServer |
getSmtpServer() |
java.lang.String |
getSoftwareVersion() |
java.util.Map<java.lang.String,java.lang.Byte> |
getTagToDrawerNumber()
Spacecode Devices equipped with many drawers memorize (for each tag) by which drawer a given UID has been
scanned for the last time.
|
java.util.Map<java.util.Date,java.lang.Double> |
getTemperatureMeasures(java.util.Date from,
java.util.Date to)
Get temperature measures (if any) recorded during a certain period.
|
UsersService |
getUsersService()
Provide access to the Users Management service.
|
boolean |
reconnect()
Try to reconnect the TCP client to SmartServer.
|
void |
release()
Closes the TCP connection, shutdown the thread pool dedicated to event handling.
|
boolean |
removeAlert(Alert alert)
Ask the remote device to remove an Alert.
|
void |
requestScan(ScanOption... options)
Order the RFID reader board to process a "MANUAL" scan operation.
|
RewriteUidResult |
rewriteUid(java.lang.String oldUid,
java.lang.String newUid)
This implementation sends the "rewrite UID" order to SmartServer.
|
boolean |
setDbConfiguration(DbConfiguration dbConfiguration)
Update the settings of the remote device database.
|
boolean |
setLightIntensity(int value)
Set the embedded LED's light intensity (for devices equipped with embedded LED's, like the SAS).
|
boolean |
setProbeSettings(ProbeSettings settings)
Configure the temperature probe of the remote device.
|
boolean |
setSmtpServer(SmtpServer smtpServer)
Set or update the SMTP server used by the device to raise alerts by email.
|
boolean |
setThiefFingerIndex(java.lang.String username,
FingerIndex fingerIndex)
Ask the remote device to set a user's "thief finger" index.
|
boolean |
startLightingTagsLed(java.util.List<java.lang.String> tagsUid)
Sends a StartLighting request to the device.
|
boolean |
stopLightingTagsLed()
This implementation sends the "stop lighting" order to SmartServer.
|
boolean |
stopScan()
Ask the device to stop the current scan (if any).
|
boolean |
updateAlert(Alert alert)
Ask the remote device to update an Alert.
|
void |
updateStatus(DeviceStatus status)
Apply the new (given) status and emit the event "Device Status Changed" with its value.
|
addListener, addScale, addScale, adminQuery, disconnectTemperatureProbe, flashFirmware, getDeviceType, getPluggedDevices, getSerialNumber, getStatus, removeListener, setLastInventory, setStatus
public TcpDevice(java.lang.String ip) throws DeviceCreationException
ip
- IPv4 address of the remote device.DeviceCreationException
public TcpDevice(java.lang.String ip, int tcpPort) throws DeviceCreationException
ip
- IPv4 address of the remote device.tcpPort
- TCP Port number.DeviceCreationException
- If a parameter is invalid or the connection failed.public java.lang.String getIpAddress()
public boolean reconnect()
public boolean addAlert(Alert alert)
alert
- Alert to be added.public boolean updateAlert(Alert alert)
alert
- Alert to be updated.public boolean removeAlert(Alert alert)
alert
- Alert to be removed.public java.util.List<Alert> getAlertsList()
public java.util.List<AlertReport> getAlertReports(java.util.Date from, java.util.Date to, java.util.List<Alert> alertsList)
getAlertsList
).from
- Period start date.to
- Period end date.alertsList
- Alerts (/!\ provided by the remote device) concerned by the reports research.public java.util.List<Authentication> getAuthentications(java.util.Date from, java.util.Date to)
from
- Period start date.to
- Period end date.public DbConfiguration getDbConfiguration()
public AlertReport getLastAlertReport()
public java.util.List<Inventory> getInventories(java.util.Date from, java.util.Date to)
from
- Period start date.to
- Period end date.public DeviceStatus getImmediateStatus()
@Deprecated public Inventory getInventoryById(int id)
id
- Integer value (Id of the desired Inventory)public ProbeSettings getProbeSettings()
public SmtpServer getSmtpServer()
public java.util.Map<java.util.Date,java.lang.Double> getTemperatureMeasures(java.util.Date from, java.util.Date to)
from
- Period start date.to
- Period end date.public boolean setDbConfiguration(DbConfiguration dbConfiguration)
dbConfiguration
- New Database Configuration to be set.public boolean setProbeSettings(ProbeSettings settings)
settings
- Configuration of the probe (delay, delta, enabled/disabled).public boolean setSmtpServer(SmtpServer smtpServer)
smtpServer
- SmtpServer instance to be used as new SMTP server by this device.public boolean setThiefFingerIndex(java.lang.String username, FingerIndex fingerIndex)
username
- User to be updated.fingerIndex
- FingerIndex value (null to remove "thief finger" from User).public void release()
public UsersService getUsersService()
getUsersService
in class Device
UsersService
instance.public void requestScan(ScanOption... options)
Device
requestScan
in class Device
options
- List of ScanOption
(or none) to be used for the new scan operation.public boolean stopScan()
public java.lang.String getHardwareVersion()
getHardwareVersion
in class Device
public java.lang.String getSoftwareVersion()
getSoftwareVersion
in class Device
public boolean startLightingTagsLed(java.util.List<java.lang.String> tagsUid)
startLightingTagsLed
in class Device
tagsUid
- Tags UID's to be lighted.public boolean stopLightingTagsLed()
stopLightingTagsLed
in class Device
public RewriteUidResult rewriteUid(java.lang.String oldUid, java.lang.String newUid)
rewriteUid
in class Device
oldUid
- UID of the tag the User wants to "rename".newUid
- new UID to be written.public Inventory getLastInventory()
Device
getLastInventory
in class Device
public double getCurrentTemperature()
getCurrentTemperature
in class Device
public java.util.Map<java.lang.String,java.lang.Byte> getTagToDrawerNumber()
getTagToDrawerNumber
in class Device
public boolean setLightIntensity(int value)
setLightIntensity
in class Device
value
- [0;300] (0 - turn off, 300 - maximal intensity).public void updateStatus(DeviceStatus status)
Device
status
- New status.public boolean addFingerprintReader(java.lang.String serialNumber, boolean isMaster)
Device
addFingerprintReader
in class Device
serialNumber
- Serial number of the Fingerprint Reader.isMaster
- If true, the reader will be considered as Master.public boolean addBadgeReader(java.lang.String serialNumber, java.lang.String serialPortName, boolean isMaster)
Device
addBadgeReader
in class Device
serialNumber
- Serial number of the Badge reader (can't be null nor empty, must be unique).serialPortName
- Serial port name to be used to connect to the Badge Reader (e.g. "COM7").isMaster
- If true, the reader will be considered as Master.public boolean addTemperatureProbe(java.lang.String serialNumber, int delay, double eventDelta)
Device
addTemperatureProbe
in class Device
serialNumber
- Serial number of the probe to be connected.
If empty, the first probe available will be used.delay
- Delay (seconds) between each measurement.
Minimum: ProbeModule.MIN_MEASURE_DELAYeventDelta
- Measure of next variation (°C) required to notify a new measure (event).
Minimum: ProbeModule.MIN_MEASURE_DELTA