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