Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.telephony; |
| 18 | |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Abstract base class for cell phone signal strength related information. |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 21 | */ |
Wink Saville | c6e4917a | 2012-09-21 13:54:05 -0700 | [diff] [blame] | 22 | public abstract class CellSignalStrength { |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 23 | |
Nathan Harold | a6d893e | 2018-11-14 11:51:51 -0800 | [diff] [blame] | 24 | public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = |
| 25 | TelephonyProtoEnums.SIGNAL_STRENGTH_NONE_OR_UNKNOWN; // 0 |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 26 | |
Nathan Harold | a6d893e | 2018-11-14 11:51:51 -0800 | [diff] [blame] | 27 | public static final int SIGNAL_STRENGTH_POOR = |
| 28 | TelephonyProtoEnums.SIGNAL_STRENGTH_POOR; // 1 |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 29 | |
Nathan Harold | a6d893e | 2018-11-14 11:51:51 -0800 | [diff] [blame] | 30 | public static final int SIGNAL_STRENGTH_MODERATE = |
| 31 | TelephonyProtoEnums.SIGNAL_STRENGTH_MODERATE; // 2 |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 32 | |
Nathan Harold | a6d893e | 2018-11-14 11:51:51 -0800 | [diff] [blame] | 33 | public static final int SIGNAL_STRENGTH_GOOD = |
| 34 | TelephonyProtoEnums.SIGNAL_STRENGTH_GOOD; // 3 |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 35 | |
Nathan Harold | a6d893e | 2018-11-14 11:51:51 -0800 | [diff] [blame] | 36 | public static final int SIGNAL_STRENGTH_GREAT = |
| 37 | TelephonyProtoEnums.SIGNAL_STRENGTH_GREAT; // 4 |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 38 | |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 39 | /** @hide */ |
| 40 | public static final int NUM_SIGNAL_STRENGTH_BINS = 5; |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 41 | |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 42 | /** @hide */ |
| 43 | public static final String[] SIGNAL_STRENGTH_NAMES = { |
| 44 | "none", "poor", "moderate", "good", "great" |
| 45 | }; |
| 46 | |
| 47 | /** @hide */ |
Wink Saville | 3caf66d | 2012-07-25 17:06:54 -0700 | [diff] [blame] | 48 | protected CellSignalStrength() { |
| 49 | } |
| 50 | |
| 51 | /** @hide */ |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 52 | public abstract void setDefaultValues(); |
| 53 | |
| 54 | /** |
| 55 | * Get signal level as an int from 0..4 |
Casey Ho | 8e27050 | 2015-04-21 09:37:55 -0700 | [diff] [blame] | 56 | * <p> |
| 57 | * @see SIGNAL_STRENGTH_NONE_OR_UNKNOWN |
| 58 | * @see SIGNAL_STRENGTH_POOR |
| 59 | * @see SIGNAL_STRENGTH_MODERATE |
| 60 | * @see SIGNAL_STRENGTH_GOOD |
| 61 | * @see SIGNAL_STRENGTH_GREAT |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 62 | */ |
| 63 | public abstract int getLevel(); |
| 64 | |
| 65 | /** |
| 66 | * Get the signal level as an asu value between 0..31, 99 is unknown |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 67 | */ |
| 68 | public abstract int getAsuLevel(); |
| 69 | |
| 70 | /** |
| 71 | * Get the signal strength as dBm |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 72 | */ |
| 73 | public abstract int getDbm(); |
| 74 | |
| 75 | /** |
| 76 | * Copies the CellSignalStrength. |
| 77 | * |
| 78 | * @return A deep copy of this class. |
| 79 | * @hide |
| 80 | */ |
| 81 | public abstract CellSignalStrength copy(); |
| 82 | |
| 83 | @Override |
| 84 | public abstract int hashCode(); |
| 85 | |
| 86 | @Override |
| 87 | public abstract boolean equals (Object o); |
Wink Saville | b208a24 | 2012-07-25 14:08:09 -0700 | [diff] [blame] | 88 | } |