public interface AlertProvider
package test.zebra.sdk.printer.examples;
import java.util.List;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection;
import com.zebra.sdk.device.ZebraIllegalArgumentException;
import com.zebra.sdk.printer.PrinterAlert;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
import com.zebra.sdk.printer.ZebraPrinterLinkOs;
public class AlertProviderExample {
public static void main(String[] args) throws Exception {
TcpConnection connection = new TcpConnection("192.168.1.32", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter genericPrinter = ZebraPrinterFactory.getInstance(connection);
ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(genericPrinter);
if (linkOsPrinter != null) {
List<PrinterAlert> alerts = linkOsPrinter.getConfiguredAlerts();
for (PrinterAlert thisAlert : alerts) {
System.out.println(thisAlert.getCondition() + " " + thisAlert.getDestinationAsSgdString());
}
}
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} catch (ZebraIllegalArgumentException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
Modifier and Type | Method and Description |
---|---|
void |
configureAlert(PrinterAlert alert)
Configures an alert to be triggered when the alert's condition occurs or becomes resolved.
|
void |
configureAlerts(List<PrinterAlert> alerts)
Configures a list of alerts to be triggered when their conditions occur or become resolved.
|
List<PrinterAlert> |
getConfiguredAlerts()
A list of objects detailing the alert configuration of a printer.
|
void |
removeAlert(PrinterAlert alert)
Removes a configured alert from a printer.
|
void |
removeAllAlerts()
Removes all alerts currently configured on a printer.
|
List<PrinterAlert> getConfiguredAlerts() throws ConnectionException, ZebraIllegalArgumentException
ConnectionException
ZebraIllegalArgumentException
void configureAlert(PrinterAlert alert) throws ConnectionException
alert
- the alert to trigger when it's condition occurs or becomes resolved.ConnectionException
void configureAlerts(List<PrinterAlert> alerts) throws ConnectionException
alerts
- the list of alerts to trigger when their conditions occur or become resolved.ConnectionException
void removeAlert(PrinterAlert alert) throws ConnectionException
alert
- to be removed from the configurationConnectionException
void removeAllAlerts() throws ConnectionException
ConnectionException
© 2015 ZIH Corp. All Rights Reserved.