WebDAV File Transfer
It is often the case with embedded applications that log files are saved directly on the real-time system. However, due to memory limitations, we need to retrieve these files to view the information, archive the files, and alleviate memory space on the real-time system. The following article describes the process for efficiently transferring files from a CompactRIO chassis to a Windows PC using the WebDAV toolkit for LabVIEW.
Configuring cRIO for WebDAV File Transfer
The WebDAV Server and SSL Support for LabVIEW RT should be loaded into cRIO software by default. You can confirm this in NI MAX under the remote target > Software > NI Compact RIO. Once the WebDAV Server is on your target, you can begin using the WebDAV VIs in LabVIEW (Windows) to access files on your RT target. It’s as easy as that!
Accessing RT Files With LabVIEW for Windows
The WebDAV toolkit resides in Data Communication > Protocols > WebDAV on the Functions palette. This toolkit has both synchronous and asynchronous interface options. Synchronous will be discussed in this article.
Open a session to the WebDAV server with the host uri prefix and login information (the login information for your target cRIO). The host uri should be formatted as http://<targetaddress>/
Use Get.vi to transfer files from RT to Windows. You must specify the relative uri (meaning the rest of the file path after “/files”) and the local file path on the Windows machine that you would like to transfer the file to.
If you would like to delete files off of the cRIO after transferring them, use the Delete.vi function and specify the same relative uri used in Get.vi.
The Directory Listing.vi function is helpful when you need to transfer all files from a particular directory. This function returns a list of the files stored in the specified directory including their full uri and display name (which is just the file name).
The example described above (LabVIEW 2017) can be downloaded here:
Configuring Windows for WebDAV File Transfer
If you would like to view the files on your cRIO directly on your Windows machine, you will need to create a mapped network drive. This configuration process depends on your Windows version. Instructions can be found here:
Caveats and Recommendations
- NI recommends using WebDAV (over the legacy FTP toolkit) for secure file transfers.
- It is important that you know where files are saved on your cRIO before transferring them. Linux only allows write access in the following directories:
- /tmp (NOTE: Your target deletes the content in the temporary folder /tmp on target restart)