1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_FILEMGMT_CLOUD_SYNC_ANI_H 17 #define OHOS_FILEMGMT_CLOUD_SYNC_ANI_H 18 19 #include "cloud_sync_core.h" 20 21 namespace OHOS::FileManagement::CloudSync { 22 class CloudSyncAni final { 23 public: 24 static void CloudSyncConstructor(ani_env *env, ani_object object); 25 static void CloudSyncOn(ani_env *env, ani_object object, ani_string evt, ani_object fun); 26 static void CloudSyncOff0(ani_env *env, ani_object object, ani_string evt, ani_object fun); 27 static void CloudSyncOff1(ani_env *env, ani_object object, ani_string evt); 28 static void CloudSyncStart(ani_env *env, ani_object object); 29 static void CloudSyncStop(ani_env *env, ani_object object); 30 static void OptimizeStorage(ani_env *env, ani_class clazz); 31 static void StartOptimizeStorage(ani_env *env, ani_class clazz, ani_object optim, ani_object fun); 32 static void StopOptimizeStorage(ani_env *env, ani_class clazz); 33 static ani_int GetFileSyncState(ani_env *env, ani_class clazz, ani_string path); 34 static int32_t RegisterToObs(const RegisterParams ®isterParams); 35 static bool CheckRef(ani_env *env, ani_ref ref, ChangeListenerAni &listObj, const string &uri); 36 static int32_t GetRegisterParams( 37 ani_env *env, ani_string uri, ani_boolean recursion, ani_object fun, RegisterParams ®isterParams); 38 static void RegisterChange(ani_env *env, ani_class clazz, ani_string uri, ani_boolean recursion, ani_object fun); 39 static void UnRegisterChange(ani_env *env, ani_class clazz, ani_string uri); 40 static void UnregisterFromObs(ani_env *env, std::string uri); 41 static std::mutex sOnOffMutex_; 42 }; 43 } // namespace OHOS::FileManagement::CloudSync 44 #endif // OHOS_FILEMGMT_CLOUD_SYNC_ANI_H 45