Help Center/ Huawei HiLens/ SDK Reference/ Output/ Uploading Buffer Data
Updated on 2023-06-15 GMT+08:00

Uploading Buffer Data

UploadBuffer()

This section describes how to upload buffer data to OBS. During the buffer upload, threads are blocked. They are not blocked until the buffer data is uploaded successfully. You can configure the target OBS bucket on the HiLens console. For details, see the "Configuring the Data Storage Location" section in HiLens User Guide.

  • API calling

    HiLensEC hilens::UploadBuffer(const std::string & key, const unsigned char * buffer, const unsigned char * buffer, size_t bufferSize, const std::string & mode)

  • Parameter description
    Table 1 Parameters

    Parameter

    Description

    key

    Name of the file uploaded to OBS

    buffer

    Pointer of the buffer to be uploaded

    bufferSize

    Size of the buffer to be uploaded

    mode

    Upload mode. The options are write and append.

  • Return values

    If the return value is 0, the operation is successful. Otherwise, the operation fails. For details about the failure response parameters, see Error Codes.

UploadBufferAsync()

The following API is used to asynchronously upload the buffer data. A response is returned immediately after the buffer data is uploaded successfully.

  • API calling

    HiLensEC hilens::UploadBufferAsync(const std::string & key, std::shared_ptr<const unsigned char> buffer, size_t bufferSize, const std::string & mode, void(*)(int) callback = NULL)

  • Parameter description
    Table 2 Parameters

    Parameter

    Description

    key

    Name of the file uploaded to OBS

    buffer

    Pointer of the buffer to be uploaded

    bufferSize

    Size of the buffer to be uploaded

    mode

    Upload mode. The options are write and append.

    callback

    Callback function

  • Return values

    If the return value is 0, the operation is successful. Otherwise, the operation fails. For details about the failure response parameters, see Error Codes.