aboutsummaryrefslogtreecommitdiff
path: root/java/com/android/libraries/entitlement/EsimOdsaOperation.java
blob: 20f4fa3bfbad85cc578836c490cc5d6dbf271a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.libraries.entitlement;

import com.google.auto.value.AutoValue;

/**
 * HTTP request parameters specific to on device service actiavation (ODSA). See GSMA spec TS.43
 * section 6.2.
 */
@AutoValue
public abstract class EsimOdsaOperation {
    /**
     * OSDA operation: CheckEligibility.
     */
    public static final String OPERATION_CHECK_ELIGIBILITY = "CheckEligibility";
    /**
     * OSDA operation: ManageSubscription.
     */
    public static final String OPERATION_MANAGE_SUBSCRIPTION = "ManageSubscription";
    /**
     * OSDA operation: ManageService.
     */
    public static final String OPERATION_MANAGE_SERVICE = "ManageService";
    /**
     * OSDA operation: AcquireConfiguration.
     */
    public static final String OPERATION_ACQUIRE_CONFIGURATION = "AcquireConfiguration";

    /**
     * Indicates that operation_type is not set.
     */
    public static final int OPERATION_TYPE_NOT_SET = -1;
    /**
     * To activate a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}.
     */
    public static final int OPERATION_TYPE_SUBSCRIBE = 0;
    /**
     * To cancel a subscription, used by {@link #OPERATION_MANAGE_SUBSCRIPTION}.
     */
    public static final int OPERATION_TYPE_UNSUBSCRIBE = 1;
    /**
     * To manage an existing subscription, for {@link #OPERATION_MANAGE_SUBSCRIPTION}.
     */
    public static final int OPERATION_TYPE_CHANGE_SUBSCRIPTION = 2;
    /**
     * To transfer a subscription from an existing device, used by {@link
     * #OPERATION_MANAGE_SUBSCRIPTION}.
     */
    public static final int OPERATION_TYPE_TRANSFER_SUBSCRIPTION = 3;
    /**
     * To inform the network of a subscription update, used by
     * {@link #OPERATION_MANAGE_SUBSCRIPTION}.
     */
    public static final int OPERATION_TYPE_UPDATE_SUBSCRIPTION = 4;
    /**
     * To activate a service, used by {@link #OPERATION_MANAGE_SERVICE}.
     */
    public static final int OPERATION_TYPE_ACTIVATE_SERVICE = 10;
    /**
     * To deactivate a service, used by {@link #OPERATION_MANAGE_SERVICE}.
     */
    public static final int OPERATION_TYPE_DEACTIVATE_SERVICE = 11;

    /**
     * Indicates the companion device carries the same MSISDN as the primary device.
     */
    public static final String COMPANION_SERVICE_SHAERED_NUMBER = "SharedNumber";
    /**
     * Indicates the companion device carries a different MSISDN as the primary device.
     */
    public static final String COMPANION_SERVICE_DIFFERENT_NUMBER = "DiffNumber";

    /**
     * Returns the eSIM ODSA operation. Used by HTTP parameter "operation".
     */
    public abstract String operation();

    /**
     * Returns the detiled type of the eSIM ODSA operation. Used by HTTP parameter
     * "operation_type".
     */
    public abstract int operationType();

    /**
     * Returns the unique identifier of the companion device, like IMEI. Used by HTTP parameter
     * "companion_terminal_id".
     */
    public abstract String companionTerminalId();

    /**
     * Returns the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor".
     */
    public abstract String companionTerminalVendor();

    /**
     * Returns the model of the companion device. Used by HTTP parameter
     * "companion_terminal_model".
     */
    public abstract String companionTerminalModel();

    /**
     * Returns the software version of the companion device. Used by HTTP parameter
     * "companion_terminal_sw_version".
     */
    public abstract String companionTerminalSoftwareVersion();

    /**
     * Returns the user-friendly version of the companion device. Used by HTTP parameter
     * "companion_terminal_friendly_name".
     */
    public abstract String companionTerminalFriendlyName();

    /**
     * Returns the service type of the companion device, e.g. if the MSISDN is same as the primary
     * device. Used by HTTP parameter "companion_terminal_service".
     */
    public abstract String companionTerminalService();

    /**
     * Returns the ICCID of the companion device. Used by HTTP parameter
     * "companion_terminal_iccid".
     */
    public abstract String companionTerminalIccid();

    /**
     * Returns the EID of the companion device. Used by HTTP parameter "companion_terminal_eid".
     */
    public abstract String companionTerminalEid();

    /**
     * Returns the ICCID of the primary device eSIM. Used by HTTP parameter "terminal_iccid".
     */
    public abstract String terminalIccid();

    /**
     * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter
     * "terminal_eid".
     */
    public abstract String terminalEid();

    /**
     * Returns the unique identifier of the primary device eSIM, like the IMEI associated with the
     * eSIM. Used by HTTP parameter "target_terminal_id".
     */
    public abstract String targetTerminalId();

    /**
     * Returns the ICCID primary device eSIM. Used by HTTP parameter "target_terminal_iccid".
     */
    public abstract String targetTerminalIccid();

    /**
     * Returns the eUICC identifier (EID) of the primary device eSIM. Used by HTTP parameter
     * "target_terminal_eid".
     */
    public abstract String targetTerminalEid();

