DMS cloud file system operations. More...

Functions

zos_result_t zn_dms_file_open (zos_dms_target_t target, zos_dms_file_t *file, zos_dms_handle_t *handle_ptr)
 Open a file on DMS Device or DMS Product's Cloud Filesystem for reading. More...
 
zos_result_t zn_dms_file_create (zos_dms_target_t target, const zos_dms_file_t *file, zos_dms_handle_t *handle_ptr)
 Open a file on DMS Device's Cloud Filesystem for writing. More...
 
zos_result_t zn_dms_file_read (zos_dms_handle_t handle, void *data, uint32_t max_size, uint32_t *bytes_read)
 Read file data. More...
 
zos_result_t zn_dms_file_write (zos_dms_handle_t handle, const void *data, uint32_t data_size)
 Write file data. More...
 
zos_result_t zn_dms_file_close (zos_dms_handle_t handle)
 Close previously opened file. More...
 
zos_result_t zn_dms_file_delete (zos_dms_target_t target, const char *filename)
 Delete file Device's Cloud filesystem. More...
 
zos_result_t zn_dms_file_stat (zos_dms_target_t target, const char *filename, zos_dms_file_t *file_info)
 Return information about file. More...
 
zos_result_t zn_dms_file_list (zos_dms_target_t target, const zos_dms_list_parameters_t *parameters, zos_dms_file_t **file_list_ptr)
 List files on DMS Device or Product's Cloud Filesystem. More...
 
void zn_dms_file_list_destroy (zos_dms_file_t *list)
 Destroy linked-list. More...
 
zos_result_t zn_dms_file_upload (zos_dms_target_t target, const char *local_filename, const char *remote_filename, zos_file_flag_t flags)
 Upload local file to Device's cloud file system. More...
 
zos_result_t zn_dms_file_download (zos_dms_target_t target, const char *remote_filename, const char *local_filename, zos_file_flag_t flags)
 Download remote file on device or product's cloud file system to local file system. More...
 

Detailed Description

DMS cloud file system operations.

Function Documentation

zos_result_t zn_dms_file_close ( zos_dms_handle_t  handle)

Close previously opened file.

This closes a file opened with zn_dms_file_open() or zn_dms_file_create()

Parameters
handleHandle of opened file.
Returns
Result of API call, see zos_result_t
zos_result_t zn_dms_file_create ( zos_dms_target_t  target,
const zos_dms_file_t file,
zos_dms_handle_t handle_ptr 
)

Open a file on DMS Device's Cloud Filesystem for writing.

If the API returns successfully, a handle is returned. The zn_dms_file_write() API should be used to write the file's data.

Issue the zn_dms_file_close() API when finished writing the file.

The zos_dms_file_t argument should contain information about the file to create including:

  • Filename
  • File size in bytes
  • Optionally the CRC of the file's data. The target will verify the CRC after the file is written. Leave as UINT32_MAX if unused.
Note
Currently only ZOS_DMS_DEVICE supports file creation.
Parameters
targetCurrently only ZOS_DMS_DEVICE is supported
fileInformation about file to create, see zos_dms_file_t
handle_ptrPointer to hold handle of opened file
Returns
Result of API call, see zos_result_t
zos_result_t zn_dms_file_delete ( zos_dms_target_t  target,
const char *  filename 
)

Delete file Device's Cloud filesystem.

Note
Currently only ZOS_DMS_DEVICE supports file deletion.
Parameters
targetCurrently only ZOS_DMS_DEVICE is supported
filenameName of file to delete
Returns
Result of API call, see zos_result_t
Examples:
cloud/cloud_filesystem/cloud_filesystem.c.
zos_result_t zn_dms_file_download ( zos_dms_target_t  target,
const char *  remote_filename,
const char *  local_filename,
zos_file_flag_t  flags 
)

Download remote file on device or product's cloud file system to local file system.

Use the flags argument to set various various flags for the downloaded file. See zos_file_flag_t Note: To encrypt the file as it's downloaded to the extended/bulk flash, use the FILE_FLAG_USER_ENCRYPTED flag.

