HTTP/2 Link IoT HAL

更新时间:
复制 MD 格式

This topic describes the HTTP/2-related Hardware Abstraction Layer (HAL) interfaces.

HAL_Fopen

  • API Prototype

    void *HAL_Fopen(const char *path, const char *mode)
  • Description

    Opens a file at the specified path in the specified mode. Returns a file stream.

  • Parameters

    Parameter

    Data type

    Direction

    Description

    path

    char *

    Input

    The file path.

    mode

    const char *

    Input

    The mode for opening the file. This parameter is compatible with the mode parameter of the standard C fopen function.

  • Return value

    Value

    Description

    NULL

    The operation failed.

    Not NULL

    Success. A file stream is returned.

HAL_Fread

  • API Signature

    uint32_t HAL_Fread(void * buff,uint32_t size, uint32_t count, void *stream)
  • Description

    Reads data from a file stream. It reads up to `count` items of `size` bytes each.

  • Parameters

    Parameter

    Data type

    Direction

    Description

    buff

    void *

    Input

    Receive cache

    size

    uint32_t

    Input

    The size of each data block in bytes.

    count

    uint32_t

    Input

    The number of data blocks.

    stream

    void *

    Input

    The file stream.

  • Return value

    Value

    Description

    == count

    Success.

    != count

    The operation failed.

HAL_Fwrite

  • API prototype

    uint32_t HAL_Fwrite(const void * ptr, uint32_t size, uint32_t count, void * stream)
  • Description

    Writes data to a file stream. It writes up to `count` items of `size` bytes each.

  • Parameters

    Parameter

    Data type

    Direction

    Description

    ptr

    const void *

    Input

    A pointer to the data to write.

    size

    uint32_t

    Input

    The size of each data block in bytes.

    count

    uint32_t

    Input

    The number of data blocks.

    stream

    void *

    Input

    The file stream.

  • Return value

    Value

    Description

    == count

    Success.

    != count

    The operation failed.

HAL_Fseek

  • Function prototype

    int HAL_Fseek(void *stream,long offset,int framewhere)
  • Description

    Sets the file position indicator for the stream.

  • Parameters

    Parameter

    Data type

    Direction

    Description

    stream

    void *

    Input

    The file stream.

    offset

    long

    Input

    The position at the specified byte offset from the pointer.

    framewhere

    int

    Input

    The starting position for the offset.

    • 0: File header

    • 1: Current location

    • 2: The end of the file.

  • Return value

    Value

    Description

    0

    Success.

    -1

    The operation failed.

HAL_Ftell

  • Interface Prototype

    long HAL_Ftell(void *stream)
  • Description

    Retrieves the current value of the file position indicator for the stream. This value is the number of bytes from the beginning of the file.

  • Metric description

    Parameter

    Data type

    Direction

    Description

    stream

    void *

    Input

    The file stream.

  • Return value

    Value

    Description

    >=0

    Success. The current offset is returned.

    -1

    The operation failed.

HAL_Fclose

  • Function prototype

    int HAL_Fclose(void *stream)
  • Description

    Closes the specified file stream.

  • Parameters

    Parameter

    Data type

    Direction

    Description

    stream

    void *

    Input

    The file stream.

  • Return value

    Value

    Description

    0

    Success.

    -1

    The operation failed.