From 811294cb19031c0e8920f983c53a3b5c28668483 Mon Sep 17 00:00:00 2001 From: b30058220 Date: Sat, 11 Jan 2025 20:07:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: b30058220 Change-Id: Ie10eae4ad74d11d13ebc088580de3dc52244339d --- arkui/ace_engine/native/drag_and_drop.h | 30 ++++ arkui/ace_engine/native/libace.ndk.json | 8 ++ distributeddatamgr/udmf/include/udmf.h | 136 ++++++++++++++++++ .../udmf/include/udmf_err_code.h | 40 ++++++ distributeddatamgr/udmf/libudmf.ndk.json | 32 +++++ 5 files changed, 246 insertions(+) diff --git a/arkui/ace_engine/native/drag_and_drop.h b/arkui/ace_engine/native/drag_and_drop.h index 2f68d95b0..b53ef50b9 100644 --- a/arkui/ace_engine/native/drag_and_drop.h +++ b/arkui/ace_engine/native/drag_and_drop.h @@ -434,6 +434,36 @@ float OH_ArkUI_DragEvent_GetVelocity(ArkUI_DragEvent* event); */ int32_t OH_ArkUI_DragEvent_GetModifierKeyStates(ArkUI_DragEvent* event, uint64_t* keys); +/** + * @brief Request to start the data sync process with the sync option. + * + * @param event Indicates the pointer to an ArkUI_DragEvent object. + * @param options Indicates the pointer to an OH_UdmfGetDataParams object. + * @param key Represents return value after set data to database successfully, it should be not + * less than {@link UDMF_KEY_BUFFER_LEN}. + * @param keyLen Represents the length of key string. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_DRAG_DATA_SYNC_FAILED} if the data sync is not allowed or failed. + * @since 16 + */ +int32_t OH_ArkUI_DragEvent_StartDataLoading( + ArkUI_DragEvent* event, OH_UdmfGetDataParams* options, char* key, unsigned int keyLen); + +/** + * @brief Cancel the data sync process. + * + * @param uiContext Indicates the pointer to a UI instance. + * @param key Represents the data key returned by {@link OH_ArkUI_DragEvent_StartDataLoading}. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_OPERATION_FAILED} if no any data sync is in progress. + * @since 16 + */ +int32_t OH_ArkUI_CancelDataLoading(ArkUI_ContextHandle uiContext, const char* key); + /** * @brief Sets whether to enable strict reporting on drag events. * This feature is disabled by default, and you are advised to enable it. diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 93b14a1c3..f8850d3aa 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2574,5 +2574,13 @@ { "first_introduced": "16", "name": "OH_ArkUI_UnregisterDrawCallbackOnNodeHandle" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_DragEvent_StartDataLoading" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CancelDataLoading" } ] \ No newline at end of file diff --git a/distributeddatamgr/udmf/include/udmf.h b/distributeddatamgr/udmf/include/udmf.h index b846fc026..df7b05786 100644 --- a/distributeddatamgr/udmf/include/udmf.h +++ b/distributeddatamgr/udmf/include/udmf.h @@ -90,6 +90,38 @@ typedef enum Udmf_ShareOption { SHARE_OPTIONS_CROSS_APP } Udmf_ShareOption; +/** + * @brief Describe the types of file conflict options when getting data from the udmf. + * + * @since 15 + */ +typedef enum Udmf_FileConflictOptions { + /** + * @brief Overwrite when dest uri has file with same name. + */ + UDMF_OVERWRITE = 0, + /** + * @brief Skip when dest uri has file with same name. + */ + UDMF_SKIP = 1, +} Udmf_FileConflictOptions; + +/** + * @brief Describe the types of progress indicator when getting data from the udmf. + * + * @since 15 +*/ +typedef enum Udmf_ProgressIndicator { + /** + * @brief Getting data without system default progress indicator. + */ + UDMF_NONE = 0, + /** + * @brief Getting data with system default progress indicator. + */ + UDMF_DEFAULT = 1 +} Udmf_ProgressIndicator; + /** * @brief Describes the unified data type. * @@ -118,6 +150,29 @@ typedef struct OH_UdmfRecordProvider OH_UdmfRecordProvider; */ typedef struct OH_UdmfProperty OH_UdmfProperty; +/** + * @brief Represents the udmf progress information. + * + * @since 15 +*/ +typedef struct OH_Udmf_ProgressInfo OH_Udmf_ProgressInfo; + +/** + * @brief Represents the parameters of udmf get data with progress info. + * + * @since 15 +*/ +typedef struct OH_UdmfGetDataParams OH_UdmfGetDataParams; + +/** + * @brief Defines the callback function used to return the progress information and data. + * + * @param progressInfo The progress information notified to Application. + * @param data Represents the unified data. + * @since 15 +*/ +typedef void (*OH_Udmf_DataProgressListener)(OH_Udmf_ProgressInfo* progressInfo, OH_UdmfData* data); + /** * @brief Creation a pointer to the instance of the {@link OH_UdmfData}. * @@ -757,6 +812,87 @@ int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfDat int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData, char* key, unsigned int keyLen); +/** + * @brief Gets the progress from the {@OH_Udmf_ProgressInfo}. + * + * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}. + * @return Returns the progress. + * @see OH_Udmf_ProgressInfo + * @since 15 + */ +int OH_UdmfProgressInfo_GetProgress(OH_Udmf_ProgressInfo* progressInfo); + +/** + * @brief Gets the status from the {@OH_Udmf_ProgressInfo}. + * + * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}. + * @return Returns the status code. See {@link Udmf_ListenerStatus}. + * @see OH_Udmf_ProgressInfo Udmf_ListenerStatus + * @since 15 + */ +int OH_UdmfProgressInfo_GetStatus(OH_Udmf_ProgressInfo* progressInfo); + +/** + * @brief Creation a pointer to the instance of the {@link OH_UdmfGetDataParams}. + * + * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfGetDataParams} + * structure is returned. If the operation is failed, nullptr is returned. + * @see OH_UdmfGetDataParams + * @since 15 + */ +OH_UdmfGetDataParams* OH_UdmfGetDataParams_Create(); + +/** + * @brief Destroy a pointer that points to an instance of {@link OH_UdmfGetDataParams}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @see OH_UdmfGetDataParams + * @since 15 + */ +void OH_UdmfGetDataParams_Destroy(OH_UdmfGetDataParams* pThis); + +/** + * @brief Sets the destination uri to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param destUri Pointer to a destination uri. + * @see OH_UdmfGetDataParams + * @since 15 + */ +void OH_UdmfGetDataParams_SetDestUri(OH_UdmfGetDataParams* params, const char* destUri); + +/** + * @brief Sets the file conflict options to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param options Represents to the file conflict options. + * @see OH_UdmfGetDataParams Udmf_FileConflictOptions + * @since 15 + */ +void OH_UdmfGetDataParams_SetFileConflictOptions(OH_UdmfGetDataParams* params, const Udmf_FileConflictOptions options); + +/** + * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param options Represents to the progress indicator. + * @see OH_UdmfGetDataParams Udmf_ProgressIndicator + * @since 15 + */ +void OH_UdmfGetDataParams_SetProgressIndicator(OH_UdmfGetDataParams* params, + const Udmf_ProgressIndicator progressIndicator); + +/** + * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param options Represents to the data progress listener. + * @see OH_UdmfGetDataParams OH_Udmf_DataProgressListener + * @since 15 + */ +void OH_UdmfGetDataParams_SetDataProgressListener(OH_UdmfGetDataParams* params, + const OH_Udmf_DataProgressListener dataProgressListener); + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/udmf/include/udmf_err_code.h b/distributeddatamgr/udmf/include/udmf_err_code.h index 105191c7c..f3db582c6 100644 --- a/distributeddatamgr/udmf/include/udmf_err_code.h +++ b/distributeddatamgr/udmf/include/udmf_err_code.h @@ -66,6 +66,46 @@ typedef enum Udmf_ErrCode { UDMF_E_INVALID_PARAM = (UDMF_ERR + 1), } Udmf_ErrCode; +/** + * @brief Indicates the error code information. + * + * @since 15 + */ +typedef enum Udmf_ListenerStatus { + /** + * brief Indicates the finished status. + */ + UDMF_FINISHED = 0, + /** + * @brief Indicates that processing is still in progress. + */ + UDMF_PROCESSING, + /** + * @brief Indicates that the process has been canceled. + */ + UDMF_CANCELED, + /** + * @brief Indicates that an internal error has occurred. + */ + UDMF_INNER_ERROR = 200, + /** + * @brief Indicates that the GetDataParams contains invalid parameters. + */ + UDMF_INVALID_PARAMETERS, + /** + * @brief Indicates that no data is obtained. + */ + UDMF_DATA_NOT_FOUND, + /** + * @brief Indicates that an error occurred in the synchronization process. + */ + UDMF_SYNC_FAILED, + /** + * @brief Indicates that an error occurred during file copying. + */ + UDMF_COPY_FILE_FAILED, +} Udmf_ListenerStatus; + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/udmf/libudmf.ndk.json b/distributeddatamgr/udmf/libudmf.ndk.json index 0cef8921c..561cd69eb 100644 --- a/distributeddatamgr/udmf/libudmf.ndk.json +++ b/distributeddatamgr/udmf/libudmf.ndk.json @@ -526,5 +526,37 @@ { "first_introduced": "14", "name": "OH_UdmfRecord_GetContentForm" + }, + { + "first_introduced": "15", + "name": "OH_UdmfProgressInfo_GetProgress" + }, + { + "first_introduced": "15", + "name": "OH_UdmfProgressInfo_GetStatus" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_Create" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_Destroy" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetDestUri" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetFileConflictOptions" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetProgressIndicator" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetDataProgressListener" } ] \ No newline at end of file -- Gitee