• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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_BACKUP_SERVICE_REVERSE_H
17 #define OHOS_FILEMGMT_BACKUP_SERVICE_REVERSE_H
18 
19 #include "b_session_backup.h"
20 #include "b_session_restore.h"
21 #include "service_reverse_stub.h"
22 
23 namespace OHOS::FileManagement::Backup {
24 class ServiceReverse final : public ServiceReverseStub {
25 public:
26     void BackupOnFileReady(std::string bundleName, std::string fileName, int fd) override;
27     void BackupOnBundleStarted(int32_t errCode, std::string bundleName) override;
28     void BackupOnBundleFinished(int32_t errCode, std::string bundleName) override;
29     void BackupOnAllBundlesFinished(int32_t errCode) override;
30 
31     void RestoreOnBundleStarted(int32_t errCode, std::string bundleName) override;
32     void RestoreOnBundleFinished(int32_t errCode, std::string bundleName) override;
33     void RestoreOnAllBundlesFinished(int32_t errCode) override;
34     void RestoreOnFileReady(std::string bundleName, std::string fileName, int fd) override;
35 
36 public:
37     ServiceReverse() = delete;
38     explicit ServiceReverse(BSessionRestore::Callbacks callbacks);
39     explicit ServiceReverse(BSessionBackup::Callbacks callbacks);
40     ~ServiceReverse() override = default;
41 
42 private:
43     Scenario scenario_ {Scenario::UNDEFINED};
44     BSessionBackup::Callbacks callbacksBackup_;
45     BSessionRestore::Callbacks callbacksRestore_;
46 };
47 } // namespace OHOS::FileManagement::Backup
48 
49 #endif // OHOS_FILEMGMT_BACKUP_SERVICE_REVERSE_H