1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
|
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
/**
* Class that represents useful attributes of mobile network links
* such as the upload/download throughput or error rate etc.
* @hide
*/
public class MobileLinkQualityInfo extends LinkQualityInfo {
// Represents TelephonyManager.NetworkType
private int mMobileNetworkType = UNKNOWN_INT;
private int mRssi = UNKNOWN_INT;
private int mGsmErrorRate = UNKNOWN_INT;
private int mCdmaDbm = UNKNOWN_INT;
private int mCdmaEcio = UNKNOWN_INT;
private int mEvdoDbm = UNKNOWN_INT;
private int mEvdoEcio = UNKNOWN_INT;
private int mEvdoSnr = UNKNOWN_INT;
private int mLteSignalStrength = UNKNOWN_INT;
private int mLteRsrp = UNKNOWN_INT;
private int mLteRsrq = UNKNOWN_INT;
private int mLteRssnr = UNKNOWN_INT;
private int mLteCqi = UNKNOWN_INT;
/**
* Implement the Parcelable interface.
* @hide
*/
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags, OBJECT_TYPE_MOBILE_LINK_QUALITY_INFO);
dest.writeInt(mMobileNetworkType);
dest.writeInt(mRssi);
dest.writeInt(mGsmErrorRate);
dest.writeInt(mCdmaDbm);
dest.writeInt(mCdmaEcio);
dest.writeInt(mEvdoDbm);
dest.writeInt(mEvdoEcio);
dest.writeInt(mEvdoSnr);
dest.writeInt(mLteSignalStrength);
dest.writeInt(mLteRsrp);
dest.writeInt(mLteRsrq);
dest.writeInt(mLteRssnr);
dest.writeInt(mLteCqi);
}
/* Un-parceling helper */
/**
* @hide
*/
public static MobileLinkQualityInfo createFromParcelBody(Parcel in) {
MobileLinkQualityInfo li = new MobileLinkQualityInfo();
li.initializeFromParcel(in);
li.mMobileNetworkType = in.readInt();
li.mRssi = in.readInt();
li.mGsmErrorRate = in.readInt();
li.mCdmaDbm = in.readInt();
li.mCdmaEcio = in.readInt();
li.mEvdoDbm = in.readInt();
li.mEvdoEcio = in.readInt();
li.mEvdoSnr = in.readInt();
li.mLteSignalStrength = in.readInt();
li.mLteRsrp = in.readInt();
li.mLteRsrq = in.readInt();
li.mLteRssnr = in.readInt();
li.mLteCqi = in.readInt();
return li;
}
/**
* returns mobile network type as defined by {@link android.telephony.TelephonyManager}
* @return network type or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
@UnsupportedAppUsage
public int getMobileNetworkType() {
return mMobileNetworkType;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setMobileNetworkType(int mobileNetworkType) {
mMobileNetworkType = mobileNetworkType;
}
/**
* returns signal strength for GSM networks
* @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getRssi() {
return mRssi;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setRssi(int Rssi) {
mRssi = Rssi;
}
/**
* returns error rates for GSM networks
* @return error rate or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getGsmErrorRate() {
return mGsmErrorRate;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setGsmErrorRate(int gsmErrorRate) {
mGsmErrorRate = gsmErrorRate;
}
/**
* returns signal strength for CDMA networks
* @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getCdmaDbm() {
return mCdmaDbm;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setCdmaDbm(int cdmaDbm) {
mCdmaDbm = cdmaDbm;
}
/**
* returns signal to noise ratio for CDMA networks
* @return signal to noise ratio in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getCdmaEcio() {
return mCdmaEcio;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setCdmaEcio(int cdmaEcio) {
mCdmaEcio = cdmaEcio;
}
/**
* returns signal strength for EVDO networks
* @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getEvdoDbm() {
return mEvdoDbm;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setEvdoDbm(int evdoDbm) {
mEvdoDbm = evdoDbm;
}
/**
* returns signal to noise ratio for EVDO spectrum
* @return signal to noise ration in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getEvdoEcio() {
return mEvdoEcio;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setEvdoEcio(int evdoEcio) {
mEvdoEcio = evdoEcio;
}
/**
* returns end-to-end signal to noise ratio for EVDO networks
* @return signal to noise ration in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getEvdoSnr() {
return mEvdoSnr;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setEvdoSnr(int evdoSnr) {
mEvdoSnr = evdoSnr;
}
/**
* returns signal strength for LTE network
* @return signal strength in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getLteSignalStrength() {
return mLteSignalStrength;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setLteSignalStrength(int lteSignalStrength) {
mLteSignalStrength = lteSignalStrength;
}
/**
* returns RSRP (Reference Signal Received Power) for LTE network
* @return RSRP in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getLteRsrp() {
return mLteRsrp;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setLteRsrp(int lteRsrp) {
mLteRsrp = lteRsrp;
}
/**
* returns RSRQ (Reference Signal Received Quality) for LTE network
* @return RSRQ ??? or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getLteRsrq() {
return mLteRsrq;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setLteRsrq(int lteRsrq) {
mLteRsrq = lteRsrq;
}
/**
* returns signal to noise ratio for LTE networks
* @return signal to noise ration in db or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getLteRssnr() {
return mLteRssnr;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setLteRssnr(int lteRssnr) {
mLteRssnr = lteRssnr;
}
/**
* returns channel quality indicator for LTE networks
* @return CQI or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
public int getLteCqi() {
return mLteCqi;
}
/**
* @hide
*/
@UnsupportedAppUsage
public void setLteCqi(int lteCqi) {
mLteCqi = lteCqi;
}
}
|