1 /*
2  * Copyright (C) 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_NR_SSB_INFORMATION_H
17 #define OHOS_NR_SSB_INFORMATION_H
18 
19 #include <vector>
20 
21 #include "parcel.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 
26 struct SsbInfo {
27     /** SSB index. */
28     int32_t ssbId = 0;
29     /** Reference Signal Received Power -140~-44, dBm */
30     int32_t rsrp = 0;
31 };
32 
33 struct NeighboringCellSsbInformation {
34     /** Physical cell ID. */
35     int32_t pci = 0;
36     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
37     int32_t arfcn = 0;
38     /** Reference Signal Received Power -140~-44, dBm */
39     int32_t rsrp = 0;
40     /** Signal To Interference Plus Noise Ratio. */
41     int32_t sinr = 0;
42     /** Neighboring cell ssbId list, always size is 4 */
43     std::vector<SsbInfo> ssbList;
44 };
45 
46 struct NrCellSsbInfo {
47     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
48     int32_t arfcn = 0;
49     /** Context Identifier. */
50     int64_t cid = 0;
51     /** Physical cell ID. */
52     int32_t pci = 0;
53     /** Reference Signal Received Power -140~-44, dBm */
54     int32_t rsrp = 0;
55     /** Signal To Interference Plus Noise Ratio. */
56     int32_t sinr = 0;
57     /** Time advance. */
58     int32_t timeAdvance = 0;
59     /** Service cell ssbId list, always size is 8 */
60     std::vector<SsbInfo> sCellSsbList;
61     /** Neighboring cell ssb list count, max size is 4 */
62     int32_t nbCellCount = 0;
63     /** Neighboring cell ssb info list, max size is 4 */
64     std::vector<NeighboringCellSsbInformation> nbCellSsbList;
65 };
66 
67 class NrSsbInformation : public Parcelable {
68 public:
69     NrSsbInformation() = default;
70     ~NrSsbInformation() = default;
71     bool Marshalling(Parcel &parcel) const override;
72     bool MarshallingNbCellSsbId(Parcel &parcel) const;
73     bool ReadFromParcel(Parcel &parcel);
74     bool ReadFromParcelForNbCell(Parcel &parcel);
75     void SetSsbBaseParam(int32_t arfcn, int64_t cid, int32_t pci, int32_t rsrp, int32_t sinr, int32_t timeAdvance);
76     void SetSCellSsbList(std::vector<SsbInfo> sCellSsbList);
77     void SetNbCellSsbList(int32_t nbCellCount, std::vector<NeighboringCellSsbInformation> nbCellSsbList);
78     int32_t GetArfcn() const;
79     int64_t GetCid() const;
80     int32_t GetPci() const;
81     int32_t GetRsrp() const;
82     int32_t GetSinr() const;
83     int32_t GetTimeAdvance() const;
84     int32_t GetNbCellCount() const;
85     void GetSCellSsbIdList(std::vector<SsbInfo> &sCellSsbList) const;
86     void GetNbCellSsbIdList(std::vector<NeighboringCellSsbInformation> &nbCellSsbList) const;
87 
88 public:
89     static const int32_t SCELL_SSB_LIST = 8;
90     static const int32_t NBCELL_SSB_LIST = 4;
91     static const int32_t MAX_NBCELL_COUNT = 4;
92 
93 private:
94     int32_t arfcn_ = 0; /** Absolute Radio Frequency Channel Number */
95     int64_t cid_ = 0; /** Context Identifier. */
96     int32_t pci_ = 0; /** Physical cell ID. */
97     int32_t rsrp_ = 0; /** Reference Signal Received Power */
98     int32_t sinr_ = 0; /** Signal To Interference Plus Noise Ratio. */
99     int32_t timeAdvance_ = 0; /** Time advance. */
100     std::vector<SsbInfo> sCellSsbList_; /** Service cell ssbId list */
101     int32_t nbCellCount_ = 0; /** Neighboring cell ssb list count */
102     std::vector<NeighboringCellSsbInformation> nbCellSsbList_; /** Neighboring cell ssb info list */
103 };
104 } // namespace Telephony
105 } // namespace OHOS
106 #endif // OHOS_NR_SSB_INFORMATION_H