• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SATELLITE_STATUS_H
17 #define SATELLITE_STATUS_H
18 
19 #include <vector>
20 
21 #include <parcel.h>
22 
23 namespace OHOS {
24 namespace Location {
25 class SatelliteStatus : public Parcelable {
26 public:
27     SatelliteStatus();
28     explicit SatelliteStatus(SatelliteStatus &satelliteStatus);
29     ~SatelliteStatus() override = default;
30 
GetSatellitesNumber()31     inline int GetSatellitesNumber() const
32     {
33         return satellitesNumber_;
34     }
35 
SetSatellitesNumber(int num)36     inline void SetSatellitesNumber(int num)
37     {
38         satellitesNumber_ = num;
39     }
40 
GetSatelliteIds()41     inline std::vector<int> GetSatelliteIds() const
42     {
43         return satelliteIds_;
44     }
45 
SetSatelliteIds(std::vector<int> ids)46     inline void SetSatelliteIds(std::vector<int> ids)
47     {
48         for (std::vector<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
49             satelliteIds_.push_back(*it);
50         }
51     }
52 
SetSatelliteId(int id)53     inline void SetSatelliteId(int id)
54     {
55         satelliteIds_.push_back(id);
56     }
57 
GetCarrierToNoiseDensitys()58     inline std::vector<double> GetCarrierToNoiseDensitys() const
59     {
60         return carrierToNoiseDensitys_;
61     }
62 
SetCarrierToNoiseDensitys(std::vector<double> cn0)63     inline void SetCarrierToNoiseDensitys(std::vector<double> cn0)
64     {
65         for (std::vector<double>::iterator it = cn0.begin(); it != cn0.end(); ++it) {
66             carrierToNoiseDensitys_.push_back(*it);
67         }
68     }
69 
SetCarrierToNoiseDensity(double cn0)70     inline void SetCarrierToNoiseDensity(double cn0)
71     {
72         carrierToNoiseDensitys_.push_back(cn0);
73     }
74 
GetAltitudes()75     inline std::vector<double> GetAltitudes() const
76     {
77         return altitudes_;
78     }
79 
SetAltitudes(std::vector<double> altitudes)80     inline void SetAltitudes(std::vector<double> altitudes)
81     {
82         for (std::vector<double>::iterator it = altitudes.begin(); it != altitudes.end(); ++it) {
83             altitudes_.push_back(*it);
84         }
85     }
86 
SetAltitude(double altitude)87     inline void SetAltitude(double altitude)
88     {
89         altitudes_.push_back(altitude);
90     }
91 
GetAzimuths()92     inline std::vector<double> GetAzimuths() const
93     {
94         return azimuths_;
95     }
96 
SetAzimuths(std::vector<double> azimuths)97     inline void SetAzimuths(std::vector<double> azimuths)
98     {
99         for (std::vector<double>::iterator it = azimuths.begin(); it != azimuths.end(); ++it) {
100             azimuths_.push_back(*it);
101         }
102     }
103 
SetAzimuth(double azimuth)104     inline void SetAzimuth(double azimuth)
105     {
106         azimuths_.push_back(azimuth);
107     }
108 
GetCarrierFrequencies()109     inline std::vector<double> GetCarrierFrequencies() const
110     {
111         return carrierFrequencies_;
112     }
113 
SetCarrierFrequencies(std::vector<double> cfs)114     inline void SetCarrierFrequencies(std::vector<double> cfs)
115     {
116         for (std::vector<double>::iterator it = cfs.begin(); it != cfs.end(); ++it) {
117             carrierFrequencies_.push_back(*it);
118         }
119     }
120 
SetCarrierFrequencie(double cf)121     inline void SetCarrierFrequencie(double cf)
122     {
123         carrierFrequencies_.push_back(cf);
124     }
125 
126     void ReadFromParcel(Parcel& parcel);
127     bool Marshalling(Parcel& parcel) const override;
128     static std::unique_ptr<SatelliteStatus> Unmarshalling(Parcel& parcel);
129 private:
130     int satellitesNumber_;
131     std::vector<int> satelliteIds_;
132     std::vector<double> carrierToNoiseDensitys_;
133     std::vector<double> altitudes_;
134     std::vector<double> azimuths_;
135     std::vector<double> carrierFrequencies_;
136 };
137 } // namespace Location
138 } // namespace OHOS
139 #endif // SATELLITE_STATUS_H
140