• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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.libraries.entitlement;
18 
19 import com.google.auto.value.AutoValue;
20 
21 /**
22  * HTTP request parameters specific to on device service actiavation (ODSA). See GSMA spec TS.43
23  * section 6.2.
24  */
25 @AutoValue
26 public abstract class EsimOdsaOperation {
27     /**
28      * OSDA operation: CheckEligibility.
29      */
30     public static final String OPERATION_CHECK_ELIGIBILITY = "CheckEligibility";
31     /**
32      * OSDA operation: ManageSubscription.
33      */
34     public static final String OPERATION_MANAGE_SUBSCRIPTION = "ManageSubscription";
35     /**
36      * OSDA operation: ManageService.
37      */
38     public static final String OPERATION_MANAGE_SERVICE = "ManageService";
39     /**
40      * OSDA operation: AcquireConfiguration.
41      */
42     public static final String OPERATION_ACQUIRE_CONFIGURATION = "AcquireConfiguration";
43 
44     /**
45      * Indicates that operation_type is not set.
46      */
47     public static final int OPERATION_TYPE_NOT_SET = -1;
48     /**
49      * To activate a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}.
50      */
51     public static final int OPERATION_TYPE_SUBSCRIBE = 0;
52     /**
53      * To cancel a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}.
54      */
55     public static final int OPERATION_TYPE_UNSUBSCRIBE = 1;
56     /**
57      * To manage an existing subscription, for {@link #OPERATION_MANAGE_SUBSCRIPTION}.
58      */
59     public static final int OPERATION_TYPE_CHANGE_SUBSCRIPTION = 2;
60     /**
61      * To transfer a subscription from an existing device, used by {@link
62      * #OPERATION_MANAGE_SUBSCRIPTION}.
63      */
64     public static final int OPERATION_TYPE_TRANSFER_SUBSCRIPTION = 3;
65     /**
66      * To inform the network of a subscription update, used by
67      * {@link #OPERATION_MANAGE_SUBSCRIPTION}.
68      */
69     public static final int OPERATION_TYPE_UPDATE_SUBSCRIPTION = 4;
70     /**
71      * To activate a service, used by {@link #OPERATION_MANAGE_SERVICE}.
72      */
73     public static final int OPERATION_TYPE_ACTIVATE_SERVICE = 10;
74     /**
75      * To deactivate a service, used by {@link #OPERATION_MANAGE_SERVICE}.
76      */
77     public static final int OPERATION_TYPE_DEACTIVATE_SERVICE = 11;
78 
79     /**
80      * Indicates the companion device carries the same MSISDN as the primary device.
81      */
82     public static final String COMPANION_SERVICE_SHAERED_NUMBER = "SharedNumber";
83     /**
84      * Indicates the companion device carries a different MSISDN as the primary device.
85      */
86     public static final String COMPANION_SERVICE_DIFFERENT_NUMBER = "DiffNumber";
87 
88     /**
89      * Returns the eSIM ODSA operation. Used by HTTP parameter "operation".
90      */
operation()91     public abstract String operation();
92 
93     /**
94      * Returns the detiled type of the eSIM ODSA operation. Used by HTTP parameter
95      * "operation_type".
96      */
operationType()97     public abstract int operationType();
98 
99     /**
100      * Returns the unique identifier of the companion device, like IMEI. Used by HTTP parameter
101      * "companion_terminal_id".
102      */
companionTerminalId()103     public abstract String companionTerminalId();
104 
105     /**
106      * Returns the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor".
107      */
companionTerminalVendor()108     public abstract String companionTerminalVendor();
109 
110     /**
111      * Returns the model of the companion device. Used by HTTP parameter
112      * "companion_terminal_model".
113      */
companionTerminalModel()114     public abstract String companionTerminalModel();
115 
116     /**
117      * Returns the software version of the companion device. Used by HTTP parameter
118      * "companion_terminal_sw_version".
119      */
companionTerminalSoftwareVersion()120     public abstract String companionTerminalSoftwareVersion();
121 
122     /**
123      * Returns the user-friendly version of the companion device. Used by HTTP parameter
124      * "companion_terminal_friendly_name".
125      */
companionTerminalFriendlyName()126     public abstract String companionTerminalFriendlyName();
127 
128     /**
129      * Returns the service type of the companion device, e.g. if the MSISDN is same as the primary
130      * device. Used by HTTP parameter "companion_terminal_service".
131      */
companionTerminalService()132     public abstract String companionTerminalService();
133 
134     /**
135      * Returns the ICCID of the companion device. Used by HTTP parameter
136      * "companion_terminal_iccid".
137      */
companionTerminalIccid()138     public abstract String companionTerminalIccid();
139 
140     /**
141      * Returns the EID of the companion device. Used by HTTP parameter "companion_terminal_eid".
142      */
companionTerminalEid()143     public abstract String companionTerminalEid();
144 
145     /**
146      * Returns the ICCID of the primary device eSIM. Used by HTTP parameter "terminal_iccid".
147      */
terminalIccid()148     public abstract String terminalIccid();
149 
150     /**
151      * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter
152      * "terminal_eid".
153      */
terminalEid()154     public abstract String terminalEid();
155 
156     /**
157      * Returns the unique identifier of the primary device eSIM, like the IMEI associated with the
158      * eSIM. Used by HTTP parameter "target_terminal_id".
159      */
targetTerminalId()160     public abstract String targetTerminalId();
161 
162     /**
163      * Returns the ICCID primary device eSIM. Used by HTTP parameter "target_terminal_iccid".
164      */
targetTerminalIccid()165     public abstract String targetTerminalIccid();
166 
167     /**
168      * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter
169      * "target_terminal_eid".
170      */
targetTerminalEid()171     public abstract String targetTerminalEid();
172 
173     /**
174      * Returns a new {@link Builder} object.
175      */
builder()176     public static Builder builder() {
177         return new AutoValue_EsimOdsaOperation.Builder()
178                 .setOperation("")
179                 .setOperationType(OPERATION_TYPE_NOT_SET)
180                 .setCompanionTerminalId("")
181                 .setCompanionTerminalVendor("")
182                 .setCompanionTerminalModel("")
183                 .setCompanionTerminalSoftwareVersion("")
184                 .setCompanionTerminalFriendlyName("")
185                 .setCompanionTerminalService("")
186                 .setCompanionTerminalIccid("")
187                 .setCompanionTerminalEid("")
188                 .setTerminalIccid("")
189                 .setTerminalEid("")
190                 .setTargetTerminalId("")
191                 .setTargetTerminalIccid("")
192                 .setTargetTerminalEid("");
193     }
194 
195     /**
196      * Builder.
197      *
198      * <p>For ODSA, the rule of which parameters are required varies or each
199      * operation/opeation_type. The Javadoc below gives high-level description, but please refer to
200      * GMSA spec TS.43 section 6.2 for details.
201      */
202     @AutoValue.Builder
203     public abstract static class Builder {
204         /**
205          * Sets the eSIM ODSA operation. Used by HTTP parameter "operation".
206          *
207          * <p>Required.
208          *
209          * @see #OPERATION_CHECK_ELIGIBILITY
210          * @see #OPERATION_MANAGE_SUBSCRIPTION
211          * @see #OPERATION_MANAGE_SERVICE
212          * @see #OPERATION_ACQUIRE_CONFIGURATION
213          */
setOperation(String value)214         public abstract Builder setOperation(String value);
215 
216         /**
217          * Sets the detiled type of the eSIM ODSA operation. Used by HTTP parameter "operation_type"
218          * if set.
219          *
220          * <p>Required by some operation.
221          *
222          * @see #OPERATION_TYPE_SUBSCRIBE
223          * @see #OPERATION_TYPE_UNSUBSCRIBE
224          * @see #OPERATION_TYPE_CHANGE_SUBSCRIPTION
225          * @see #OPERATION_TYPE_TRANSFER_SUBSCRIPTION
226          * @see #OPERATION_TYPE_UPDATE_SUBSCRIPTION
227          * @see #OPERATION_TYPE_ACTIVATE_SERVICE
228          * @see #OPERATION_TYPE_DEACTIVATE_SERVICE
229          */
setOperationType(int value)230         public abstract Builder setOperationType(int value);
231 
232         /**
233          * Sets the unique identifier of the companion device, like IMEI. Used by HTTP parameter
234          * "companion_terminal_id" if set.
235          *
236          * <p>Used by companion device ODSA operation.
237          */
setCompanionTerminalId(String value)238         public abstract Builder setCompanionTerminalId(String value);
239 
240         /**
241          * Sets the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor"
242          * if set.
243          *
244          * <p>Used by companion device ODSA operation.
245          */
setCompanionTerminalVendor(String value)246         public abstract Builder setCompanionTerminalVendor(String value);
247 
248         /**
249          * Sets the model of the companion device. Used by HTTP parameter "companion_terminal_model"
250          * if set.
251          *
252          * <p>Used by companion device ODSA operation.
253          */
setCompanionTerminalModel(String value)254         public abstract Builder setCompanionTerminalModel(String value);
255 
256         /**
257          * Sets the software version of the companion device. Used by HTTP parameter
258          * "companion_terminal_sw_version" if set.
259          *
260          * <p>Used by companion device ODSA operation.
261          */
setCompanionTerminalSoftwareVersion(String value)262         public abstract Builder setCompanionTerminalSoftwareVersion(String value);
263 
264         /**
265          * Sets the user-friendly version of the companion device. Used by HTTP parameter
266          * "companion_terminal_friendly_name" if set.
267          *
268          * <p>Used by companion device ODSA operation.
269          */
setCompanionTerminalFriendlyName(String value)270         public abstract Builder setCompanionTerminalFriendlyName(String value);
271 
272         /**
273          * Sets the service type of the companion device, e.g. if the MSISDN is same as the primary
274          * device. Used by HTTP parameter "companion_terminal_service" if set.
275          *
276          * <p>Used by companion device ODSA operation.
277          *
278          * @see #COMPANION_SERVICE_SHAERED_NUMBER
279          * @see #COMPANION_SERVICE_DIFFERENT_NUMBER
280          */
setCompanionTerminalService(String value)281         public abstract Builder setCompanionTerminalService(String value);
282 
283         /**
284          * Sets the ICCID of the companion device. Used by HTTP parameter "companion_terminal_iccid"
285          * if set.
286          *
287          * <p>Used by companion device ODSA operation.
288          */
setCompanionTerminalIccid(String value)289         public abstract Builder setCompanionTerminalIccid(String value);
290 
291         /**
292          * Sets the eUICC identifier (EID) of the companion device. Used by HTTP parameter
293          * "companion_terminal_eid" if set.
294          *
295          * <p>Used by companion device ODSA operation.
296          */
setCompanionTerminalEid(String value)297         public abstract Builder setCompanionTerminalEid(String value);
298 
299         /**
300          * Sets the ICCID of the primary device eSIM in case of primary SIM not present. Used by
301          * HTTP parameter "terminal_eid" if set.
302          *
303          * <p>Used by primary device ODSA operation.
304          */
setTerminalIccid(String value)305         public abstract Builder setTerminalIccid(String value);
306 
307         /**
308          * Sets the eUICC identifier (EID) of the primary device eSIM in case of primary SIM not
309          * present. Used by HTTP parameter "terminal_eid" if set.
310          *
311          * <p>Used by primary device ODSA operation.
312          */
setTerminalEid(String value)313         public abstract Builder setTerminalEid(String value);
314 
315         /**
316          * Sets the unique identifier of the primary device eSIM in case of multiple SIM, like the
317          * IMEI associated with the eSIM. Used by HTTP parameter "target_terminal_id" if set.
318          *
319          * <p>Used by primary device ODSA operation.
320          */
setTargetTerminalId(String value)321         public abstract Builder setTargetTerminalId(String value);
322 
323         /**
324          * Sets the ICCID primary device eSIM in case of multiple SIM. Used by HTTP parameter
325          * "target_terminal_iccid" if set.
326          *
327          * <p>Used by primary device ODSA operation.
328          */
setTargetTerminalIccid(String value)329         public abstract Builder setTargetTerminalIccid(String value);
330 
331         /**
332          * Sets the eUICC identifier (EID) of the primary device eSIM in case of multiple SIM. Used
333          * by HTTP parameter "target_terminal_eid" if set.
334          *
335          * <p>Used by primary device ODSA operation.
336          */
setTargetTerminalEid(String value)337         public abstract Builder setTargetTerminalEid(String value);
338 
build()339         public abstract EsimOdsaOperation build();
340     }
341 }
342