1 /* 2 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. 3 * Not a Contribution. 4 * 5 * Copyright (C) 2006 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 package com.android.internal.telephony.gsm; 21 22 import android.telephony.Rlog; 23 import com.android.internal.telephony.CallForwardInfo; 24 import com.android.internal.telephony.GsmCdmaPhone; 25 26 import java.util.ArrayList; 27 28 /** 29 * See also RIL_StkCcUnsolSsResponse in include/telephony/ril.h 30 * 31 * {@hide} 32 */ 33 public class SsData { 34 public enum ServiceType { 35 SS_CFU, 36 SS_CF_BUSY, 37 SS_CF_NO_REPLY, 38 SS_CF_NOT_REACHABLE, 39 SS_CF_ALL, 40 SS_CF_ALL_CONDITIONAL, 41 SS_CLIP, 42 SS_CLIR, 43 SS_COLP, 44 SS_COLR, 45 SS_WAIT, 46 SS_BAOC, 47 SS_BAOIC, 48 SS_BAOIC_EXC_HOME, 49 SS_BAIC, 50 SS_BAIC_ROAMING, 51 SS_ALL_BARRING, 52 SS_OUTGOING_BARRING, 53 SS_INCOMING_BARRING; 54 isTypeCF()55 public boolean isTypeCF() { 56 return (this == SS_CFU || this == SS_CF_BUSY || this == SS_CF_NO_REPLY || 57 this == SS_CF_NOT_REACHABLE || this == SS_CF_ALL || 58 this == SS_CF_ALL_CONDITIONAL); 59 } 60 isTypeUnConditional()61 public boolean isTypeUnConditional() { 62 return (this == SS_CFU || this == SS_CF_ALL); 63 } 64 isTypeCW()65 public boolean isTypeCW() { 66 return (this == SS_WAIT); 67 } 68 isTypeClip()69 public boolean isTypeClip() { 70 return (this == SS_CLIP); 71 } 72 isTypeClir()73 public boolean isTypeClir() { 74 return (this == SS_CLIR); 75 } 76 isTypeBarring()77 public boolean isTypeBarring() { 78 return (this == SS_BAOC || this == SS_BAOIC || this == SS_BAOIC_EXC_HOME || 79 this == SS_BAIC || this == SS_BAIC_ROAMING || this == SS_ALL_BARRING || 80 this == SS_OUTGOING_BARRING || this == SS_INCOMING_BARRING); 81 } 82 }; 83 84 public enum RequestType { 85 SS_ACTIVATION, 86 SS_DEACTIVATION, 87 SS_INTERROGATION, 88 SS_REGISTRATION, 89 SS_ERASURE; 90 isTypeInterrogation()91 public boolean isTypeInterrogation() { 92 return (this == SS_INTERROGATION); 93 } 94 }; 95 96 public enum TeleserviceType { 97 SS_ALL_TELE_AND_BEARER_SERVICES, 98 SS_ALL_TELESEVICES, 99 SS_TELEPHONY, 100 SS_ALL_DATA_TELESERVICES, 101 SS_SMS_SERVICES, 102 SS_ALL_TELESERVICES_EXCEPT_SMS; 103 }; 104 105 public ServiceType serviceType; 106 public RequestType requestType; 107 public TeleserviceType teleserviceType; 108 public int serviceClass; 109 public int result; 110 111 public int[] ssInfo; /* This is the response data for most of the SS GET/SET 112 RIL requests. E.g. RIL_REQUSET_GET_CLIR returns 113 two ints, so first two values of ssInfo[] will be 114 used for respone if serviceType is SS_CLIR and 115 requestType is SS_INTERROGATION */ 116 117 public CallForwardInfo[] cfInfo; /* This is the response data for SS request 118 to query call forward status. see 119 RIL_REQUEST_QUERY_CALL_FORWARD_STATUS */ 120 ServiceTypeFromRILInt(int type)121 public ServiceType ServiceTypeFromRILInt(int type) { 122 try { 123 return ServiceType.values()[type]; 124 } catch (IndexOutOfBoundsException e) { 125 Rlog.e(GsmCdmaPhone.LOG_TAG, "Invalid Service type"); 126 return null; 127 } 128 } 129 RequestTypeFromRILInt(int type)130 public RequestType RequestTypeFromRILInt(int type) { 131 try { 132 return RequestType.values()[type]; 133 } catch (IndexOutOfBoundsException e) { 134 Rlog.e(GsmCdmaPhone.LOG_TAG, "Invalid Request type"); 135 return null; 136 } 137 } 138 TeleserviceTypeFromRILInt(int type)139 public TeleserviceType TeleserviceTypeFromRILInt(int type) { 140 try { 141 return TeleserviceType.values()[type]; 142 } catch (IndexOutOfBoundsException e) { 143 Rlog.e(GsmCdmaPhone.LOG_TAG, "Invalid Teleservice type"); 144 return null; 145 } 146 } 147 toString()148 public String toString() { 149 return "[SsData] " + "ServiceType: " + serviceType 150 + " RequestType: " + requestType 151 + " TeleserviceType: " + teleserviceType 152 + " ServiceClass: " + serviceClass 153 + " Result: " + result 154 + " Is Service Type CF: " + serviceType.isTypeCF(); 155 } 156 } 157