1/*
2 * Copyright (C) 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 REQUEST_CONFIG_H
17#define REQUEST_CONFIG_H
18
19#include <parcel.h>
20#include <string>
21
22namespace OHOS {
23namespace Location {
24class RequestConfig : public Parcelable {
25public:
26    RequestConfig();
27    explicit RequestConfig(const int scenario);
28    ~RequestConfig() override = default;
29
30    inline int GetScenario() const
31    {
32        return scenario_;
33    }
34
35    inline void SetScenario(int scenario)
36    {
37        scenario_ = scenario;
38    }
39
40    inline void SetPriority(int priority)
41    {
42        priority_ = priority;
43    }
44
45    inline int GetPriority()
46    {
47        return priority_;
48    }
49
50    inline int GetTimeInterval() const
51    {
52        return timeInterval_;
53    }
54
55    inline void SetTimeInterval(int timeInterval)
56    {
57        timeInterval_ = timeInterval;
58    }
59
60    inline double GetDistanceInterval() const
61    {
62        return distanceInterval_;
63    }
64
65    inline void SetDistanceInterval(double distanceInterval)
66    {
67        distanceInterval_ = distanceInterval;
68    }
69
70    inline float GetMaxAccuracy() const
71    {
72        return maxAccuracy_;
73    }
74
75    inline void SetMaxAccuracy(float maxAccuracy)
76    {
77        maxAccuracy_ = maxAccuracy;
78    }
79
80    inline void SetFixNumber(int fixNumber)
81    {
82        fixNumber_ = fixNumber;
83    }
84
85    inline int GetFixNumber()
86    {
87        return fixNumber_;
88    }
89
90    inline void SetTimeOut(int time)
91    {
92        timeOut_ = time;
93    }
94
95    inline int GetTimeOut()
96    {
97        return timeOut_;
98    }
99
100    inline void SetTimeStamp(int64_t time)
101    {
102        timestamp_ = time;
103    }
104
105    inline int64_t GetTimeStamp()
106    {
107        return timestamp_;
108    }
109
110    void ReadFromParcel(Parcel& parcel);
111    bool Marshalling(Parcel& parcel) const override;
112    std::string ToString() const;
113    static std::unique_ptr<RequestConfig> Unmarshalling(Parcel& parcel);
114    void Set(RequestConfig& requestConfig);
115    bool IsSame(RequestConfig& requestConfig);
116private:
117    int scenario_;
118    int timeInterval_; /* Units are seconds */
119    double distanceInterval_ = 0.0;
120    float maxAccuracy_;
121    int fixNumber_;
122    int priority_;
123    int timeOut_;
124    int64_t timestamp_;
125};
126} // namespace Location
127} // namespace OHOS
128#endif // REQUEST_CONFIG_H
129