Firmware
|
Exception | Condition |
---|---|
ConnectionException | If the connection can not be opened, is closed prematurely, or connection cannot be established after firmware download is complete. |
ZebraPrinterLanguageUnknownException | If the printer language can not be determined. |
ZebraIllegalArgumentException | If an invalid firmware file is specified for the printer. |
DiscoveryException | If an error occurs while waiting for the printer to come back online. |
TimeoutException | If the maximum timeout is reached prior to the printer coming back online with the new firmware. |
FileNotFoundException | Firmware file not found. |
using System; using Zebra.Sdk.Comm; using Zebra.Sdk.Printer; public class UpdatePrinterFirmwareExample { public static void Main(string[] args) { string theIpAddress = "1.2.3.4"; // File path, e.g. "D:\\ZV68_19_6Z.zpl" string firmwareFilePath = "fullPathToFirmwareFile"; Connection connection = new TcpConnection(theIpAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT); try { connection.Open(); ZebraPrinterLinkOs p = ZebraPrinterFactory.GetLinkOsPrinter(connection); // Send the firmware file to the printer. p.UpdateFirmware(firmwareFilePath, new UpdateFirmareHandler()); } catch (Exception e) { Console.WriteLine(e.ToString()); } finally { connection.Close(); } } private class UpdateFirmareHandler : FirmwareUpdateHandler { public override void FirmwareDownloadComplete() { Console.WriteLine("Firmware download complete."); } public override void PrinterOnline(ZebraPrinterLinkOs printer, string firmwareVersion) { Console.WriteLine($"Printer online with firmware version={firmwareVersion}"); } public override void ProgressUpdate(int bytesWritten, int totalBytes) { } } }