Telematics SDK - API Reference  v1.63.0
SignalStrength.hpp
1 /*
2  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above
10  * copyright notice, this list of conditions and the following
11  * disclaimer in the documentation and/or other materials provided
12  * with the distribution.
13  * * Neither the name of The Linux Foundation nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /*
31  * Changes from Qualcomm Innovation Center are provided under the following license:
32  *
33  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
34  *
35  * Redistribution and use in source and binary forms, with or without
36  * modification, are permitted (subject to the limitations in the
37  * disclaimer below) provided that the following conditions are met:
38  *
39  * * Redistributions of source code must retain the above copyright
40  * notice, this list of conditions and the following disclaimer.
41  *
42  * * Redistributions in binary form must reproduce the above
43  * copyright notice, this list of conditions and the following
44  * disclaimer in the documentation and/or other materials provided
45  * with the distribution.
46  *
47  * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
48  * contributors may be used to endorse or promote products derived
49  * from this software without specific prior written permission.
50  *
51  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
52  * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
53  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
54  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
55  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
56  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
57  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
59  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
61  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
62  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
63  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64  */
65 
71 #ifndef SIGNALSTRENGTH_HPP
72 #define SIGNALSTRENGTH_HPP
73 
74 #include <memory>
75 
76 #define INVALID_SIGNAL_STRENGTH_VALUE 0x7FFFFFFF
77 
78 namespace telux {
79 
80 namespace tel {
81 
85 // forward declarations
86 class LteSignalStrengthInfo;
87 class GsmSignalStrengthInfo;
88 class CdmaSignalStrengthInfo;
89 class WcdmaSignalStrengthInfo;
90 class TdscdmaSignalStrengthInfo;
91 class Nr5gSignalStrengthInfo;
92 
97 enum class SignalStrengthLevel {
98  LEVEL_1,
99  LEVEL_2,
100  LEVEL_3,
101  LEVEL_4,
102  LEVEL_5,
103  LEVEL_UNKNOWN = -1,
104 };
105 
110 public:
111  SignalStrength(std::shared_ptr<LteSignalStrengthInfo> lteSignalStrengthInfo,
112  std::shared_ptr<GsmSignalStrengthInfo> gsmSignalStrengthInfo,
113  std::shared_ptr<CdmaSignalStrengthInfo> cdmaSignalStrengthInfo,
114  std::shared_ptr<WcdmaSignalStrengthInfo> wcdmaSignalStrengthInfo,
115  std::shared_ptr<TdscdmaSignalStrengthInfo> tdscdmaSignalStrengthInfo,
116  std::shared_ptr<Nr5gSignalStrengthInfo> nr5gSignalStrengthInfo);
123  std::shared_ptr<LteSignalStrengthInfo> getLteSignalStrength();
124 
131  std::shared_ptr<GsmSignalStrengthInfo> getGsmSignalStrength();
132 
141  std::shared_ptr<CdmaSignalStrengthInfo> getCdmaSignalStrength();
142 
149  std::shared_ptr<WcdmaSignalStrengthInfo> getWcdmaSignalStrength();
150 
159  std::shared_ptr<TdscdmaSignalStrengthInfo> getTdscdmaSignalStrength();
160 
168  std::shared_ptr<Nr5gSignalStrengthInfo> getNr5gSignalStrength();
169 
170 private:
171  std::shared_ptr<LteSignalStrengthInfo> lteSS_;
172  std::shared_ptr<GsmSignalStrengthInfo> gsmSS_;
173  std::shared_ptr<CdmaSignalStrengthInfo> cdmaSS_;
174  std::shared_ptr<WcdmaSignalStrengthInfo> wcdmaSS_;
175  std::shared_ptr<TdscdmaSignalStrengthInfo> tdscdmaSS_;
176  std::shared_ptr<Nr5gSignalStrengthInfo> nr5gSS_;
177 };
178 
185 public:
186  LteSignalStrengthInfo(int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi,
187  int timingAdvance);
194  const SignalStrengthLevel getLevel() const;
195 
202  const int getDbm() const;
203 
210  const int getLteSignalStrength() const;
211 
218  const int getLteReferenceSignalReceiveQuality() const;
219 
227  const int getLteReferenceSignalSnr() const;
228 
239  const int getLteChannelQualityIndicator() const;
240 
250  const int getTimingAdvance() const;
251 
252 private:
253  int lteSignalStrength_;
254  int lteRsrp_;
255  int lteRsrq_;
256  int lteRssnr_;
257  int lteCqi_;
258  int timingAdvance_;
259 };
260 
266 public:
267  GsmSignalStrengthInfo(int gsmSignalStrength, int gsmBitErrorRate, int timingAdvance);
274  const SignalStrengthLevel getLevel() const;
275 
283  const int getDbm() const;
284 
292  const int getGsmSignalStrength() const;
293 
302  const int getGsmBitErrorRate() const;
303 
312  const int getTimingAdvance();
313 
314 private:
315  int gsmSignalStrength_;
316  int gsmBitErrorRate_;
317  int timingAdvance_;
318 };
319 
327 public:
328  CdmaSignalStrengthInfo(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio,
329  int evdoSignalNoiseRatio);
336  const SignalStrengthLevel getLevel() const;
337 
343  const int getDbm() const;
344 
350  const int getCdmaEcio() const;
351 
357  const int getEvdoEcio() const;
358 
365  const int getEvdoSignalNoiseRatio() const;
366 
367 private:
368  // Helper functions used to calculate EVDO dBm and EVDO Level
369  const int getEvdoDbm() const;
370  const SignalStrengthLevel getEvdoLevel() const;
371  // Helper functions used to calculate CDMA dBm and CDMA Level
372  const int getCdmaDbm() const;
373  const SignalStrengthLevel getCdmaLevel() const;
374  int cdmaDbm_;
375  int cdmaEcio_;
376  int evdoDbm_;
377  int evdoEcio_;
378  int evdoSignalNoiseRatio_;
379 };
380 
386 public:
387  WcdmaSignalStrengthInfo(int signalStrength, int bitErrorRate);
395  const SignalStrengthLevel getLevel() const;
396 
404  const int getDbm() const;
405 
413  const int getSignalStrength() const;
414 
424  const int getBitErrorRate() const;
425 
426 private:
427  int signalStrength_;
428  int bitErrorRate_;
429 };
430 
437 public:
438  TdscdmaSignalStrengthInfo(int rscp);
439 
447  const int getRscp() const;
448 
449 private:
450  int rscp_;
451 };
452 
457 public:
458  Nr5gSignalStrengthInfo(int rsrp, int rsrq, int rssnr);
465  const SignalStrengthLevel getLevel() const;
466 
474  const int getDbm() const;
475 
483  const int getReferenceSignalReceiveQuality() const;
484 
493  const int getReferenceSignalSnr() const;
494 
495 private:
496  int rsrp_;
497  int rsrq_;
498  int rssnr_;
499 };
500  /* end_addtogroup telematics_phone */
502 
503 } // End of namespace tel
504 
505 } // End of namespace telux
506 
507 #endif
Definition: SignalStrength.hpp:184
Definition: SignalStrength.hpp:456
DeviceConfig provides utility functions to get device configuration details such as multi SIM support...
Definition: AudioDefines.hpp:80
Definition: SignalStrength.hpp:385
SignalStrengthLevel
Definition: SignalStrength.hpp:97
Definition: SignalStrength.hpp:326
Definition: SignalStrength.hpp:265
Definition: SignalStrength.hpp:436
Definition: SignalStrength.hpp:109