FileTransfer Sample: Difference between revisions
(Created page with '== Introduction == This example demonstrates a simple technique to enable file transfers between the host and target device through the use of helper functions that invoke [[File…') |
|||
Line 15: | Line 15: | ||
=== s2_filetransfer_testmodule === | === s2_filetransfer_testmodule === | ||
This test module implements a single test that shows how to invoke a remote helper function to initiate the transfer of files | This test module implements a single test that shows how to invoke a remote helper function to initiate the transfer of files. The test scenario illustrates some of the techniques available to transfer files using the STRIDE services. | ||
==== file_loopback ==== | ==== file_loopback ==== | ||
Line 21: | Line 21: | ||
# creates a text file containing random characters | # creates a text file containing random characters | ||
# invokes the remote function '''FileLoopback''', specifying the file we created as input and a new file name as output (to be created by the software on device). | |||
# verifies that the output file was created and that it matches the original input file. | |||
[[Category:Samples]] | [[Category:Samples]] |
Latest revision as of 17:49, 29 January 2010
Introduction
This example demonstrates a simple technique to enable file transfers between the host and target device through the use of helper functions that invoke File Transfer Services APIs. These techniques are particularly useful for devices that don't have externally accessible file systems as a way to transfer large volumes of data to/from the device for the purpose of testing (e.g. media data when testing a media player application).
Source (helper utilities)
s2_filetransfer_util.c / h
These files implement the following functions to read from and write to the host filesystem:
- readFromHost
- reads a specified file path from the host and creates a stdio temporary file handle with the contents of the file.
- writeToHost
- writes the contents of a filehandle to the specified host path.
- FileLoopback
- remotely callable function that takes two paths - the file to read from and the file to write to (will be created). This function is called by our test to cause files to be transferred to/from the host.
Tests Description
s2_filetransfer_testmodule
This test module implements a single test that shows how to invoke a remote helper function to initiate the transfer of files. The test scenario illustrates some of the techniques available to transfer files using the STRIDE services.
file_loopback
This test does the following:
- creates a text file containing random characters
- invokes the remote function FileLoopback, specifying the file we created as input and a new file name as output (to be created by the software on device).
- verifies that the output file was created and that it matches the original input file.