|
Google Cloud IoT device SDK for embedded C
1.0.2
|
Go to the source code of this file.
Data Structures | |
| struct | iotc_bsp_io_fs_stat_s |
Typedefs | |
| typedef intptr_t | iotc_bsp_io_fs_resource_handle_t |
| typedef enum iotc_bsp_io_fs_state_e | iotc_bsp_io_fs_state_t |
| typedef enum iotc_bsp_io_fs_resource_type_e | iotc_bsp_io_fs_resource_type_t |
| typedef struct iotc_bsp_io_fs_stat_s | iotc_bsp_io_fs_stat_t |
| typedef enum iotc_bsp_io_fs_open_flags | iotc_bsp_io_fs_open_flags_t |
Enumerations | |
| enum | iotc_bsp_io_fs_state_e { IOTC_BSP_IO_FS_STATE_OK = 0, IOTC_BSP_IO_FS_ERROR = 1, IOTC_BSP_IO_FS_INVALID_PARAMETER = 2, IOTC_BSP_IO_FS_RESOURCE_NOT_AVAILABLE = 3, IOTC_BSP_IO_FS_OUT_OF_MEMORY = 4, IOTC_BSP_IO_FS_NOT_IMPLEMENTED = 5, IOTC_BSP_IO_FS_OPEN_ERROR = 6, IOTC_BSP_IO_FS_OPEN_READ_ONLY = 7, IOTC_BSP_IO_FS_REMOVE_ERROR = 8, IOTC_BSP_IO_FS_WRITE_ERROR = 9, IOTC_BSP_IO_FS_READ_ERROR = 10, IOTC_BSP_IO_FS_CLOSE_ERROR = 11 } |
| enum | iotc_bsp_io_fs_resource_type_e { IOTC_BSP_IO_FS_CERTIFICATE = 0 } |
| enum | iotc_bsp_io_fs_open_flags { IOTC_BSP_IO_FS_OPEN_READ = 1 << 0, IOTC_BSP_IO_FS_OPEN_WRITE = 1 << 1, IOTC_BSP_IO_FS_OPEN_APPEND = 1 << 2 } |
Functions | |
| iotc_bsp_io_fs_state_t | iotc_bsp_io_fs_stat (const char *const resource_name, iotc_bsp_io_fs_stat_t *resource_stat) |
| iotc_bsp_io_fs_state_t | iotc_bsp_io_fs_open (const char *const resource_name, const size_t size, const iotc_bsp_io_fs_open_flags_t open_flags, iotc_bsp_io_fs_resource_handle_t *resource_handle_out) |
| iotc_bsp_io_fs_state_t | iotc_bsp_io_fs_read (const iotc_bsp_io_fs_resource_handle_t resource_handle, const size_t offset, const uint8_t **buffer, size_t *const buffer_size) |
| iotc_bsp_io_fs_state_t | iotc_bsp_io_fs_write (const iotc_bsp_io_fs_resource_handle_t resource_handle, const uint8_t *const buffer, const size_t buffer_size, const size_t offset, size_t *const bytes_written) |
| iotc_bsp_io_fs_state_t | iotc_bsp_io_fs_close (const iotc_bsp_io_fs_resource_handle_t resource_handle) |
| iotc_bsp_io_fs_state_t | iotc_bsp_io_fs_remove (const char *const resource_name) |
Manages files.
Definition in file iotc_bsp_io_fs.h.
The file operations.
A pointer to an open file.
Definition at line 36 of file iotc_bsp_io_fs.h.
The resource type of TLS certificates.
The size of TLS server authentication certificates.
The file management function states.
| Enumerator | |
|---|---|
| IOTC_BSP_IO_FS_OPEN_READ | Open and read the file. |
| IOTC_BSP_IO_FS_OPEN_WRITE | Open and write to the file. |
| IOTC_BSP_IO_FS_OPEN_APPEND | Open and append to the file. |
Definition at line 107 of file iotc_bsp_io_fs.h.
| Enumerator | |
|---|---|
| IOTC_BSP_IO_FS_CERTIFICATE | A TLS certificate resource. |
Definition at line 83 of file iotc_bsp_io_fs.h.
Definition at line 50 of file iotc_bsp_io_fs.h.
| iotc_bsp_io_fs_state_t iotc_bsp_io_fs_close | ( | const iotc_bsp_io_fs_resource_handle_t | resource_handle | ) |
Closes a file and frees all of the resources from reading or writing to the file.
| [in] | resource_handle | A handle to an open file. |
| iotc_bsp_io_fs_state_t iotc_bsp_io_fs_open | ( | const char *const | resource_name, |
| const size_t | size, | ||
| const iotc_bsp_io_fs_open_flags_t | open_flags, | ||
| iotc_bsp_io_fs_resource_handle_t * | resource_handle_out | ||
| ) |
Opens a file.
| [in] | resource_name | The filename. |
| [in] | size | The size, in bytes, of the file. |
| [in] | open_flags | A file operation bitmask. |
| [out] | resource_handle_out | A handle to an open file. |
| iotc_bsp_io_fs_state_t iotc_bsp_io_fs_read | ( | const iotc_bsp_io_fs_resource_handle_t | resource_handle, |
| const size_t | offset, | ||
| const uint8_t ** | buffer, | ||
| size_t *const | buffer_size | ||
| ) |
Reads a file.
The function must fill the buffer at offset 0. The function can allocate buffers by:
For example, see the POSIX implementation of this function.
| [in] | resource_handle | A handle to an open file. |
| [in] | offset | The position within the resource, in bytes, from which to start read operations. |
| [out] | buffer | A pointer to a buffer with the bytes read from the file. The buffer is already allocated by the SDK. |
| [out] | buffer_size | The number of bytes read from the file and stored in the buffer. |
| iotc_bsp_io_fs_state_t iotc_bsp_io_fs_remove | ( | const char *const | resource_name | ) |
Deletes a file.
| [in] | resource_name | The filename. |
| iotc_bsp_io_fs_state_t iotc_bsp_io_fs_stat | ( | const char *const | resource_name, |
| iotc_bsp_io_fs_stat_t * | resource_stat | ||
| ) |
Gets the size of a file.
| [in] | resource_name | The file name. |
| [out] | resource_stat | The size, in bytes, of the file. |
| iotc_bsp_io_fs_state_t iotc_bsp_io_fs_write | ( | const iotc_bsp_io_fs_resource_handle_t | resource_handle, |
| const uint8_t *const | buffer, | ||
| const size_t | buffer_size, | ||
| const size_t | offset, | ||
| size_t *const | bytes_written | ||
| ) |
Writes to a file.
| [in] | resource_handle | A handle to an open file. |
| [in] | buffer | A pointer to a byte array with the data to write to the file. |
| [in] | buffer_size | The size, in bytes of the buffer. |
| [in] | offset | The position within the resource, in bytes, from which to start to the write operation. |
| [out] | bytes_written | The number of bytes written to the file. |