File module interface header file. More...
#include "mcl_connectivity/mcl_connectivity_common.h"
Go to the source code of this file.
Typedefs | |
typedef struct mcl_file_t | mcl_file_t |
Enumerations | |
enum | E_MCL_FILE_VERSION { MCL_FILE_VERSION_1_0 = 0, MCL_FILE_VERSION_END } |
enum | E_MCL_FILE_PARAMETER { MCL_FILE_PARAMETER_LOCAL_PATH = 0, MCL_FILE_PARAMETER_REMOTE_NAME, MCL_FILE_PARAMETER_TYPE, MCL_FILE_PARAMETER_END } |
Functions | |
MCL_CONNECTIVITY_EXPORT mcl_error_t | mcl_file_initialize (E_MCL_FILE_VERSION version, mcl_file_t **file) |
MCL_CONNECTIVITY_EXPORT mcl_error_t | mcl_file_set_parameter (mcl_file_t *file, E_MCL_FILE_PARAMETER parameter, const void *value) |
MCL_CONNECTIVITY_EXPORT void | mcl_file_destroy (mcl_file_t **file) |
File module interface header file.
Agents can upload files to MindSphere. This module enables the agent to initialize a file data type using mcl_file_initialize function. Following initialization, the parameters of this file data type can be set using mcl_file_set_parameter function. Once the file data type is ready, it can be uploaded to MindSphere using mcl_connectivity_exchange function. Optionally, the file can be added to mcl_store_t and the store containing the file and possible other data can be uploaded to MindSphere. If the file data type is exchanged as a single item, the agent is expected to destroy the file after the exchange operation using mcl_file_destroy function. If the file is exchanged in a store, store will handle the destroy operation of the file and the agent does not need to take any action.
For more information, please look at example file "mcl_connectivity/examples/file_upload.c".
Definition in file mcl_file.h.
typedef struct mcl_file_t mcl_file_t |
Handle for file.
Definition at line 34 of file mcl_file.h.
enum E_MCL_FILE_PARAMETER |
Parameters for files.
Definition at line 48 of file mcl_file.h.
enum E_MCL_FILE_VERSION |
Version of file item payload.
Enumerator | |
---|---|
MCL_FILE_VERSION_1_0 |
File version 1.0. |
MCL_FILE_VERSION_END |
End of file version enumeration. |
Definition at line 39 of file mcl_file.h.
MCL_CONNECTIVITY_EXPORT void mcl_file_destroy | ( | mcl_file_t ** | file | ) |
This function destroys file data structure.
[in] | file | File handle which is going to be destroyed. |
Definition at line 148 of file file.c.
References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_file_util_fclose(), MCL_FREE, and MCL_NULL.
Referenced by _item_destroy(), and mcl_file_initialize().
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_file_initialize | ( | E_MCL_FILE_VERSION | version, |
mcl_file_t ** | file | ||
) |
This function creates and initializes a data struct of mcl_file_t.
[in] | version | One of the versions listed in E_MCL_FILE_VERSION. |
[out] | file | File handle which is going to be initialized. |
file
is null. Definition at line 20 of file file.c.
References MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_file_destroy(), MCL_FUNCTION_LEAVE_LABEL, MCL_INVALID_PARAMETER, MCL_ITEM_PREAMBLE, MCL_ITEM_TYPE_FILE, MCL_NEW, MCL_NO_FILE_SUPPORT, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_file_set_parameter | ( | mcl_file_t * | file, |
E_MCL_FILE_PARAMETER | parameter, | ||
const void * | value | ||
) |
This function is used to set a parameter of a file.
[in] | file | File to set its parameter. |
[in] | parameter | One of the parameters listed in E_MCL_FILE_PARAMETER. |
[in] | value | New value of the parameter . |
file
or value
is NULL. parameter
is invalid. Definition at line 76 of file file.c.
References _set_file_local_path(), MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FILE_PARAMETER_LOCAL_PATH, MCL_FILE_PARAMETER_REMOTE_NAME, MCL_FILE_PARAMETER_TYPE, MCL_FUNCTION_LEAVE_LABEL, MCL_INVALID_PARAMETER, MCL_NO_FILE_SUPPORT, and mcl_string_util_reset().