Package com.zebra.sdk.printer
Class PrinterAlert
Object
com.zebra.sdk.printer.PrinterAlert
- All Implemented Interfaces:
Serializable
Defines a printer alert. Applicable only to ZPL printers.
package test.zebra.sdk.printer.examples;
import com.zebra.sdk.printer.PrinterAlert;
import com.zebra.sdk.settings.AlertCondition;
import com.zebra.sdk.settings.AlertDestination;
public class PrinterAlertExample {
public static void main(String[] args) {
PrinterAlert myPrinterAlert = new PrinterAlert(AlertCondition.PAPER_OUT, AlertDestination.TCP, true, false, "10.3.4.5", 9100, false);
PrinterAlert myGenericAlert = myPrinterAlert;
System.out.println("Alert Info:");
System.out.println(" Condition = " + myGenericAlert.getCondition());
System.out.println(" Destination = " + myGenericAlert.getDestinationAsSgdString());
System.out.println(" Address = " + myGenericAlert.getDestinationAddress());
System.out.println(" Port = " + myGenericAlert.getPort());
System.out.println(" Fire when condition occurs? = " + myPrinterAlert.isOnSet());
System.out.println(" Fire when condition clears? = " + myPrinterAlert.isOnClear());
System.out.println(" Are alerts quelled? = " + myPrinterAlert.getQuelling());
}
}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPrinterAlert(AlertCondition condition, AlertDestination destination, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling) Creates an instance of a PrinterAlert object.PrinterAlert(AlertCondition condition, AlertDestination destination, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling, String alertText) Creates an instance of a PrinterAlert object, including the printer alert text.PrinterAlert(AlertCondition condition, AlertDestination destination, String sgdName, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling) Creates an instance of a PrinterAlert object, including a Set-Get-Do name.PrinterAlert(AlertCondition condition, AlertDestination destination, String sgdName, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling, String alertText) Creates an instance of a PrinterAlert object, including a Set-Get-Do name and the printer alert text. -
Method Summary
Modifier and TypeMethodDescriptionReturn the text received from the printer.Return theAlertConditionof the alert.Return theAlertDestinationused by the alert.Return the destination where the alert should be sent, for example, an IP Address or an email address, depending on the value of getDestinationAsSGDString.Return theStringrepresentation of the alert destination for Set-Get-Do.intgetPort()Return the destination port number where the alert should be sent.booleanReturn the quelling state of the alert.Return theStringrepresentation of the Set-Get-Do Name.booleanReturn alert will be triggered on 'clear'.booleanisOnSet()Return true if the alert is fired when 'set'.
-
Constructor Details
-
PrinterAlert
public PrinterAlert(AlertCondition condition, AlertDestination destination, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling) Creates an instance of a PrinterAlert object.- Parameters:
condition- The printer condition that will trigger the alert.destination- The destination that the alert will be sent to.onSet- If true, the alert will be triggered when the condition occurs.onClear- If true, the alert will be triggered when the condition is cleared.destinationAddress- The destination address, if the destination requires one.port- The destination port, if the destination requires one.quelling- If true, the alert is quelled.
-
PrinterAlert
public PrinterAlert(AlertCondition condition, AlertDestination destination, String sgdName, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling) Creates an instance of a PrinterAlert object, including a Set-Get-Do name.- Parameters:
condition- The printer condition that will trigger the alert.destination- The destination that the alert will be sent to.sgdName- IfconditionisSGD_SET, the name of the Set-Get-Do to be monitored.onSet- If true, the alert will be triggered when the condition occurs.onClear- If true, the alert will be triggered when the condition is cleared.destinationAddress- The destination address, if the destination requires one.port- The destination port, if the destination requires one.quelling- If true, the alert is quelled.
-
PrinterAlert
public PrinterAlert(AlertCondition condition, AlertDestination destination, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling, String alertText) Creates an instance of a PrinterAlert object, including the printer alert text.- Parameters:
condition- The printer condition that will trigger the alert.destination- The destination that the alert will be sent to.onSet- If true, the alert will be triggered when the condition occurs.onClear- If true, the alert will be triggered when the condition is cleared.destinationAddress- The destination address, if the destination requires one.port- The destination port, if the destination requires one.quelling- If true, the alert is quelled.alertText- The text received from the printer.
-
PrinterAlert
public PrinterAlert(AlertCondition condition, AlertDestination destination, String sgdName, boolean onSet, boolean onClear, String destinationAddress, int port, boolean quelling, String alertText) Creates an instance of a PrinterAlert object, including a Set-Get-Do name and the printer alert text.- Parameters:
condition- The printer condition that will trigger the alert.destination- The destination that the alert will be sent to.sgdName- IfconditionisSGD_SET, the name of the Set-Get-Do to be monitored.onSet- If true, the alert will be triggered when the condition occurs.onClear- If true, the alert will be triggered when the condition is cleared.destinationAddress- The destination address, if the destination requires one.port- The destination port, if the destination requires one.quelling- If true, the alert is quelled.alertText- The text received from the printer.
-
-
Method Details
-
getDestinationAsSgdString
Return theStringrepresentation of the alert destination for Set-Get-Do.- Returns:
- The alert destination as a string required for Set-Get-Do. Intended for internal use only.
-
getDestinationAddress
Return the destination where the alert should be sent, for example, an IP Address or an email address, depending on the value of getDestinationAsSGDString.- Returns:
- destination address
-
getPort
public int getPort()Return the destination port number where the alert should be sent.- Returns:
- port number
-
getCondition
Return theAlertConditionof the alert.- Returns:
- AlertCondition
-
getSgdName
Return theStringrepresentation of the Set-Get-Do Name.- Returns:
- The Set-Get-Do name as a
String
-
isOnSet
public boolean isOnSet()Return true if the alert is fired when 'set'.- Returns:
- alert will be triggered on set
-
isOnClear
public boolean isOnClear()Return alert will be triggered on 'clear'.- Returns:
- is on clear
-
getDestination
Return theAlertDestinationused by the alert.- Returns:
- protocol used by the alert
-
getQuelling
public boolean getQuelling()Return the quelling state of the alert.- Returns:
- quelling flag
-
getAlertText
Return the text received from the printer.- Returns:
- the text received from the printer.
-