This site uses cookies to bring you the best experience. Find out more
Skip to main content

blog

Command Line Interface to 3rd Party Hardware

Introduction

A recent application called for interaction with 3rd party applications via their CLI (Command Line Interface). The interaction process was reasonably lengthy (a few minutes) and we wanted to display progress information (i.e. process output) to the user while this was running. The standard System Exec VI in LabVIEW is synchronous only, unless you want to forget the output from the process, and therefore only gives output on completion of the process.

Solution

Initially we created a workaround that made use of the 3rd party applications' log files to create the progress display. By reading the file periodically during the process, we could display the latest progress to the user. However, this left us with other problems, we had no way to stop the process if, for example, we could see that something had not been set up correctly, and if for whatever reason the call to system exec did not exit, this left our software hanging.

What we needed was a way to call the system exec asynchronously, allowing a two way interchange of messages between our application and the CLI of the 3rd party application, and to allow this process to be terminated in a friendly fashion if necessary. Having done a little searching we came across the following library from John Medlandserenial / Asynchronous System Exec · GitLab (ASE library) which really gave us everything we needed out of the box. An alternative was JKI .NET System Exec Toolkit for LabVIEW - Download - VIPM by JKI, however at the time of development this did not have functionality to stop the process.

The ASE library was really easy to use, requiring just 4 well designed VI's to get us up and running:

 

The ASE library makes use of user events to provide updates to LabVIEW from Standard Output and Standard Error, also the Did Exit event occurs when the process has completed. These events gave us the functionality we needed to provide feedback to the user. The Send Terminate VI also gave us the required functionality to terminate the process as and when required.

As we were working with the Actor framework on this project, we wrapped these VIs up in an event structure in our actor core and now have a tool we can use for any asynchronous system exec call requirements in future. Nice! 😊

Any of this ring bells with expereinces you have had? We'd love to hear from you about them, just drop us message on LinkedIn or email mlug@argentaconsult.com.

Back to Blog listings

ARGENTA IS A LEADING PROVIDER OF PRODUCT RELIABILITY AND PROCESS IMPROVEMENT SOLUTIONS.

Call 0121 514 2290 to discuss your requirements