!1366 Add native api

Merge pull request !1366 from cuile4/master
This commit is contained in:
openharmony_ci 2024-08-31 09:15:49 +00:00 committed by Gitee
commit e32ce1b5b0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 144 additions and 0 deletions

View File

@ -265,6 +265,20 @@ int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
*/
int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
/**
* @brief Add one {@link OH_UdsArrayBuffer} data to the {@link OH_UdmfRecord} record.
*
* @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
* @param type Represents record type, reference udmf_meta.h.
* @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
* @since 13
*/
int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
/**
* @brief Get all types in the {@link OH_UdmfRecord} record.
*
@ -350,6 +364,79 @@ int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
*/
int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
/**
* @brief Get one {@link OH_UdsArrayBuffer} data from the {@link OH_UdmfRecord} record.
*
* @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
* @param type Represents record type, reference udmf_meta.h.
* @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
* @since 13
*/
int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
/**
* @brief Get primary {@link OH_UdsPlainText} data from the {@link OH_UdmfData}.
*
* @param data Represents a pointer to an instance of {@link OH_UdmfData}.
* @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdmfData OH_UdsPlainText Udmf_ErrCode.
* @since 13
*/
int OH_UdmfData_GetPrimaryPlainText(OH_UdmfData* data, OH_UdsPlainText* plainText);
/**
* @brief Get one {@link OH_UdsHtml} data from the {@link OH_UdmfData}.
*
* @param data Represents a pointer to an instance of {@link OH_UdmfData}.
* @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdmfData OH_UdsHtml Udmf_ErrCode.
* @since 13
*/
int OH_UdmfData_GetPrimaryHtml(OH_UdmfData* data, OH_UdsHtml* html);
/**
* @brief Get the count of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
*
* @param data Represents a pointer to an instance of {@link OH_UdmfData}.
* @return Returns the count of {@link OH_UdmfRecord}
* @see OH_UdmfData.
* @since 13
*/
int OH_UdmfData_GetRecordCount(OH_UdmfData* data);
/**
* @brief Get the record of the specified index from the {@link OH_UdmfData}.
*
* @param data Represents a pointer to an instance of {@link OH_UdmfData}.
* @param index Represents the index of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
* @return Returns {@link OH_UdmfRecord} pointer when input parameters valid, otherwise return nullptr.
* @see OH_UdmfData.
* @since 13
*/
OH_UdmfRecord* OH_UdmfData_GetRecord(OH_UdmfData* data, unsigned int index);
/**
* @brief Checks whether the UDMF data is from a local device.
*
* @param data Represents a pointer to an instance of {@link OH_UdmfData}.
* @return Returns a boolean value, which indicates whether the UDMF data is from a local device.
* The value {@code true} means the data is from a local device.
* The value {@code false} means the opposite.
* @see OH_UdmfData.
* @since 13
*/
bool OH_UdmfData_IsLocal(OH_UdmfData* data);
/**
* @brief Creation a pointer to the instance of the {@link OH_UdmfProperty}
* from a {@link OH_UdmfData} data.

View File

@ -72,6 +72,13 @@ typedef struct OH_UdsHtml OH_UdsHtml;
*/
typedef struct OH_UdsAppItem OH_UdsAppItem;
/**
* @brief Describes the unified data struct of array buffer.
*
* @since 13
*/
typedef struct OH_UdsArrayBuffer OH_UdsArrayBuffer;
/**
* @brief Creation a pointer to the instance of the {@link OH_UdsPlainText}.
*
@ -464,6 +471,56 @@ int OH_UdsAppItem_SetBundleName(OH_UdsAppItem* pThis, const char* bundleName);
*/
int OH_UdsAppItem_SetAbilityName(OH_UdsAppItem* pThis, const char* abilityName);
/**
* @brief Creation a pointer to the instance of the {@link OH_UdsArrayBuffer}.
*
* @return If the operation is successful, a pointer to the instance of the {@link OH_UdsArrayBuffer}
* structure is returned. If the memory is not enough, nullptr is returned.
* @see OH_UdsArrayBuffer
* @since 13
*/
OH_UdsArrayBuffer* OH_UdsArrayBuffer_Create();
/**
* @brief Destroy a pointer that points to the {@link OH_UdsArrayBuffer} instance.
*
* @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdsArrayBuffer Udmf_ErrCode
* @since 13
*/
int OH_UdsArrayBuffer_Destroy(OH_UdsArrayBuffer* buffer);
/**
* @brief Set array buffer data to the {@link OH_UdsArrayBuffer}.
*
* @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
* @param data Represents the array buffer data.
* @param len Represents the length of data param.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdsArrayBuffer Udmf_ErrCode
* @since 13
*/
int OH_UdsArrayBuffer_SetData(OH_UdsArrayBuffer* buffer, unsigned char* data, unsigned int len);
/**
* @brief Get array buffer data from the {@link OH_UdsArrayBuffer}.
*
* @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
* @param data Represents a pointer to array buffer data that is a output param.
* @param len Represents the array buffer data length that is a output param.
* @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
* {@link UDMF_E_OK} success.
* {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
* @see OH_UdsArrayBuffer Udmf_ErrCode
* @since 13
*/
int OH_UdsArrayBuffer_GetData(OH_UdsArrayBuffer* buffer, unsigned char** data, unsigned int* len);
#ifdef __cplusplus
};
#endif