FirmwareUpdaterLinkOsUpdateFirmware(String, FirmwareUpdateHandler) Method
|
Update firmware on the printer using the default timeout of 10 minutes.
Namespace: Zebra.Sdk.PrinterAssembly: SdkApi.Core (in SdkApi.Core.dll) Version: 4.0.3435
Syntaxvoid UpdateFirmware(
string firmwareFilePath,
FirmwareUpdateHandler handler
)
Sub UpdateFirmware (
firmwareFilePath As String,
handler As FirmwareUpdateHandler
)
void UpdateFirmware(
String^ firmwareFilePath,
FirmwareUpdateHandler^ handler
)
Parameters
- firmwareFilePath String
- File path of firmware file.
- handler FirmwareUpdateHandler
- Callback for firmware updating status
Exceptions| 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. |
Remarks
If the firmware currently on the printer has the same version number as the
firmware file, the firmware will not be sent to the printer.
Exampleusing System;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
public class UpdatePrinterFirmwareExample {
public static void Main(string[] args) {
string theIpAddress = "1.2.3.4";
string firmwareFilePath = "fullPathToFirmwareFile";
Connection connection = new TcpConnection(theIpAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.Open();
ZebraPrinterLinkOs p = ZebraPrinterFactory.GetLinkOsPrinter(connection);
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) {
}
}
}
See Also