Macros | Functions
WifiStorage.c File Reference
#include "XdkCommonInfo.h"
#include "WifiStorage.h"
#include "stdio.h"
#include "fs.h"
+ Include dependency graph for WifiStorage.c:

Macros

#define BCDS_MODULE_ID   XDK_COMMON_ID_WIFISTORAGE
 
#define INVALID_FILE_HANDLE   INT32_C(-1)
 
#define WRITE_READ_ALIGN_VAL   1024
 

Functions

Retcode_T WifiStorage_FileClose (const int32_t fileHandle)
 This Interface API is used to close a file in the wifi media. More...
 
Retcode_T WifiStorage_FileDelete (const uint8_t *fileName, int32_t *fileHandle)
 This Interface API is used to delete a file in the wifi media in requested file mode. More...
 
Retcode_T WifiStorage_FileOpen (const uint8_t *fileName, int32_t *fileHandle, WifiFileMode_T fileMode)
 This Interface API is used to open a file in the wifi media in requested file mode. More...
 
Retcode_T WifiStorage_FileRead (const int32_t fileHandle, uint8_t *readBuffer, uint32_t *noOfBytesRead)
 This Interface API is used to read a file content from the wifi media. More...
 
Retcode_T WifiStorage_FileWrite (const int32_t fileHandle, uint8_t *writeBuffer, uint32_t noOfBytesToWrite)
 This Interface API is used to write user buffer file content to the wifi media. More...
 
Retcode_T WifiStorage_GetFileStatus (const uint8_t *fileName, uint32_t *fileLength)
 Checks whether the requested file exist in the wifi media. More...
 

Macro Definition Documentation

#define BCDS_MODULE_ID   XDK_COMMON_ID_WIFISTORAGE
#define INVALID_FILE_HANDLE   INT32_C(-1)
#define WRITE_READ_ALIGN_VAL   1024

Function Documentation

Retcode_T WifiStorage_FileClose ( const int32_t  fileHandle)

A prior call to WlanConnect_Init() is necessary for this function in order to operate, failing which the intended functionality is not guaranteed.

Parameters
[in]fileHandleHandle obtained in WifiStorage_FileOpen() API call

RETCODE_OK If in case of the requested file close operation is success RETCODE_ERROR_IN_FILE_CLOSE_WIFI_MEDIA If in case of failure in closing the requested file

WifiStorage_FileClose() must be called in the application in same execution context, even if in case WifiStorage_FileRead() or WifiStorage_FileWrite() operation fails for some reason WifiStorage_FileClose() must be called in application in same execution context where WifiStorage_FileOpen(), WifiStorage_FileRead() or WifiStorage_FileWrite() operations are performed If no other file operation is performed after calling WifiStorage_FileOpen() , close the file WifiStorage_FileClose() in the same context.

Retcode_T WifiStorage_FileDelete ( const uint8_t *  fileName,
int32_t *  fileHandle 
)

A prior call to WlanConnect_Init() is necessary for this function in order to operate, failing which the intended functionality is not guaranteed.

Parameters
[in]fileNameFilename of the file in the wifi media which needs to be deleted
[in/out]fileHandle Handle obtained in WifiStorage_FileOpen() API call

RETCODE_OK If in case of the requested file delete operation is success RETCODE_ERROR_IN_FILE_DELETE In case the delete operation is not successful

If file deleted successfully, then the fileHandle will be made invalid on returning from this API call

Retcode_T WifiStorage_FileOpen ( const uint8_t *  fileName,
int32_t *  fileHandle,
WifiFileMode_T  fileMode 
)

A prior call to WlanConnect_Init() is necessary for this function in order to operate, failing which the intended functionality is not guaranteed.

Parameters
[in]fileNameFilename which needs to be either created ,opened for read operation or opened for write operation
[in/out]fileHandle Handle obtained as reference which needs to be used for performing file operation like WifiStorage_FileRead(), WifiStorage_FileWrite(), WifiStorage_FileClose()
[in]fileModeSpecifies the file is opened for which mode for the modes supported please refer enum WifiFileMode_T

RETCODE_OK If in case of the requested file open operation is success based on the user selected filemode RETCODE_WRONG_FILE_MODE If in case of wrong file mode is set while opening the file RETCODE_ERROR_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY If in case this API is called before proper close of of file operation using API WifiStorage_FileClose() in the previous call in application

fileHandle obtained using this WifiStorage_FileOpen() needs to be protected in application while performing file operation in multi-threading environment.

Retcode_T WifiStorage_FileRead ( const int32_t  fileHandle,
uint8_t *  readBuffer,
uint32_t *  noOfBytesRead 
)

A prior call to WlanConnect_Init() is necessary for this function in order to operate, failing which the intended functionality is not guaranteed.

Parameters
[in]fileHandleHandle obtained in WifiStorage_FileOpen() API call in read mode
[in]readBufferpointer to buffer to collect the read data from the file from media
[in/out]noOfBytesReadThe value pointed is used for mentioning the no of bytes to read and while returning, the actual no of bytes read is updated

RETCODE_OK If in case of the requested file read operation is success RETCODE_ERROR_IN_FILE_READ If in case of failure in reading the requested file

Please note that the WifiStorage_FileClose() must be called in application in same execution context where WifiStorage_FileRead() operation returns either success or failure case

Retcode_T WifiStorage_FileWrite ( const int32_t  fileHandle,
uint8_t *  writeBuffer,
uint32_t  noOfBytesToWrite 
)

A prior call to WlanConnect_Init() is necessary for this function in order to operate, failing which the intended functionality is not guaranteed.

Parameters
[in]fileHandleHandle obtained in WifiStorage_FileOpen() API call in write mode
[in]writeBufferPointer to user write buffer which needs to be written into the file in media
[in]noOfBytesToWriteNo of bytes to write

RETCODE_OK If in case of the requested file write operation is success RETCODE_ERROR_IN_FILE_WRITE If in case of failure in writing to the requested file

Please note that the WifiStorage_FileClose() must be called in application in same execution context where WifiStorage_FileWrite() operation returns either success or failure case

Retcode_T WifiStorage_GetFileStatus ( const uint8_t *  fileName,
uint32_t *  fileLength 
)

A prior call to WlanConnect_Init() is necessary for this function in order to operate, failing which the intended functionality is not guaranteed.

Parameters
[in]fileName: Filename for which the status needs to be checked
[in/out]fileLength : Gives the size of the content in the file in bytes

RETCODE_OK If in case of the requested file already exist in the wifi media RETCODE_FILE_DOES_NOT_EXIST_WIFI_MEDIA If in case of file requested is not present in the wifi media RETCODE_ERROR_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY If in case this API is called before proper close of of file operation using API WifiStorage_FileClose() in the previous call in application


This documentation file has been automatically generated on Wed May 6 2020 20:45:08 by doxygen 1.8.8