Home | History | Annotate | Download | only in 1.0
      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 package android.hardware.gnss@1.0;
     18 
     19 /** GNSS Network Initiated callback interface. */
     20 interface IGnssNiCallback {
     21     /**
     22      * GnssNiType constants
     23      */
     24     @export(name="", value_prefix="GPS_NI_TYPE_")
     25     enum GnssNiType : uint8_t {
     26         VOICE           = 1,
     27         UMTS_SUPL       = 2,
     28         UMTS_CTRL_PLANE = 3,
     29         EMERGENCY_SUPL  = 4
     30     };
     31 
     32     /**
     33      * GnssNiNotifyFlags constants
     34      */
     35     @export(name="", value_prefix="GPS_NI_")
     36     enum GnssNiNotifyFlags : uint32_t {
     37         /** NI requires notification */
     38         NEED_NOTIFY      = 0x0001,
     39         /** NI requires verification */
     40         NEED_VERIFY      = 0x0002,
     41         /** NI requires privacy override, no notification/minimal trace */
     42         PRIVACY_OVERRIDE = 0x0004,
     43     };
     44 
     45     /**
     46      * GNSS NI responses, used to define the response in
     47      * NI structures
     48      */
     49     @export(name="", value_prefix="GPS_NI_")
     50     enum GnssUserResponseType : uint8_t {
     51         RESPONSE_ACCEPT  = 1,
     52         RESPONSE_DENY    = 2,
     53         RESPONSE_NORESP  = 3,
     54     };
     55 
     56     /**
     57      * NI data encoding scheme
     58      */
     59     @export(name="", value_prefix="GPS_")
     60     enum GnssNiEncodingType : int32_t {
     61         ENC_NONE              = 0,
     62         ENC_SUPL_GSM_DEFAULT  = 1,
     63         ENC_SUPL_UTF8         = 2,
     64         ENC_SUPL_UCS2         = 3,
     65         ENC_UNKNOWN           = -1,
     66     };
     67 
     68     /** Represents an NI request */
     69     struct GnssNiNotification{
     70         /**
     71          * An ID generated by HAL to associate NI notifications and UI
     72          * responses.
     73          */
     74         int32_t notificationId;
     75 
     76         /**
     77          * A type used to distinguish different categories of NI
     78          * events, such as VOICE, UMTS_SUPL etc.
     79          */
     80         GnssNiType niType;
     81 
     82         /**
     83          * Notification/verification options, combinations of GnssNiNotifyFlags
     84          * constants.
     85          */
     86         bitfield<GnssNiNotifyFlags> notifyFlags;
     87 
     88         /**
     89          * Timeout period to wait for user response.
     90          * Set to 0 for no timeout limit. Specified in seconds.
     91          */
     92         uint32_t timeoutSec;
     93 
     94         /**
     95          * Default response when timeout.
     96          */
     97         GnssUserResponseType defaultResponse;
     98 
     99         /**
    100          * String representing the requester of the network inititated location
    101          * request.
    102          */
    103         string requestorId;
    104 
    105         /**
    106          * Notification message. String representing the service(for eg. SUPL-service)
    107          * who sent the network initiated location request.
    108          */
    109         string notificationMessage;
    110 
    111         /**
    112          * requestorId decoding scheme.
    113          */
    114         GnssNiEncodingType requestorIdEncoding;
    115 
    116         /**
    117          * notificationId decoding scheme
    118          */
    119         GnssNiEncodingType notificationIdEncoding;
    120     };
    121 
    122     /**
    123      * Callback with a network initiated request.
    124      *
    125      * @param notification network initiated request.
    126      */
    127     niNotifyCb(GnssNiNotification notification);
    128 };
    129