xref: /aosp_15_r20/system/chre/chre_api/include/chre_api/chre/wwan.h (revision 84e339476a462649f82315436d70fd732297a399)
1 /*
2  * Copyright (C) 2016 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 // IWYU pragma: private, include "chre_api/chre.h"
18 // IWYU pragma: friend chre/.*\.h
19 
20 #ifndef _CHRE_WWAN_H_
21 #define _CHRE_WWAN_H_
22 
23 /**
24  * @file
25  * Wireless Wide Area Network (WWAN, i.e. mobile/cellular network) API relevant
26  * for querying cell tower identity and associated information that can be
27  * useful in determining location.
28  *
29  * Based on Android N RIL definitions (located at this path as of the time of
30  * this comment: hardware/ril/include/telephony/ril.h), version 12. Updated
31  * based on Android radio HAL definition (hardware/interfaces/radio) for more
32  * recent Android builds. Refer to those files and associated documentation for
33  * further details.
34  *
35  * In general, the parts of this API that are taken from the RIL follow the
36  * field naming conventions established in that interface rather than the CHRE
37  * API conventions, in order to avoid confusion and enable code re-use where
38  * applicable. Note that structure names include the chreWwan* prefix rather
39  * than RIL_*, but field names are the same. If necessary to enable code
40  * sharing, it is recommended to create typedefs that map from the CHRE
41  * structures to the associated RIL type names, for example "typedef struct
42  * chreWwanCellIdentityGsm RIL_CellIdentityGsm_v12", etc.
43  */
44 
45 #include <chre/common.h>
46 
47 #include <stdbool.h>
48 #include <stdint.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /**
55  * The set of flags returned by chreWwanGetCapabilities().
56  * @defgroup CHRE_WWAN_CAPABILITIES
57  * @{
58  */
59 
60 //! No WWAN APIs are supported
61 #define CHRE_WWAN_CAPABILITIES_NONE       (UINT32_C(0))
62 
63 //! Current cell information can be queried via chreWwanGetCellInfoAsync()
64 #define CHRE_WWAN_GET_CELL_INFO           (UINT32_C(1) << 0)
65 
66 //! The chreWwanCellInfoResult from chreWwanGetCellInfoAsync() will include
67 //! all available chreWwanCellInfo as entries in cells, not just a single
68 //! primary result.
69 //! @since v1.11 - Neighbor support in prior versions of the API is unspecified.
70 #define CHRE_WWAN_GET_CELL_NEIGHBOR_INFO  (UINT32_C(1) << 1)
71 
72 /** @} */
73 
74 /**
75  * Produce an event ID in the block of IDs reserved for WWAN
76  * @param offset  Index into WWAN event ID block; valid range [0,15]
77  */
78 #define CHRE_WWAN_EVENT_ID(offset)  (CHRE_EVENT_WWAN_FIRST_EVENT + (offset))
79 
80 /**
81  * nanoappHandleEvent argument: struct chreWwanCellInfoResult
82  *
83  * Provides the result of an asynchronous request for cell info sent via
84  * chreWwanGetCellInfoAsync().
85  */
86 #define CHRE_EVENT_WWAN_CELL_INFO_RESULT  CHRE_WWAN_EVENT_ID(0)
87 
88 // NOTE: Do not add new events with ID > 15; only values 0-15 are reserved
89 // (see chre/event.h)
90 
91 /**
92  * The current version of struct chreWwanCellInfoResult associated with this
93  * API definition.
94  */
95 #define CHRE_WWAN_CELL_INFO_RESULT_VERSION  UINT8_C(1)
96 
97 //! Reference: RIL_CellIdentityGsm_v12
98 struct chreWwanCellIdentityGsm {
99     //! 3-digit Mobile Country Code, 0..999, INT32_MAX if unknown
100     int32_t mcc;
101 
102     //! 2 or 3-digit Mobile Network Code, 0..999, INT32_MAX if unknown
103     int32_t mnc;
104 
105     //! 16-bit Location Area Code, 0..65535, INT32_MAX if unknown
106     int32_t lac;
107 
108     //! 16-bit GSM Cell Identity described in TS 27.007, 0..65535,
109     //! INT32_MAX if unknown
110     int32_t cid;
111 
112     //! 16-bit GSM Absolute RF channel number, INT32_MAX if unknown
113     int32_t arfcn;
114 
115     //! 6-bit Base Station Identity Code, UINT8_MAX if unknown
116     uint8_t bsic;
117 
118     //! Reserved for future use; must be set to 0
119     uint8_t reserved[3];
120 };
121 
122 //! Reference: RIL_CellIdentityWcdma_v12
123 struct chreWwanCellIdentityWcdma {
124     //! 3-digit Mobile Country Code, 0..999, INT32_MAX if unknown
125     int32_t mcc;
126 
127     //! 2 or 3-digit Mobile Network Code, 0..999, INT32_MAX if unknown
128     int32_t mnc;
129 
130     //! 16-bit Location Area Code, 0..65535, INT32_MAX if unknown
131     int32_t lac;
132 
133     //! 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455,
134     //! INT32_MAX if unknown
135     int32_t cid;
136 
137     //! 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511,
138     //! INT32_MAX if unknown
139     int32_t psc;
140 
141     //! 16-bit UMTS Absolute RF Channel Number, INT32_MAX if unknown
142     int32_t uarfcn;
143 };
144 
145 //! Reference: RIL_CellIdentityCdma
146 struct chreWwanCellIdentityCdma {
147     //! Network Id 0..65535, INT32_MAX if unknown
148     int32_t networkId;
149 
150     //! CDMA System Id 0..32767, INT32_MAX if unknown
151     int32_t systemId;
152 
153     //! Base Station Id 0..65535, INT32_MAX if unknown
154     int32_t basestationId;
155 
156     //! Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
157     //! It is represented in units of 0.25 seconds and ranges from -2592000
158     //! to 2592000, both values inclusive (corresponding to a range of -180
159     //! to +180 degrees). INT32_MAX if unknown
160     int32_t longitude;
161 
162     //! Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
163     //! It is represented in units of 0.25 seconds and ranges from -1296000
164     //! to 1296000, both values inclusive (corresponding to a range of -90
165     //! to +90 degrees). INT32_MAX if unknown
166     int32_t latitude;
167 };
168 
169 //! Reference: RIL_CellIdentityLte_v12
170 struct chreWwanCellIdentityLte {
171     //! 3-digit Mobile Country Code, 0..999, INT32_MAX if unknown
172     int32_t mcc;
173 
174     //! 2 or 3-digit Mobile Network Code, 0..999, INT32_MAX if unknown
175     int32_t mnc;
176 
177     //! 28-bit Cell Identity described in TS ???, INT32_MAX if unknown
178     int32_t ci;
179 
180     //! physical cell id 0..503, INT32_MAX if unknown
181     int32_t pci;
182 
183     //! 16-bit tracking area code, INT32_MAX if unknown
184     int32_t tac;
185 
186     //! 18-bit LTE Absolute RF Channel Number, INT32_MAX if unknown
187     int32_t earfcn;
188 };
189 
190 //! Reference: RIL_CellIdentityTdscdma
191 struct chreWwanCellIdentityTdscdma {
192     //! 3-digit Mobile Country Code, 0..999, INT32_MAX if unknown
193     int32_t mcc;
194 
195     //! 2 or 3-digit Mobile Network Code, 0..999, INT32_MAX if unknown
196     int32_t mnc;
197 
198     //! 16-bit Location Area Code, 0..65535, INT32_MAX if unknown
199     int32_t lac;
200 
201     //! 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455,
202     //! INT32_MAX if unknown
203     int32_t cid;
204 
205     //! 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT32_MAX if
206     //! unknown
207     int32_t cpid;
208 };
209 
210 //! Reference: [email protected] CellIdentityNr
211 //! @since v1.4
212 struct chreWwanCellIdentityNr {
213     //! 3-digit Mobile Country Code, in range [0, 999]. This value must be valid
214     //! for registered or camped cells. INT32_MAX means invalid/unreported.
215     int32_t mcc;
216 
217     //! 2 or 3-digit Mobile Network Code, in range [0, 999]. This value must be
218     //! valid for registered or camped cells. INT32_MAX means
219     //! invalid/unreported.
220     int32_t mnc;
221 
222     //! NR Cell Identity in range [0, 68719476735] (36 bits), which
223     //! unambiguously identifies a cell within a public land mobile network
224     //! (PLMN). This value must be valid for registered or camped cells.
225     //! Reference: TS 38.413 section 9.3.1.7.
226     //!
227     //! Note: for backward compatibility reasons, the nominally int64_t nci is
228     //! split into two uint32_t values, with nci0 being the least significant 4
229     //! bytes. If chreWwanUnpackNrNci returns INT64_MAX, it means nci is
230     //! invalid/unreported.
231     //!
232     //! Users are recommended to use the helper accessor chreWwanUnpackNrNci to
233     //! access the nci field.
234     //!
235     //! @see chreWwanUnpackNrNci
236     uint32_t nci0;
237     uint32_t nci1;
238 
239     //! Physical cell id in range [0, 1007]. This value must be valid.
240     //! Reference: TS 38.331 section 6.3.2.
241     int32_t pci;
242 
243     //! 24-bit tracking area code in range [0, 16777215]. INT32_MAX means
244     //! invalid/unreported.
245     //! Reference: TS 38.413 section 9.3.3.10 and TS 29.571 section 5.4.2.
246     int32_t tac;
247 
248     //! NR Absolute Radio Frequency Channel Number, in range [0, 3279165]. This
249     //! value must be valid.
250     //! Reference: TS 38.101-1 section 5.4.2.1 and TS 38.101-2 section 5.4.2.1.
251     int32_t nrarfcn;
252 };
253 
254 //! Reference: RIL_GSM_SignalStrength_v12
255 struct chreWwanSignalStrengthGsm {
256     //! Valid values are (0-31, 99) as defined in TS 27.007 8.5
257     //! INT32_MAX means invalid/unreported.
258     int32_t signalStrength;
259 
260     //! bit error rate (0-7, 99) as defined in TS 27.007 8.5
261     //! INT32_MAX means invalid/unreported.
262     int32_t bitErrorRate;
263 
264     //! Timing Advance in bit periods. 1 bit period = 48.13 us.
265     //! INT32_MAX means invalid/unreported.
266     int32_t timingAdvance;
267 };
268 
269 //! Reference: RIL_SignalStrengthWcdma
270 struct chreWwanSignalStrengthWcdma {
271     //! Valid values are (0-31, 99) as defined in TS 27.007 8.5
272     //! INT32_MAX means invalid/unreported.
273     int32_t signalStrength;
274 
275     //! bit error rate (0-7, 99) as defined in TS 27.007 8.5
276     //! INT32_MAX means invalid/unreported.
277     int32_t bitErrorRate;
278 };
279 
280 //! Reference: RIL_CDMA_SignalStrength
281 struct chreWwanSignalStrengthCdma {
282     //! Valid values are positive integers.  This value is the actual RSSI value
283     //! multiplied by -1.  Example: If the actual RSSI is -75, then this
284     //! response value will be 75.
285     //! INT32_MAX means invalid/unreported.
286     int32_t dbm;
287 
288     //! Valid values are positive integers.  This value is the actual Ec/Io
289     //! multiplied by -10.  Example: If the actual Ec/Io is -12.5 dB, then this
290     //! response value will be 125.
291     //! INT32_MAX means invalid/unreported.
292     int32_t ecio;
293 };
294 
295 //! Reference: RIL_EVDO_SignalStrength
296 struct chreWwanSignalStrengthEvdo {
297     //! Valid values are positive integers.  This value is the actual RSSI value
298     //! multiplied by -1.  Example: If the actual RSSI is -75, then this
299     //! response value will be 75.
300     //! INT32_MAX means invalid/unreported.
301     int32_t dbm;
302 
303     //! Valid values are positive integers.  This value is the actual Ec/Io
304     //! multiplied by -10.  Example: If the actual Ec/Io is -12.5 dB, then this
305     //! response value will be 125.
306     //! INT32_MAX means invalid/unreported.
307     int32_t ecio;
308 
309     //! Valid values are 0-8.  8 is the highest signal to noise ratio.
310     //! INT32_MAX means invalid/unreported.
311     int32_t signalNoiseRatio;
312 };
313 
314 //! Reference: RIL_LTE_SignalStrength_v8
315 struct chreWwanSignalStrengthLte {
316     //! Valid values are (0-31, 99) as defined in TS 27.007 8.5
317     int32_t signalStrength;
318 
319     //! The current Reference Signal Receive Power in dBm multiplied by -1.
320     //! Range: 44 to 140 dBm
321     //! INT32_MAX means invalid/unreported.
322     //! Reference: 3GPP TS 36.133 9.1.4
323     int32_t rsrp;
324 
325     //! The current Reference Signal Receive Quality in dB multiplied by -1.
326     //! Range: 3 to 20 dB.
327     //! INT32_MAX means invalid/unreported.
328     //! Reference: 3GPP TS 36.133 9.1.7
329     int32_t rsrq;
330 
331     //! The current reference signal signal-to-noise ratio in 0.1 dB units.
332     //! Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
333     //! INT32_MAX means invalid/unreported.
334     //! Reference: 3GPP TS 36.101 8.1.1
335     int32_t rssnr;
336 
337     //! The current Channel Quality Indicator.
338     //! Range: 0 to 15.
339     //! INT32_MAX means invalid/unreported.
340     //! Reference: 3GPP TS 36.101 9.2, 9.3, A.4
341     int32_t cqi;
342 
343     //! timing advance in micro seconds for a one way trip from cell to device.
344     //! Approximate distance can be calculated using 300m/us * timingAdvance.
345     //! Range: 0 to 0x7FFFFFFE
346     //! INT32_MAX means invalid/unreported.
347     //! Reference: 3GPP 36.321 section 6.1.3.5
348     //! also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html
349     int32_t timingAdvance;
350 };
351 
352 //! Reference: RIL_TD_SCDMA_SignalStrength
353 struct chreWwanSignalStrengthTdscdma {
354     //! The Received Signal Code Power in dBm multiplied by -1.
355     //! Range : 25 to 120
356     //! INT32_MAX means invalid/unreported.
357     //! Reference: 3GPP TS 25.123, section 9.1.1.1
358     int32_t rscp;
359 };
360 
361 //! Reference: [email protected] NrSignalStrength
362 //! @since v1.4
363 struct chreWwanSignalStrengthNr {
364     //! SS (second synchronization) reference signal received power in dBm
365     //! multiplied by -1.
366     //! Range [44, 140], INT32_MAX means invalid/unreported.
367     //! Reference: TS 38.215 section 5.1.1 and TS 38.133 section 10.1.6.
368     int32_t ssRsrp;
369 
370     //! SS reference signal received quality in 0.5 dB units.
371     //! Range [-86, 41] with -86 = -43.0 dB and 41 = 20.5 dB.
372     //! INT32_MAX means invalid/unreported.
373     //! Reference: TS 38.215 section 5.1.3 and TS 38.133 section 10.1.11.1.
374     int32_t ssRsrq;
375 
376     //! SS signal-to-noise and interference ratio in 0.5 dB units.
377     //! Range [-46, 81] with -46 = -23.0 dB and 81 = 40.5 dB.
378     //! INT32_MAX means invalid/unreported.
379     //! Reference: TS 38.215 section 5.1.5 and TS 38.133 section 10.1.16.1.
380     int32_t ssSinr;
381 
382     //! CSI reference signal received power in dBm multiplied by -1.
383     //! Range [44, 140], INT32_MAX means invalid/unreported.
384     //! Reference: TS 38.215 section 5.1.2 and TS 38.133 section 10.1.6.
385     int32_t csiRsrp;
386 
387     //! CSI reference signal received quality in 0.5 dB units.
388     //! Range [-86, 41] with -86 = -43.0 dB and 41 = 20.5 dB.
389     //! INT32_MAX means invalid/unreported.
390     //! Reference: TS 38.215 section 5.1.4 and TS 38.133 section 10.1.11.1.
391     int32_t csiRsrq;
392 
393     //! CSI signal-to-noise and interference ratio in 0.5 dB units.
394     //! Range [-46, 81] with -46 = -23.0 dB and 81 = 40.5 dB.
395     //! INT32_MAX means invalid/unreported.
396     //! Reference: TS 38.215 section 5.1.6 and TS 38.133 section 10.1.16.1.
397     int32_t csiSinr;
398 };
399 
400 //! Reference: RIL_CellInfoGsm_v12
401 struct chreWwanCellInfoGsm {
402     struct chreWwanCellIdentityGsm    cellIdentityGsm;
403     struct chreWwanSignalStrengthGsm  signalStrengthGsm;
404 };
405 
406 //! Reference: RIL_CellInfoWcdma_v12
407 struct chreWwanCellInfoWcdma {
408     struct chreWwanCellIdentityWcdma    cellIdentityWcdma;
409     struct chreWwanSignalStrengthWcdma  signalStrengthWcdma;
410 };
411 
412 //! Reference: RIL_CellInfoCdma
413 struct chreWwanCellInfoCdma {
414     struct chreWwanCellIdentityCdma    cellIdentityCdma;
415     struct chreWwanSignalStrengthCdma  signalStrengthCdma;
416     struct chreWwanSignalStrengthEvdo  signalStrengthEvdo;
417 };
418 
419 //! Reference: RIL_CellInfoLte_v12
420 struct chreWwanCellInfoLte {
421     struct chreWwanCellIdentityLte    cellIdentityLte;
422     struct chreWwanSignalStrengthLte  signalStrengthLte;
423 };
424 
425 //! Reference: RIL_CellInfoTdscdma
426 struct chreWwanCellInfoTdscdma {
427     struct chreWwanCellIdentityTdscdma    cellIdentityTdscdma;
428     struct chreWwanSignalStrengthTdscdma  signalStrengthTdscdma;
429 };
430 
431 //! Reference: [email protected] CellInfoNr
432 //! @since v1.4
433 struct chreWwanCellInfoNr {
434     struct chreWwanCellIdentityNr    cellIdentityNr;
435     struct chreWwanSignalStrengthNr  signalStrengthNr;
436 };
437 
438 //! Reference: RIL_CellInfoType
439 //! All other values are reserved and should be ignored by nanoapps.
440 enum chreWwanCellInfoType {
441     CHRE_WWAN_CELL_INFO_TYPE_GSM      = 1,
442     CHRE_WWAN_CELL_INFO_TYPE_CDMA     = 2,
443     CHRE_WWAN_CELL_INFO_TYPE_LTE      = 3,
444     CHRE_WWAN_CELL_INFO_TYPE_WCDMA    = 4,
445     CHRE_WWAN_CELL_INFO_TYPE_TD_SCDMA = 5,
446     CHRE_WWAN_CELL_INFO_TYPE_NR       = 6,  //! @since v1.4
447 };
448 
449 //! Reference: RIL_TimeStampType
450 enum chreWwanCellTimeStampType {
451     CHRE_WWAN_CELL_TIMESTAMP_TYPE_UNKNOWN  = 0,
452     CHRE_WWAN_CELL_TIMESTAMP_TYPE_ANTENNA  = 1,
453     CHRE_WWAN_CELL_TIMESTAMP_TYPE_MODEM    = 2,
454     CHRE_WWAN_CELL_TIMESTAMP_TYPE_OEM_RIL  = 3,
455     CHRE_WWAN_CELL_TIMESTAMP_TYPE_JAVA_RIL = 4,
456 };
457 
458 //! Reference: RIL_CellInfo_v12
459 struct chreWwanCellInfo {
460     //! Timestamp in nanoseconds; must be in the same time base as chreGetTime()
461     uint64_t timeStamp;
462 
463     //! A value from enum {@link #CellInfoType} indicating the radio access
464     //! technology of the cell, and which field in union CellInfo can be used
465     //! to retrieve additional information
466     uint8_t cellInfoType;
467 
468     //! A value from enum {@link #CellTimeStampType} that identifies the source
469     //! of the value in timeStamp. This is typically set to
470     //! CHRE_WWAN_CELL_TIMESTAMP_TYPE_OEM_RIL, and indicates the time given by
471     //! chreGetTime() that an intermediate module received the data from the
472     //! modem and forwarded it to the requesting CHRE client.
473     uint8_t timeStampType;
474 
475     //! !0 if this cell is registered, 0 if not registered
476     uint8_t registered;
477 
478     //! Reserved for future use; must be set to 0
479     uint8_t reserved;
480 
481     //! The value in cellInfoType indicates which field in this union is valid
482     union chreWwanCellInfoPerRat {
483         struct chreWwanCellInfoGsm     gsm;
484         struct chreWwanCellInfoCdma    cdma;
485         struct chreWwanCellInfoLte     lte;
486         struct chreWwanCellInfoWcdma   wcdma;
487         struct chreWwanCellInfoTdscdma tdscdma;
488         struct chreWwanCellInfoNr      nr;  //! @since v1.4
489     } CellInfo;
490 };
491 
492 /**
493  * Data structure provided with events of type CHRE_EVENT_WWAN_CELL_INFO_RESULT.
494  */
495 struct chreWwanCellInfoResult {
496     //! Indicates the version of the structure, for compatibility purposes.
497     //! Clients do not normally need to worry about this field; the CHRE
498     //! implementation guarantees that the client only receives the structure
499     //! version it expects.
500     uint8_t version;
501 
502     //! Populated with a value from enum {@link #chreError}, indicating whether
503     //! the request failed, and if so, provides the cause of the failure
504     uint8_t errorCode;
505 
506     //! The number of valid entries in cells[]
507     uint8_t cellInfoCount;
508 
509     //! Reserved for future use; must be set to 0
510     uint8_t reserved;
511 
512     //! Set to the cookie parameter given to chreWwanGetCellInfoAsync()
513     const void *cookie;
514 
515     //! Pointer to an array of cellInfoCount elements containing information
516     //! about serving and neighbor cells
517     const struct chreWwanCellInfo *cells;
518 };
519 
520 
521 /**
522  * Retrieves a set of flags indicating the WWAN features supported by the
523  * current CHRE implementation. The value returned by this function must be
524  * consistent for the entire duration of the Nanoapp's execution.
525  *
526  * The client must allow for more flags to be set in this response than it knows
527  * about, for example if the implementation supports a newer version of the API
528  * than the client was compiled against.
529  *
530  * @return A bitmask with zero or more CHRE_WWAN_CAPABILITIES_* flags set
531  *
532  * @since v1.1
533  */
534 uint32_t chreWwanGetCapabilities(void);
535 
536 /**
537  * Nanoapps must define CHRE_NANOAPP_USES_WWAN somewhere in their build
538  * system (e.g. Makefile) if the nanoapp needs to use the following WWAN APIs.
539  * In addition to allowing access to these APIs, defining this macro will also
540  * ensure CHRE enforces that all host clients this nanoapp talks to have the
541  * required Android permissions needed to listen to WWAN data by adding metadata
542  * to the nanoapp.
543  */
544 #if defined(CHRE_NANOAPP_USES_WWAN) || !defined(CHRE_IS_NANOAPP_BUILD)
545 
546 /**
547  * Query information about the current serving cell and its neighbors. This does
548  * not perform a network scan, but should return state from the current network
549  * registration data stored in the cellular modem. This is effectively the same
550  * as a request for RIL_REQUEST_GET_CELL_INFO_LIST in the RIL.
551  *
552  * The requested cellular information is returned asynchronously via
553  * CHRE_EVENT_WWAN_CELL_INFO_RESULT. The implementation must send this event,
554  * either with successful data or an error status, within
555  * CHRE_ASYNC_RESULT_TIMEOUT_NS.
556  *
557  * If the airplane mode setting is enabled at the Android level, the CHRE
558  * implementation is expected to return a successful asynchronous result with an
559  * empty cell info list.
560  *
561  * @param cookie An opaque value that will be included in the
562  *               chreWwanCellInfoResult sent in relation to this request.
563  *
564  * @return true if the request was accepted for processing, false otherwise
565  *
566  * @since v1.1
567  * @note Requires WWAN permission
568  */
569 bool chreWwanGetCellInfoAsync(const void *cookie);
570 
571 /**
572  * Helper accessor for nci in the chreWwanCellIdentityNr struct.
573  *
574  * @return nci or INT64_MAX if invalid/unreported.
575  *
576  * @see chreWwanCellIdentityNr
577  *
578  * @since v1.4
579  * @note Requires WWAN permission
580  */
chreWwanUnpackNrNci(const struct chreWwanCellIdentityNr * nrCellId)581 static inline int64_t chreWwanUnpackNrNci(
582     const struct chreWwanCellIdentityNr *nrCellId) {
583   return (int64_t) (((uint64_t) nrCellId->nci1 << 32) | nrCellId->nci0);
584 }
585 
586 #else  /* defined(CHRE_NANOAPP_USES_WWAN) || !defined(CHRE_IS_NANOAPP_BUILD) */
587 #define CHRE_WWAN_PERM_ERROR_STRING \
588     "CHRE_NANOAPP_USES_WWAN must be defined when building this nanoapp in " \
589     "order to refer to "
590 #define chreWwanGetCellInfoAsync(...) \
591     CHRE_BUILD_ERROR(CHRE_WWAN_PERM_ERROR_STRING "chreWwanGetCellInfoAsync")
592 #define chreWwanUnpackNrNci(...) \
593     CHRE_BUILD_ERROR(CHRE_WWAN_PERM_ERROR_STRING "chreWwanUnpackNrNci")
594 #endif  /* defined(CHRE_NANOAPP_USES_WWAN) || !defined(CHRE_IS_NANOAPP_BUILD) */
595 
596 #ifdef __cplusplus
597 }
598 #endif
599 
600 #endif  /* _CHRE_WWAN_H_ */
601