• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 com.android.internal.telephony.CallForwardInfo;
23 import com.android.internal.telephony.GsmCdmaPhone;
24 import com.android.telephony.Rlog;
25 
26 /**
27  * See also RIL_StkCcUnsolSsResponse in include/telephony/ril.h
28  *
29  * {@hide}
30  */
31 public class SsData {
32     public enum ServiceType {
33         SS_CFU,
34         SS_CF_BUSY,
35         SS_CF_NO_REPLY,
36         SS_CF_NOT_REACHABLE,
37         SS_CF_ALL,
38         SS_CF_ALL_CONDITIONAL,
39         SS_CLIP,
40         SS_CLIR,
41         SS_COLP,
42         SS_COLR,
43         SS_WAIT,
44         SS_BAOC,
45         SS_BAOIC,
46         SS_BAOIC_EXC_HOME,
47         SS_BAIC,
48         SS_BAIC_ROAMING,
49         SS_ALL_BARRING,
50         SS_OUTGOING_BARRING,
51         SS_INCOMING_BARRING;
52 
isTypeCF()53         public boolean isTypeCF() {
54             return (this == SS_CFU || this == SS_CF_BUSY || this == SS_CF_NO_REPLY ||
55                   this == SS_CF_NOT_REACHABLE || this == SS_CF_ALL ||
56                   this == SS_CF_ALL_CONDITIONAL);
57         }
58 
isTypeUnConditional()59         public boolean isTypeUnConditional() {
60             return (this == SS_CFU || this == SS_CF_ALL);
61         }
62 
isTypeCW()63         public boolean isTypeCW() {
64             return (this == SS_WAIT);
65         }
66 
isTypeClip()67         public boolean isTypeClip() {
68             return (this == SS_CLIP);
69         }
70 
isTypeClir()71         public boolean isTypeClir() {
72             return (this == SS_CLIR);
73         }
74 
isTypeBarring()75         public boolean isTypeBarring() {
76             return (this == SS_BAOC || this == SS_BAOIC || this == SS_BAOIC_EXC_HOME ||
77                   this == SS_BAIC || this == SS_BAIC_ROAMING || this == SS_ALL_BARRING ||
78                   this == SS_OUTGOING_BARRING || this == SS_INCOMING_BARRING);
79         }
80     };
81 
82     public enum RequestType {
83         SS_ACTIVATION,
84         SS_DEACTIVATION,
85         SS_INTERROGATION,
86         SS_REGISTRATION,
87         SS_ERASURE;
88 
isTypeInterrogation()89         public boolean isTypeInterrogation() {
90             return (this == SS_INTERROGATION);
91         }
92     };
93 
94     public enum TeleserviceType {
95         SS_ALL_TELE_AND_BEARER_SERVICES,
96         SS_ALL_TELESEVICES,
97         SS_TELEPHONY,
98         SS_ALL_DATA_TELESERVICES,
99         SS_SMS_SERVICES,
100         SS_ALL_TELESERVICES_EXCEPT_SMS;
101     };
102 
103     public ServiceType serviceType;
104     public RequestType requestType;
105     public TeleserviceType teleserviceType;
106     public int serviceClass;
107     public int result;
108 
109     public int[] ssInfo; /* This is the response data for most of the SS GET/SET
110                             RIL requests. E.g. RIL_REQUSET_GET_CLIR returns
111                             two ints, so first two values of ssInfo[] will be
112                             used for respone if serviceType is SS_CLIR and
113                             requestType is SS_INTERROGATION */
114 
115     public CallForwardInfo[] cfInfo; /* This is the response data for SS request
116                                         to query call forward status. see
117                                         RIL_REQUEST_QUERY_CALL_FORWARD_STATUS */
118 
ServiceTypeFromRILInt(int type)119     public ServiceType ServiceTypeFromRILInt(int type) {
120         try {
121             return ServiceType.values()[type];
122         } catch (IndexOutOfBoundsException e) {
123             Rlog.e(GsmCdmaPhone.LOG_TAG, "Invalid Service type");
124             return null;
125         }
126     }
127 
RequestTypeFromRILInt(int type)128     public RequestType RequestTypeFromRILInt(int type) {
129         try {
130             return RequestType.values()[type];
131         } catch (IndexOutOfBoundsException e) {
132             Rlog.e(GsmCdmaPhone.LOG_TAG, "Invalid Request type");
133             return null;
134         }
135     }
136 
TeleserviceTypeFromRILInt(int type)137     public TeleserviceType TeleserviceTypeFromRILInt(int type) {
138         try {
139             return TeleserviceType.values()[type];
140         } catch (IndexOutOfBoundsException e) {
141             Rlog.e(GsmCdmaPhone.LOG_TAG, "Invalid Teleservice type");
142             return null;
143         }
144     }
145 
toString()146     public String toString() {
147         return "[SsData] " + "ServiceType: " + serviceType
148             + " RequestType: " + requestType
149             + " TeleserviceType: " + teleserviceType
150             + " ServiceClass: " + serviceClass
151             + " Result: " + result
152             + " Is Service Type CF: " + serviceType.isTypeCF();
153     }
154 }
155