• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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_DEVICE_PROFILE_SYNC_OPTIONS_H
17 #define OHOS_DEVICE_PROFILE_SYNC_OPTIONS_H
18 
19 #include <list>
20 
21 #include "parcel.h"
22 
23 namespace OHOS {
24 namespace DeviceProfile {
25 // must keep same with DistributedKv::SyncMode
26 enum class SyncMode : int64_t {
27     PULL,
28     PUSH,
29     PUSH_PULL,
30 };
31 
32 class SyncOptions : public Parcelable {
33 public:
34     SyncOptions() = default;
35     ~SyncOptions() = default;
36 
37     const std::list<std::string>& GetDeviceList() const;
38     SyncMode GetSyncMode() const;
39 
40     void AddDevice(const std::string& deviceId);
41     void SetSyncMode(SyncMode mode);
42 
43     bool Marshalling(Parcel& parcel) const override;
44     bool Unmarshalling(Parcel& parcel);
45 
46 private:
47     SyncMode syncMode_ {SyncMode::PUSH};
48     std::list<std::string> syncDevIds_;
49 };
50 } // namespace DeviceProfile
51 } // namespace OHOS
52 #endif  // OHOS_DEVICE_PROFILE_SYNC_OPTIONS_H