1 /* 2 * Copyright (C) 2014 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 com.android.internal.telephony; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 import android.telephony.TelephonyManager; 21 22 /** 23 * Object to indicate the phone radio capability. 24 * 25 * @hide 26 */ 27 public class RadioCapability { 28 29 /* 30 * The RC_PHASE constants are the set of valid values for the mPhase field. 31 */ 32 33 /** 34 * LM is configured is initial value and value after FINISH completes. 35 */ 36 public static final int RC_PHASE_CONFIGURED = 0; 37 38 /** 39 * START is sent before Apply and indicates that an APPLY will be 40 * forthcoming with these same parameters. 41 */ 42 public static final int RC_PHASE_START = 1; 43 44 /** 45 * APPLY is sent after all LM's receive START and returned 46 * RIL_RadioCapability. status = 0, if any START's fail no APPLY will 47 * be sent. 48 */ 49 public static final int RC_PHASE_APPLY = 2; 50 51 /** 52 * UNSOL_RSP is sent with RIL_UNSOL_RADIO_CAPABILITY. 53 */ 54 public static final int RC_PHASE_UNSOL_RSP = 3; 55 56 /** 57 * RC_PHASE_FINISH is sent after all previous phases have completed. 58 * If an error occurs in any previous commands the RIL_RadioAccessesFamily 59 * and LogicalModemId fields will be the prior configuration thus 60 * restoring the configuration to the previous value. An error returned 61 * by this command will generally be ignored or may cause that logical 62 * modem to be removed from service 63 */ 64 public static final int RC_PHASE_FINISH = 4; 65 66 /* 67 * The RC_STATUS_xxx constants are returned in the mStatus field. 68 */ 69 70 /** 71 * this parameter is no meaning with RC_Phase_START, RC_Phase_APPLY 72 */ 73 public static final int RC_STATUS_NONE = 0; 74 75 /** 76 * Tell modem the action transaction of set radio capability is 77 * success with RC_Phase_FINISH. 78 */ 79 public static final int RC_STATUS_SUCCESS = 1; 80 81 /** 82 * tell modem the action transaction of set radio capability is fail 83 * with RC_Phase_FINISH 84 */ 85 public static final int RC_STATUS_FAIL = 2; 86 87 /** Version of structure, RIL_RadioCapability_Version */ 88 private static final int RADIO_CAPABILITY_VERSION = 1; 89 90 /** Unique session value defined by framework returned in all "responses/unsol" */ 91 private int mSession; 92 93 /** CONFIGURED, START, APPLY, FINISH */ 94 private int mPhase; 95 96 /** 97 * RadioAccessFamily is a bit field of radio access technologies the 98 * for the modem is currently supporting. The initial value returned 99 * my the modem must the the set of bits that the modem currently supports. 100 * see {@link android.telephony.TelephonyManager.NetworkTypeBitMask} 101 */ 102 @TelephonyManager.NetworkTypeBitMask 103 private int mRadioAccessFamily; 104 105 /** 106 * Logical modem this radio is be connected to. 107 * This must be Globally unique on convention is 108 * to use a registered name such as com.google.android.lm0 109 */ 110 private String mLogicalModemUuid; 111 112 /** Return status and an input parameter for RC_Phase_FINISH */ 113 private int mStatus; 114 115 /** Phone ID of phone */ 116 private int mPhoneId; 117 118 /** 119 * Constructor. 120 * 121 * @param phoneId the phone ID 122 * @param session the request transaction id 123 * @param phase the request phase id 124 * @param radioAccessFamily the phone radio access family defined in 125 * {@link android.telephony.TelephonyManager.NetworkTypeBitMask} 126 * It's a bit mask value to represent the support type. 127 * @param logicalModemUuid the logicalModem UUID which phone connected to 128 * @param status tell modem the action transaction of 129 * set radio capability is success or fail with RC_Phase_FINISH 130 */ RadioCapability(int phoneId, int session, int phase, @TelephonyManager.NetworkTypeBitMask int radioAccessFamily, String logicalModemUuid, int status)131 public RadioCapability(int phoneId, int session, int phase, 132 @TelephonyManager.NetworkTypeBitMask int radioAccessFamily, 133 String logicalModemUuid, int status) { 134 mPhoneId = phoneId; 135 mSession = session; 136 mPhase = phase; 137 mRadioAccessFamily = radioAccessFamily; 138 mLogicalModemUuid = logicalModemUuid; 139 mStatus = status; 140 } 141 142 /** 143 * Get phone ID. 144 * 145 * @return phone ID 146 */ getPhoneId()147 public int getPhoneId() { 148 return mPhoneId; 149 } 150 151 /** 152 * Get radio capability version. 153 * 154 * @return radio capability version 155 */ getVersion()156 public int getVersion() { 157 return RADIO_CAPABILITY_VERSION; 158 } 159 160 /** 161 * Get unique session id. 162 * 163 * @return unique session id 164 */ getSession()165 public int getSession() { 166 return mSession; 167 } 168 169 170 /** 171 * get radio capability phase. 172 * 173 * @return RadioCapabilityPhase, including CONFIGURED, START, APPLY, FINISH 174 */ getPhase()175 public int getPhase() { 176 return mPhase; 177 } 178 179 /** 180 * get radio access family. 181 * 182 * @return radio access family 183 */ 184 @UnsupportedAppUsage getRadioAccessFamily()185 public int getRadioAccessFamily() { 186 return mRadioAccessFamily; 187 } 188 189 /** 190 * get logical modem Universally Unique ID. 191 * 192 * @return logical modem uuid 193 */ getLogicalModemUuid()194 public String getLogicalModemUuid() { 195 return mLogicalModemUuid; 196 } 197 198 /** 199 * get request status. 200 * 201 * @return status and an input parameter for RC_PHASE_FINISH 202 */ getStatus()203 public int getStatus() { 204 return mStatus; 205 } 206 207 @Override toString()208 public String toString() { 209 return "{mPhoneId = " + mPhoneId 210 + " mVersion=" + getVersion() 211 + " mSession=" + getSession() 212 + " mPhase=" + getPhase() 213 + " mRadioAccessFamily=" + getRadioAccessFamily() 214 + " mLogicModemId=" + getLogicalModemUuid() 215 + " mStatus=" + getStatus() 216 + "}"; 217 } 218 } 219 220