mcl_file.h File Reference

File module interface header file. More...

Include dependency graph for mcl_file.h:
This graph shows which files directly or indirectly include this file:

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)
 

Detailed Description

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 Documentation

typedef struct mcl_file_t mcl_file_t

Handle for file.

Definition at line 34 of file mcl_file.h.

Enumeration Type Documentation

Parameters for files.

Enumerator
MCL_FILE_PARAMETER_LOCAL_PATH 

File local path parameter as char*.

MCL_FILE_PARAMETER_REMOTE_NAME 

File remote name parameter as char*.

MCL_FILE_PARAMETER_TYPE 

File type parameter as char*.

MCL_FILE_PARAMETER_END 

Definition at line 48 of file mcl_file.h.

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.

Function Documentation

MCL_CONNECTIVITY_EXPORT void mcl_file_destroy ( mcl_file_t **  file)

This function destroys file data structure.

Parameters
[in]fileFile 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]versionOne of the versions listed in E_MCL_FILE_VERSION.
[out]fileFile handle which is going to be initialized.
Returns

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.

Here is the call graph for this function:

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.

Parameters
[in]fileFile to set its parameter.
[in]parameterOne of the parameters listed in E_MCL_FILE_PARAMETER.
[in]valueNew value of the parameter.
Returns

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().

Here is the call graph for this function: