Click or drag to resize

AlertProvider Interface

This is an utility class for getting/setting alerts on a printer.

Namespace: Zebra.Sdk.Printer
Assembly: SdkApi.Core (in SdkApi.Core.dll) Version: 3.0.3271
Syntax
public interface AlertProvider

The AlertProvider type exposes the following members.

Methods
 NameDescription
Public methodConfigureAlert Configures an alert to be triggered when the alert's condition occurs or becomes resolved.
Public methodConfigureAlerts Configures a list of alerts to be triggered when their conditions occur or become resolved.
Public methodGetConfiguredAlerts A list of objects detailing the alert configuration of a printer.
Public methodRemoveAlert Removes a configured alert from a printer. They may be reconfigured via the configureAlert(s) methods.
Public methodRemoveAllAlerts Removes all alerts currently configured on a printer. They may be reconfigured via the configureAlert(s) methods.
Top
Example
C#
using System;
using System.Collections.Generic;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;

public class AlertProviderExample {

    public static void Main(string[] args) {
        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();
                foreach (PrinterAlert thisAlert in alerts) {
                    Console.WriteLine($"{thisAlert.Condition} {thisAlert.DestinationAsSgdString}");
                }
            }
        } catch (ConnectionException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraIllegalArgumentException e) {
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
        }
    }
}
See Also