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