OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_ANDROID_CELLULAR_SIGNAL_STRENGTH_H_ | 5 #ifndef NET_ANDROID_CELLULAR_SIGNAL_STRENGTH_H_ |
6 #define NET_ANDROID_CELLULAR_SIGNAL_STRENGTH_H_ | 6 #define NET_ANDROID_CELLULAR_SIGNAL_STRENGTH_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/android/scoped_java_ref.h" | |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | |
14 #include "base/threading/thread_checker.h" | |
12 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
13 | 16 |
14 namespace net { | 17 namespace net { |
15 | 18 |
16 namespace android { | 19 namespace android { |
17 | 20 |
18 namespace cellular_signal_strength { | 21 class NET_EXPORT_PRIVATE CellularSignalStrength { |
22 public: | |
23 CellularSignalStrength(); | |
19 | 24 |
20 // Returns true if the signal strength (in dbM) of the currently registered | 25 ~CellularSignalStrength(); |
21 // cellular connection is available, and sets |*signal_strength_dbm| to that | |
22 // value. | |
23 NET_EXPORT bool GetSignalStrengthDbm(int32_t* signal_strength_dbm) | |
24 WARN_UNUSED_RESULT; | |
25 | 26 |
26 // Returns true if the signal strength level (between 0 and 4, both inclusive) | 27 // Returns true if the signal strength level (between 0 and 4, both inclusive) |
27 // of the currently registered cellular connection is available, and sets | 28 // of the currently registered cellular connection is available, and sets |
28 // |*signal_strength_level| to that value with lower value indicating lower | 29 // |*signal_strength_level| to that value with lower value indicating lower |
29 // signal strength. | 30 // signal strength. |
30 NET_EXPORT bool GetSignalStrengthLevel(int32_t* signal_strength_level) | 31 bool GetSignalStrengthLevel(int32_t* signal_strength_level) const |
RyanSturm
2017/03/22 21:51:08
nit: Could be a base::optional.
tbansal1
2017/03/23 18:28:53
Done.
| |
31 WARN_UNUSED_RESULT; | 32 WARN_UNUSED_RESULT; |
32 | 33 |
33 } // namespace cellular_signal_strength | 34 private: |
35 base::android::ScopedJavaGlobalRef<jobject> j_cellular_signal_strength_; | |
36 | |
37 base::ThreadChecker thread_checker_; | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(CellularSignalStrength); | |
40 }; | |
34 | 41 |
35 } // namespace android | 42 } // namespace android |
36 | 43 |
37 } // namespace net | 44 } // namespace net |
38 | 45 |
39 #endif // NET_ANDROID_CELLULAR_SIGNAL_STRENGTH_H_ | 46 #endif // NET_ANDROID_CELLULAR_SIGNAL_STRENGTH_H_ |
OLD | NEW |