Class PrinterAlert

Object
com.zebra.sdk.printer.PrinterAlert
All Implemented Interfaces:
Serializable

public class PrinterAlert extends Object implements 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 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 - If condition is SGD_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 - If condition is SGD_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

      public String getDestinationAsSgdString()
      Return the String representation 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

      public String 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

      public AlertCondition getCondition()
      Return the AlertCondition of the alert.
      Returns:
      AlertCondition
    • getSgdName

      public String getSgdName()
      Return the String representation 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

      public AlertDestination getDestination()
      Return the AlertDestination used by the alert.
      Returns:
      protocol used by the alert
    • getQuelling

      public boolean getQuelling()
      Return the quelling state of the alert.
      Returns:
      quelling flag
    • getAlertText

      public String getAlertText()
      Return the text received from the printer.
      Returns:
      the text received from the printer.