Package com.zebra.sdk.printer
Interface AlertProvider
- All Known Subinterfaces:
ZebraPrinterLinkOs
- All Known Implementing Classes:
Profile
public interface AlertProvider
This is an utility class for getting/setting alerts on a printer.
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.ZebraPrinterFactory;
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();
ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.getLinkOsPrinter(connection);
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 (ZebraIllegalArgumentException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureAlert(PrinterAlert alert) Configures an alert to be triggered when the alert's condition occurs or becomes resolved.voidconfigureAlerts(List<PrinterAlert> alerts) Configures a list of alerts to be triggered when their conditions occur or become resolved.A list of objects detailing the alert configuration of a printer.voidremoveAlert(PrinterAlert alert) Removes a configured alert from a printer.voidRemoves all alerts currently configured on a printer.
-
Method Details
-
getConfiguredAlerts
A list of objects detailing the alert configuration of a printer.- Returns:
- a list of alert objects currently configured on the printer.
- Throws:
ConnectionExceptionZebraIllegalArgumentException
-
configureAlert
Configures an alert to be triggered when the alert's condition occurs or becomes resolved.- Parameters:
alert- the alert to trigger when it's condition occurs or becomes resolved.- Throws:
ConnectionException
-
configureAlerts
Configures a list of alerts to be triggered when their conditions occur or become resolved.- Parameters:
alerts- the list of alerts to trigger when their conditions occur or become resolved.- Throws:
ConnectionException
-
removeAlert
Removes a configured alert from a printer. They may be reconfigured via the configureAlert(s) methods.- Parameters:
alert- to be removed from the configuration- Throws:
ConnectionException
-
removeAllAlerts
Removes all alerts currently configured on a printer. They may be reconfigured via the configureAlert(s) methods.- Throws:
ConnectionException
-