Trouble programmatically getting the firmware and hardware versions (link-os)

D Del Brown 3 years 7 months ago
184 1 0

I have an iOS app which implements Link-OS for receipt printing to the iMZ220 bluetooth printer.
 
Occasionally a couple of our customers complain about receipts printing multiple copies (not at the end of a roll).  One of the troubleshooting steps that could really help me (I think) is being able to correlate details, like firmware version, and possibly hardware version.
 
Looking through Link-OS, I couldn't find a way to get the firmware version and the hardware version.
 
I *am* able to provide a way for the user to print a configuration label as follows:
 
    var serialNumber: String?
    if let connectedPrinter = EAAccessoryManager.shared().connectedAccessories.first(where:{$0.protocolStrings.contains(where: {$0 == "com.zebra.rawport"})}){
      serialNumber = connectedPrinter.serialNumber
        DispatchQueue.global(qos: .utility).async(execute: {
          let zebraConnection = MfiBtPrinterConnection(serialNumber: serialNumber)
          zebraConnection?.open()
          do{
            let zebraPrinter = try ZebraPrinterFactory.getInstance(zebraConnection)
            try zebraPrinter.getToolsUtil().printConfigurationLabel()
          } catch{
            DDLogVerbose("Couldn't get the zebraPrinter instance or the printConfigurationLabel failed")
          }
          zebraConnection?.close()
        })
    }
 
which spits out some useful info, but I want to programmatically log those versions, not require the end user to print the configuration label and then somehow send it to me (via email, mms or some such).
 
So I resorted to using iOS's EAAccessory.  This does not appear to be accurate for firmareRevision and harwareRevision.
 
    let connectedPrinter = EAAccessoryManager.shared().connectedAccessories.first(where:{$0.protocolStrings.contains(where: {$0 == "com.zebra.rawport"})}){
 
In Xcode's debug console, I print the connectedPrinter object:
 
po connectedPrinter
 
{
  connected:YES
  connectionID:19337234
  name: XXXXJ154601825
  manufacturer: Zebra Technologies
  modelNumber: iMZ220
  serialNumber: XXXXJ154601825
  firmwareRevision: 0.0.1
  hardwareRevision: 0.0.1
  dockType: (null)
protocols: (
    "com.zebra.rawport"
)
 
As you can see, some of the info is very helpful to me: name, manufacturer, modelNumber, and serialNumber.  But the firmwareRevison and hardwareRevision are useless.
 
The printed configuration label shows me:
 
V73.19.13Z

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

Hi Del,
This is where the SGD class comes in.  It is the primary way to work with settings and printer configuration.  The two "settings" you are looking for are "appl.name" for firmware, "device.product_name" for model, and  "device.unique_id" for serial number.

BOOL success = [zebraPrinterConnection open];
NSError *error = nil;
id printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error];
NSString *firmware = [SGD GET:"appl.name" withPrinterConnection:zebraPrinterConnection error:&error];
NSLog(@"The Firmware version is: %", firmware);
[zebraPrinterConnection close];
if (error != nil || printer == nil || success == NO)
{
    UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [errorAlert show]; [errorAlert release];
}
[zebraPrinterConnection release];

CONTACT
Can’t find what you’re looking for?