    /**
     * Returns a new {@link Builder} object.
     */
    public static Builder builder() {
        return new AutoValue_EsimOdsaOperation.Builder()
                .setOperation("")
                .setOperationType(OPERATION_TYPE_NOT_SET)
                .setCompanionTerminalId("")
                .setCompanionTerminalVendor("")
                .setCompanionTerminalModel("")
                .setCompanionTerminalSoftwareVersion("")
                .setCompanionTerminalFriendlyName("")
                .setCompanionTerminalService("")
                .setCompanionTerminalIccid("")
                .setCompanionTerminalEid("")
                .setTerminalIccid("")
                .setTerminalEid("")
                .setTargetTerminalId("")
                .setTargetTerminalIccid("")
                .setTargetTerminalEid("");
    }

    /**
     * Builder.
     *
     * <p>For ODSA, the rule of which parameters are required varies or each
     * operation/opeation_type. The Javadoc below gives high-level description, but please refer to
     * GMSA spec TS.43 section 6.2 for details.
     */
    @AutoValue.Builder
    public abstract static class Builder {
        /**
         * Sets the eSIM ODSA operation. Used by HTTP parameter "operation".
         *
         * <p>Required.
         *
         * @see #OPERATION_CHECK_ELIGIBILITY
         * @see #OPERATION_MANAGE_SUBSCRIPTION
         * @see #OPERATION_MANAGE_SERVICE
         * @see #OPERATION_ACQUIRE_CONFIGURATION
         */
        public abstract Builder setOperation(String value);

        /**
         * Sets the detiled type of the eSIM ODSA operation. Used by HTTP parameter "operation_type"
         * if set.
         *
         * <p>Required by some operation.
         *
         * @see #OPERATION_TYPE_SUBSCRIBE
         * @see #OPERATION_TYPE_UNSUBSCRIBE
         * @see #OPERATION_TYPE_CHANGE_SUBSCRIPTION
         * @see #OPERATION_TYPE_TRANSFER_SUBSCRIPTION
         * @see #OPERATION_TYPE_UPDATE_SUBSCRIPTION
         * @see #OPERATION_TYPE_ACTIVATE_SERVICE
         * @see #OPERATION_TYPE_DEACTIVATE_SERVICE
         */
        public abstract Builder setOperationType(int value);

        /**
         * Sets the unique identifier of the companion device, like IMEI. Used by HTTP parameter
         * "companion_terminal_id" if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalId(String value);

        /**
         * Sets the OEM of the companion device. Used by HTTP parameter "companion_terminal_vendor"
         * if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalVendor(String value);

        /**
         * Sets the model of the companion device. Used by HTTP parameter "companion_terminal_model"
         * if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalModel(String value);

        /**
         * Sets the software version of the companion device. Used by HTTP parameter
         * "companion_terminal_sw_version" if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalSoftwareVersion(String value);

        /**
         * Sets the user-friendly version of the companion device. Used by HTTP parameter
         * "companion_terminal_friendly_name" if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalFriendlyName(String value);

        /**
         * Sets the service type of the companion device, e.g. if the MSISDN is same as the primary
         * device. Used by HTTP parameter "companion_terminal_service" if set.
         *
         * <p>Used by companion device ODSA operation.
         *
         * @see #COMPANION_SERVICE_SHAERED_NUMBER
         * @see #COMPANION_SERVICE_DIFFERENT_NUMBER
         */
        public abstract Builder setCompanionTerminalService(String value);

        /**
         * Sets the ICCID of the companion device. Used by HTTP parameter "companion_terminal_iccid"
         * if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalIccid(String value);

        /**
         * Sets the eUICC identifier (EID) of the companion device. Used by HTTP parameter
         * "companion_terminal_eid" if set.
         *
         * <p>Used by companion device ODSA operation.
         */
        public abstract Builder setCompanionTerminalEid(String value);

        /**
         * Sets the ICCID of the primary device eSIM in case of primary SIM not present. Used by
         * HTTP parameter "terminal_eid" if set.
         *
         * <p>Used by primary device ODSA operation.
         */
        public abstract Builder setTerminalIccid(String value);

        /**
         * Sets the eUICC identifier (EID) of the primary device eSIM in case of primary SIM not
         * present. Used by HTTP parameter "terminal_eid" if set.
         *
         * <p>Used by primary device ODSA operation.
         */
        public abstract Builder setTerminalEid(String value);

        /**
         * Sets the unique identifier of the primary device eSIM in case of multiple SIM, like the
         * IMEI associated with the eSIM. Used by HTTP parameter "target_terminal_id" if set.
         *
         * <p>Used by primary device ODSA operation.
         */
        public abstract Builder setTargetTerminalId(String value);

        /**
         * Sets the ICCID primary device eSIM in case of multiple SIM. Used by HTTP parameter
         * "target_terminal_iccid" if set.
         *
         * <p>Used by primary device ODSA operation.
         */
        public abstract Builder setTargetTerminalIccid(String value);

        /**
         * Sets the eUICC identifier (EID) of the primary device eSIM in case of multiple SIM. Used
         * by HTTP parameter "target_terminal_eid" if set.
         *
         * <p>Used by primary device ODSA operation.
         */
        public abstract Builder setTargetTerminalEid(String value);

        public abstract EsimOdsaOperation build();
    }
}