Parameters
[in]targetTarget of file operation, see s2c_file_target_t
[in]remote_filenameFile name/path of remote file
[in]local_filenameOptional, name of locally created file, leave NULL to use remote_filename as local_filename
[in]flagsOptional file flags, leave 0 if unused
Returns
Result of API, see zos_result_t
Examples:
cloud/cloud_filesystem/cloud_filesystem.c.
zos_result_t zn_dms_file_list ( zos_dms_target_t  target,
const zos_dms_list_parameters_t parameters,
zos_dms_file_t **  file_list_ptr 
)

List files on DMS Device or Product's Cloud Filesystem.

Optional parameters can be given to limit the returns file listing.

Note
zn_dms_file_list_destroy() MUST be used to cleanup the returned file listing.
Parameters
targetThe target of the list operation, see s2c_file_target_t
parametersOptional parameters to limit the returned file listing, see s2c_file_list_parameters_t
file_list_ptrPointer to hold linked-list of s2c_file_t containing file listing
Returns
Result of API call, see zos_result_t
Examples:
cloud/cloud_filesystem/cloud_filesystem.c.
void zn_dms_file_list_destroy ( zos_dms_file_t list)

Destroy linked-list.

This frees the memory allocated by the file listing returned by s2c_file_list()

Parameters
listFile listing to cleanup
Examples:
cloud/cloud_filesystem/cloud_filesystem.c.
zos_result_t zn_dms_file_open ( zos_dms_target_t  target,
zos_dms_file_t file,
zos_dms_handle_t handle_ptr 
)

Open a file on DMS Device or DMS Product's Cloud Filesystem for reading.

If the API returns successfully, a handle is returned. The zn_dms_file_read() API should be used to read the file's data.

Issue the zn_dms_file_close() API when finished reading the file.

Note
The file argument is a zos_dms_file_t which should have the filename specified. If the file is successfully opened, the zos_dms_file_t argument will be updated with the file's size and CRC determined from the remote side.
Parameters
[in]targetThe target of the read operation, see zos_dms_target_t
[in,out]filezos_dms_file_t containing filename to open on remote side, the file size and CRC will be update if the file is opened
[out]handle_ptrPointer to hold handle of opened file
Returns
Result of API call, see zos_result_t
zos_result_t zn_dms_file_read ( zos_dms_handle_t  handle,
void *  data,
uint32_t  max_size,
uint32_t *  bytes_read 
)

Read file data.

This reads file data of opened file. The file should have been previously opened using zn_dms_file_open()

Parameters
handleHandle of opened file
dataBuffer to hold read file data
max_sizeSize of supplied data buffer
bytes_readPointer to hold number of bytes actually read, leave NULL if unused
Returns
Result of API call, see zos_result_t
zos_result_t zn_dms_file_stat ( zos_dms_target_t  target,
const char *  filename,
zos_dms_file_t file_info 
)

Return information about file.

Parameters
targetThe target of the stat operation, see zos_dms_target_t
filenameName of file to gain information about
file_infozos_dms_file_t to hold information about file
Returns
Result of API call, see zos_result_t
Examples:
cloud/cloud_filesystem/cloud_filesystem.c.
zos_result_t zn_dms_file_upload ( zos_dms_target_t  target,
const char *  local_filename,
const char *  remote_filename,
zos_file_flag_t  flags 
)

Upload local file to Device's cloud file system.

Note
Currently only ZOS_DMS_DEVICE supports file uploads.

If the file is encrypted on the extended/bulk flash, it can be decrypted before upload to the server if the flags argument contains the FILE_FLAG_USER_ENCRYPTED flag.

Parameters
[in]targetCurrently only ZOS_DMS_DEVICE is supported
[in]local_filenameName of file on local file system to upload
[in]remote_filenameOptional, name of created file on remote side, leave NULL to use local_filename as remote_filename
[in]flagsOptional file flags, leave 0 if unused
Returns
Result of API, see zos_result_t
Examples:
cloud/cloud_filesystem/cloud_filesystem.c.
zos_result_t zn_dms_file_write ( zos_dms_handle_t  handle,
const void *  data,
uint32_t  data_size 
)

Write file data.

This writes file data of file opened for writing. The file should have been previously opened using zn_dms_file_create()

Parameters
handleHandle of opened file
dataBuffer holding data to write to file
data_sizeNumber of bytes to write to file
Returns
Result of API call, see zos_result_t