APPFORUM 2019: Zebra SDK Optimization – Making it easier for developers

Decision makers outline several factors when they are evaluating competitors during technology purchase processes. To be on top, technological companies are competing to have SDKs, APIs, Utility Apps and cloud platforms easier to work with for developers and ISVs who influence, and sometimes decide on these purchases.

We’ll review these concepts while focusing on how the Link-OS SDK has been optimized which was designed for Zebra printers. From the integration solution perspective, a printer is considered a peripheral device, so it implies that the device could be connected to different type of hosts, these can be mobile computers, desktop computers, tablets, industrial controllers, and in the future to robots, autonomous vehicles, cyborgs, space aircraft, etc.

There are multiple ways to architecture SDKs, but for our analysis we have defined the following categories that help to highlight areas where efficiencies are possible to make.

  • Customer Base
  • Technology Adoption & Harmonization
  • Complexity Absorption
  • Architecture & Logical Implementation
  • Support

When reviewing Customer Base, we defined Developer/user Preferences, Use Cases Implementation and On-demand requests as sub-categories. In Developer/user preferences we can analyze optimizations based on efficiencies achieved in IDE Integration, programming Languages, Platforms and Deployment. In Use Cases Implementation, we try to listen carefully Voice of the Customer (VOC), and we develop classes/process to optimize and solve specific customer needs. In On-demand requests, we normally develop optimizations by analyzing market or customer trends that directly affect the performance of customer processes.

Let’s review in detail an example of a Customer Base - SDK optimization with the following developer use case question - How to optimize the time to print a label by knowing the status of the printer?  we see this type of post almost daily on our Zebra Developer Portal.  Few years ago, the only option was to print sequentially to accomplish it as the pseudo code shows below.

          1. Open connection
          2. Set up printer language to ZPL
          3. Check status of the printer
          4. If status of the printer ok
            • Then send to ZPL to print
            • Close connection
          5. Otherwise
            • Close connection

Starting with our Link-OS version 2.5 release, multichannel capacity was added to our SDK to implement the same logic in a parallel process. Check out the code below to better understand how this was optimized.

private void nonBlockingStatusReportingOverMultichannel(String theIpAddress) {

         try {

             // Instantiate Multichannel connection for simultaneous printing and status reporting at given address

             Connection thePrinterConn = ConnectionBuilder.build("TCP_MULTI:" + theIpAddress + ":9100:9200");

             // Opens the connection - physical connection is established here.

             thePrinterConn.open();

             // Creates a Link-OS printing with the given connection

             ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.getLinkOsPrinter(thePrinterConn);

             // This is sent over the printing channel (9100 by default) and will block the printing channel until the

             // label format is completely sent.

             String labelFormatStartCommand = "^XA";

linkOsPrinter.sendCommand(labelFormatStartCommand);

             String labelBody = "^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS";

             linkOsPrinter.sendCommand(labelBody);

             // This is sent over the status channel (9200 by default) and will return immediately even though the

             // printing channel is in use.

             // If a TcpConnection were used instead of a MultichannelTcpConnection, this would not be possible.

             PrinterStatus status = linkOsPrinter.getCurrentStatus();

             System.out.println("The printer PAUSED state is : " + status.isPaused);

             // Send the end of label command to finish and print the label.

             String labelFormatEndCommand = "^XZ";

linkOsPrinter.sendCommand(labelFormatEndCommand);

             // Close the connection to release resources.

             thePrinterConn.close();

         } catch (ConnectionException e) {

             // Handle communications error here.

             e.printStackTrace();

         }

     }

Now, you can use one channel to print, and another channel to listen printer status or capture SGD status information of the printer, simultaneously. With this optimization, developers and ISVs have reduced time considerably for printing and monitoring, reducing this potentially up to 300 milliseconds for the print job, while keeping the same speed and darkness.

We will be reviewing the other cases of optimization in our APPFORUM event series. Join us at  Zebra’s APPFORUM 2019; a forum where tech leaders and developers focused on building and deploying enterprise solutions, build knowledge, exchange ideas and network with peers. Our first event , in Europe, Warsaw, Poland, is now open for registration  from Jun 4th through Jun 6th. For more info, please, click here.