1/*
2 * Copyright (C) 2017 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
17package android.hardware.radio@1.2;
18
19import @1.0::Call;
20import @1.0::CardState;
21import @1.0::CardStatus;
22import @1.0::CdmaSignalStrength;
23import @1.0::CellIdentityCdma;
24import @1.0::CellIdentityGsm;
25import @1.0::CellIdentityLte;
26import @1.0::CellIdentityTdscdma;
27import @1.0::CellIdentityWcdma;
28import @1.0::CellInfoTdscdma;
29import @1.0::CellInfoType;
30import @1.0::EvdoSignalStrength;
31import @1.0::GsmSignalStrength;
32import @1.0::LteSignalStrength;
33import @1.0::RadioConst;
34import @1.0::RadioError;
35import @1.0::RegState;
36import @1.0::SignalStrength;
37import @1.0::TdScdmaSignalStrength;
38import @1.0::TimeStampType;
39import @1.0::WcdmaSignalStrength;
40import @1.1::RadioAccessSpecifier;
41import @1.1::ScanStatus;
42import @1.1::ScanType;
43
44enum RadioConst : @1.0::RadioConst {
45    RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8,
46};
47
48/**
49 * values are in seconds
50 */
51enum ScanIntervalRange : int32_t {
52    MIN = 5,
53    MAX = 300,
54};
55
56/**
57 * value are in seconds
58 */
59enum MaxSearchTimeRange : int32_t {
60    MIN = 60,
61    MAX = 3600,
62};
63
64/**
65 * values are in seconds
66 */
67enum IncrementalResultsPeriodicityRange : int32_t {
68    MIN = 1,
69    MAX = 10,
70};
71
72enum CellConnectionStatus : int32_t {
73    /**
74     * Cell is not a serving cell.
75     */
76    NONE = 0,
77    /**
78     * UE has connection to cell for signalling and possibly data (3GPP 36.331, 25.331).
79     */
80    PRIMARY_SERVING,
81    /**
82     * UE has connection to cell for data (3GPP 36.331, 25.331).
83     */
84    SECONDARY_SERVING,
85};
86
87/**
88 * Overwritten from @1.0::IndicationFilter in order to redefine ALL. In the future, this should
89 * be extended instead of overwritten.
90 */
91enum IndicationFilter : int32_t {
92    NONE = 0,
93    ALL = ~0,
94    /**
95     * When this bit is set, modem must send the signal strength update through
96     * IRadioIndication.currentSignalStrength() when all criteria specified by
97     * IRadio.setSignalStrengthReportingCriteria() are met.
98     */
99    SIGNAL_STRENGTH = 1 << 0,
100    /**
101     * When this bit is set, modem must invoke IRadioIndication.networkStateChanged() when any field
102     * in VoiceRegStateResult or DataRegStateResult changes. When this bit is not set, modem must
103     * suppress IRadioIndication.networkStateChanged() when there are only changes from
104     * insignificant fields. Modem must invoke IRadioIndication.networkStateChanged() when
105     * significant fields are updated regardless of whether this bit is set.
106     *
107     * The following fields are considered significant: VoiceRegStateResult.regState,
108     * VoiceRegStateResult.rat, DataRegStateResult.regState, DataRegStateResult.rat.
109     */
110    FULL_NETWORK_STATE = 1 << 1,
111    /**
112     * When this bit is set, modem must send IRadioIndication.dataCallListChanged() whenever any
113     * field in ITypes.SetupDataCallResult changes. When this bit is not set, modem must suppress
114     * the indication when the only changed field is 'active' (for data dormancy). For all other
115     * field changes, the modem must send IRadioIndication.dataCallListChanged() regardless of
116     * whether this bit is set.
117     */
118    DATA_CALL_DORMANCY_CHANGED = 1 << 2,
119    /**
120     * When this bit is set, modem must send the link capacity update through
121     * IRadioIndication.currentLinkCapacityEstimate() when all criteria specified by
122     * IRadio.setLinkCapacityReportingCriteria() are met.
123     */
124    LINK_CAPACITY_ESTIMATE = 1 << 3,
125    /**
126     * When this bit is set, the modem must send the physical channel configuration update through
127     * IRadioIndication.currentPhysicalChannelConfigs() when the configuration has changed. It is
128     * recommended that this be reported whenever link capacity or signal strength is reported.
129     */
130    PHYSICAL_CHANNEL_CONFIG = 1 << 4,
131};
132
133/**
134 * Audio codec which is used on GSM, UMTS, and CDMA. These values must be opaque
135 * to the Android framework. Only for display.
136 */
137enum AudioQuality : int32_t {
138    /** Unspecified audio codec */
139    UNSPECIFIED,
140    /** AMR (Narrowband) audio codec */
141    AMR,
142    /** AMR (Wideband) audio codec */
143    AMR_WB,
144    /** GSM Enhanced Full-Rate audio codec */
145    GSM_EFR,
146    /** GSM Full-Rate audio codec */
147    GSM_FR,
148    /** GSM Half-Rate audio codec */
149    GSM_HR,
150    /** Enhanced Variable rate codec */
151    EVRC,
152    /** Enhanced Variable rate codec revision B */
153    EVRC_B,
154    /** Enhanced Variable rate codec (Wideband) */
155    EVRC_WB,
156    /** Enhanced Variable rate codec (Narrowband) */
157    EVRC_NW,
158};
159
160struct NetworkScanRequest {
161    ScanType type;
162
163    /**
164     * Time interval in seconds between the completion of one scan and the start of a subsequent scan.
165     * This field is only valid when 'type' is 'PERIODIC'.
166     * Range: ScanIntervalRange:MIN to ScanIntervalRange:MAX
167     */
168    int32_t interval;
169
170    /**
171     * Networks with bands/channels to scan
172     * Maximum length of the vector is
173     * RadioConst:RADIO_ACCESS_SPECIFIER_MAX_SIZE
174     */
175    vec<RadioAccessSpecifier> specifiers;
176
177    /**
178     * Maximum duration of the periodic search (in seconds).
179     * Expected range for the input is [MaxSearchTimeRange:MIN - MaxSearchTimeRange:MAX]
180     * If the search lasts maxSearchTime, it must be terminated.
181     */
182    int32_t maxSearchTime;
183
184    /**
185     * Indicates whether the modem must report incremental results of the network scan
186     * to the client.
187     * FALSE – Incremental results must not be reported.
188     * TRUE  – Incremental must be reported.
189     */
190    bool incrementalResults;
191
192    /**
193     * Indicates the periodicity with which the modem must report incremental results to
194     * the client (in seconds).
195     * Expected range for the input is
196     * [IncrementalResultsPeriodicityRange:MIN - IncrementalResultsPeriodicityRange:MAX]
197     * This value must be less than or equal to maxSearchTime. If incremental results are
198     * not requested, implementations may ignore this value.
199     */
200    int32_t incrementalResultsPeriodicity;
201
202    /**
203     * Describes the List of PLMN ids (MCC-MNC)
204     * If any PLMN of this list is found, search must end at that point and results with all
205     * PLMN found until that point should be sent as response.
206     * If the list is not sent, search to be completed until end and all PLMNs found to be
207     * reported.
208     */
209    vec<string> mccMncs;
210};
211
212struct NetworkScanResult {
213    /**
214     * The status of the scan.
215     */
216    ScanStatus status;
217
218    /**
219     * The error code of the incremental result.
220     */
221    RadioError error;
222
223    /**
224     * List of network information as CellInfo.
225     */
226    vec<CellInfo> networkInfos;
227};
228
229struct CellIdentityOperatorNames {
230    /**
231     * Long alpha Operator Name String or Enhanced Operator Name String.
232     */
233    string alphaLong;
234
235    /**
236     * Short alpha Operator Name String or Enhanced Operator Name String
237     */
238    string alphaShort;
239};
240
241struct CellIdentityCdma {
242    @1.0::CellIdentityCdma base;
243    CellIdentityOperatorNames operatorNames;
244};
245
246struct CellIdentityGsm {
247    @1.0::CellIdentityGsm base;
248    CellIdentityOperatorNames operatorNames;
249};
250
251struct CellIdentityLte {
252    @1.0::CellIdentityLte base;
253    CellIdentityOperatorNames operatorNames;
254    /**
255     * Cell bandwidth, in kHz.
256     */
257    int32_t bandwidth;
258};
259
260struct CellIdentityTdscdma {
261    @1.0::CellIdentityTdscdma base;
262    /**
263     * 16-bit UMTS Absolute RF Channel Number defined in TS 25.102 5.4.4; this value must be valid.
264     */
265    int32_t uarfcn;
266    CellIdentityOperatorNames operatorNames;
267};
268
269struct CellIdentityWcdma {
270    @1.0::CellIdentityWcdma base;
271    CellIdentityOperatorNames operatorNames;
272};
273
274struct CellInfoGsm {
275    CellIdentityGsm cellIdentityGsm;
276    GsmSignalStrength signalStrengthGsm;
277};
278
279struct CellInfoWcdma {
280    CellIdentityWcdma cellIdentityWcdma;
281    WcdmaSignalStrength signalStrengthWcdma;
282};
283
284struct CellInfoCdma {
285    CellIdentityCdma cellIdentityCdma;
286    CdmaSignalStrength signalStrengthCdma;
287    EvdoSignalStrength signalStrengthEvdo;
288};
289
290struct CellInfoLte {
291    CellIdentityLte cellIdentityLte;
292    LteSignalStrength signalStrengthLte;
293};
294
295struct CellInfoTdscdma {
296    CellIdentityTdscdma cellIdentityTdscdma;
297    TdscdmaSignalStrength signalStrengthTdscdma;
298};
299
300struct CellInfo {
301    /**
302     * Cell type for selecting from union CellInfo.
303     */
304    CellInfoType cellInfoType;
305    /**
306     * True if this cell is registered false if not registered.
307     */
308    bool registered;
309    /**
310     * Type of time stamp represented by timeStamp.
311     */
312    TimeStampType timeStampType;
313    /**
314     * Time in nanos as returned by ril_nano_time.
315     */
316    uint64_t timeStamp;
317    /**
318     * Only one of the below vectors must be of size 1 based on the CellInfoType and others must be
319     * of size 0.
320     */
321    vec<CellInfoGsm> gsm;
322    /**
323     * Valid only if type = cdma and size = 1 else must be empty.
324     */
325    vec<CellInfoCdma> cdma;
326    /**
327     * Valid only if type = lte and size = 1 else must be empty.
328     */
329    vec<CellInfoLte> lte;
330    /**
331     * Valid only if type = wcdma and size = 1 else must be empty.
332     */
333    vec<CellInfoWcdma> wcdma;
334    /**
335     * Valid only if type = tdscdma and size = 1 else must be empty.
336     */
337    vec<CellInfoTdscdma> tdscdma;
338    /**
339     * Connection status for the cell.
340     */
341    CellConnectionStatus connectionStatus;
342};
343
344struct CardStatus {
345    @1.0::CardStatus base;
346    uint32_t physicalSlotId;
347    /**
348     * An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816
349     * standards, following electrical reset of the card's chip. The ATR conveys information about
350     * the communication parameters proposed by the card, and the card's nature and state.
351     *
352     * This data is applicable only when cardState is CardState:PRESENT.
353     */
354    string atr;
355    /**
356     * Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is
357     * located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
358     * the ITU-T recommendation E.118 ISO/IEC 7816.
359     *
360     * This data is applicable only when cardState is CardState:PRESENT.
361     */
362    string iccid;
363};
364
365struct LinkCapacityEstimate {
366    /**
367     * Estimated downlink capacity in kbps. This bandwidth estimate shall be the estimated
368     * maximum sustainable link bandwidth (as would be measured at the Upper PDCP or SNDCP SAP).
369     * If the DL Aggregate Maximum Bit Rate is known, this value shall not exceed the DL-AMBR
370     * for the Internet PDN connection.
371     */
372    uint32_t downlinkCapacityKbps;
373    /**
374     * Estimated uplink capacity in kbps. This bandwidth estimate shall be the estimated
375     * maximum sustainable link bandwidth (as would be measured at the Upper PDCP or SNDCP SAP).
376     * If the UL Aggregate Maximum Bit Rate is known, this value shall not exceed the UL-AMBR
377     * for the Internet PDN connection.
378     */
379    uint32_t uplinkCapacityKbps;
380};
381
382struct PhysicalChannelConfig {
383    /**
384     * Connection status for cell. Valid values are PRIMARY_SERVING and SECONDARY_SERVING.
385     */
386    CellConnectionStatus status;
387    /**
388     * Cell bandwidth, in kHz.
389     */
390    int32_t cellBandwidthDownlink;
391};
392
393enum AccessNetwork : int32_t {
394    /** GSM EDGE Radio Access Network */
395    GERAN       = 1,
396    /** Universal Terrestrial Radio Access Network */
397    UTRAN       = 2,
398    /** Evolved Universal Terrestrial Radio Access Network */
399    EUTRAN      = 3,
400    /** CDMA 2000 network */
401    CDMA2000    = 4,
402    /** Interworking Wireless LAN */
403    IWLAN       = 5
404};
405
406enum DataRequestReason : int32_t {
407    /**
408     * The reason of the data request is normal
409     */
410    NORMAL    = 0x01,
411    /**
412     * The reason of the data request is device shutdown
413     */
414    SHUTDOWN  = 0x02,
415    /**
416     * The reason of the data request is IWLAN data handover to another transport
417     * (e.g. from cellular to wifi or vise versa)
418     */
419    HANDOVER  = 0x03,
420};
421
422struct Call {
423    @1.0::Call base;
424    AudioQuality audioQuality;
425};
426
427struct WcdmaSignalStrength {
428    @1.0::WcdmaSignalStrength base;
429    /**
430     * CPICH RSCP as defined in TS 25.215 5.1.1
431     * Valid values are (0-96, 255) as defined in TS 27.007 8.69
432     * INT_MAX denotes that the value is invalid/unreported.
433     */
434    uint32_t rscp;
435    /**
436     * Ec/No value as defined in TS 25.215 5.1.5
437     * Valid values are (0-49, 255) as defined in TS 27.007 8.69
438     * INT_MAX denotes that the value is invalid/unreported.
439     */
440    uint32_t ecno;
441
442};
443
444struct TdscdmaSignalStrength {
445    /**
446     * UTRA carrier RSSI as defined in TS 25.225 5.1.4
447     * Valid values are (0-31, 99) as defined in TS 27.007 8.5
448     * INT_MAX denotes that the value is invalid/unreported.
449     */
450    uint32_t signalStrength;
451    /**
452     * Transport Channel BER as defined in TS 25.225 5.2.5
453     * Valid values are (0-7, 99) as defined in TS 27.007 8.5
454     * INT_MAX denotes that the value is invalid/unreported.
455     */
456    uint32_t bitErrorRate;
457    /**
458     * P-CCPCH RSCP as defined in TS 25.225 5.1.1
459     * Valid values are (0-96, 255) as defined in TS 27.007 8.69
460     * INT_MAX denotes that the value is invalid/unreported.
461     */
462    uint32_t rscp;
463};
464
465struct SignalStrength {
466    /**
467     * If GSM measurements are provided, this structure must contain valid measurements; otherwise
468     * all fields should be set to INT_MAX to mark them as invalid.
469     */
470    GsmSignalStrength gsm;
471    /**
472     * If CDMA measurements are provided, this structure must contain valid measurements; otherwise
473     * all fields should be set to INT_MAX to mark them as invalid.
474     */
475    CdmaSignalStrength cdma;
476    /**
477     * If EvDO measurements are provided, this structure must contain valid measurements; otherwise
478     * all fields should be set to INT_MAX to mark them as invalid.
479     */
480    EvdoSignalStrength evdo;
481    /**
482     * If LTE measurements are provided, this structure must contain valid measurements; otherwise
483     * all fields should be set to INT_MAX to mark them as invalid.
484     */
485    LteSignalStrength lte;
486    /**
487     * If TD-SCDMA measurements are provided, this structure must contain valid measurements;
488     * otherwise all fields should be set to INT_MAX to mark them as invalid.
489     */
490    TdScdmaSignalStrength tdScdma;
491    /**
492     * If WCDMA measurements are provided, this structure must contain valid measurements; otherwise
493     * all fields should be set to INT_MAX to mark them as invalid.
494     */
495    WcdmaSignalStrength wcdma;
496};
497
498struct CellIdentity {
499    /**
500     * Cell type for selecting from union CellInfo.
501     * Only one of the below vectors must be of size 1 based on a
502     * valid CellInfoType and others must be of size 0.
503     * If cell info type is NONE, then all the vectors must be of size 0.
504     */
505    CellInfoType cellInfoType;
506    vec<CellIdentityGsm> cellIdentityGsm;
507    vec<CellIdentityWcdma> cellIdentityWcdma;
508    vec<CellIdentityCdma> cellIdentityCdma;
509    vec<CellIdentityLte> cellIdentityLte;
510    vec<CellIdentityTdscdma> cellIdentityTdscdma;
511};
512
513struct VoiceRegStateResult {
514    /**
515     * Valid reg states are NOT_REG_MT_NOT_SEARCHING_OP,
516     * REG_HOME, NOT_REG_MT_SEARCHING_OP, REG_DENIED,
517     * UNKNOWN, REG_ROAMING defined in RegState
518     */
519    RegState regState;
520    /**
521     * Indicates the available voice radio technology, valid values as
522     * defined by RadioTechnology.
523     */
524    int32_t rat;
525    /**
526     * concurrent services support indicator. if registered on a CDMA system.
527     * false - Concurrent services not supported,
528     * true - Concurrent services supported
529     */
530    bool cssSupported;
531    /**
532     * TSB-58 Roaming Indicator if registered on a CDMA or EVDO system or -1 if not.
533     * Valid values are 0-255.
534     */
535    int32_t roamingIndicator;
536    /**
537     * Indicates whether the current system is in the PRL if registered on a CDMA or EVDO system
538     * or -1 if not. 0=not in the PRL, 1=in the PRL
539     */
540    int32_t systemIsInPrl;
541    /**
542     * Default Roaming Indicator from the PRL if registered on a CDMA or EVDO system or -1 if not.
543     * Valid values are 0-255.
544     */
545    int32_t defaultRoamingIndicator;
546    /**
547     * reasonForDenial if registration state is 3
548     * (Registration denied) this is an enumerated reason why
549     * registration was denied. See 3GPP TS 24.008,
550     * 10.5.3.6 and Annex G.
551     * 0 - General
552     * 1 - Authentication Failure
553     * 2 - IMSI unknown in HLR
554     * 3 - Illegal MS
555     * 4 - Illegal ME
556     * 5 - PLMN not allowed
557     * 6 - Location area not allowed
558     * 7 - Roaming not allowed
559     * 8 - No Suitable Cells in this Location Area
560     * 9 - Network failure
561     * 10 - Persistent location update reject
562     * 11 - PLMN not allowed
563     * 12 - Location area not allowed
564     * 13 - Roaming not allowed in this Location Area
565     * 15 - No Suitable Cells in this Location Area
566     * 17 - Network Failure
567     * 20 - MAC Failure
568     * 21 - Sync Failure
569     * 22 - Congestion
570     * 23 - GSM Authentication unacceptable
571     * 25 - Not Authorized for this CSG
572     * 32 - Service option not supported
573     * 33 - Requested service option not subscribed
574     * 34 - Service option temporarily out of order
575     * 38 - Call cannot be identified
576     * 48-63 - Retry upon entry into a new cell
577     * 95 - Semantically incorrect message
578     * 96 - Invalid mandatory information
579     * 97 - Message type non-existent or not implemented
580     * 98 - Message type not compatible with protocol state
581     * 99 - Information element non-existent or not implemented
582     * 100 - Conditional IE error
583     * 101 - Message not compatible with protocol state
584     * 111 - Protocol error, unspecified
585     */
586    int32_t reasonForDenial;
587
588    CellIdentity cellIdentity;
589};
590
591struct DataRegStateResult {
592    /**
593     * Valid reg states are NOT_REG_MT_NOT_SEARCHING_OP,
594     * REG_HOME, NOT_REG_MT_SEARCHING_OP, REG_DENIED,
595     * UNKNOWN, REG_ROAMING defined in RegState
596     */
597    RegState regState;
598    /**
599     * Indicates the available data radio technology,
600     * valid values as defined by RadioTechnology.
601     */
602    int32_t rat;
603    /**
604     * If registration state is 3 (Registration
605     * denied) this is an enumerated reason why
606     * registration was denied. See 3GPP TS 24.008,
607     * Annex G.6 "Additional cause codes for GMM".
608     * 7 == GPRS services not allowed
609     * 8 == GPRS services and non-GPRS services not allowed
610     * 9 == MS identity cannot be derived by the network
611     * 10 == Implicitly detached
612     * 14 == GPRS services not allowed in this PLMN
613     * 16 == MSC temporarily not reachable
614     * 40 == No PDP context activated
615     */
616    int32_t reasonDataDenied;
617    /**
618     * The maximum number of simultaneous Data Calls must be established using setupDataCall().
619     */
620    int32_t maxDataCalls;
621    CellIdentity cellIdentity;
622};
623