Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 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.wifi@1.0; |
| 18 | |
| 19 | interface IWifiStaIfaceEventCallback { |
| 20 | /** |
| 21 | * Callback indicating that the requested packet filter was successfully |
| 22 | * installed. |
| 23 | */ |
| 24 | oneway onInstallPacketFilterSuccess(); |
| 25 | |
| 26 | /** |
| 27 | * Callback indicating that installing a packet filter failed. |
| 28 | */ |
| 29 | oneway onInstallPacketFilterFailure(FailureReason reason); |
| 30 | |
| 31 | /** |
| 32 | * Callback indicating that a requested background scan was started. |
| 33 | */ |
| 34 | oneway onBackgroundScanStarted(); |
| 35 | |
| 36 | /** |
| 37 | * Callback indicating that a requested background scan failed to start. |
| 38 | */ |
| 39 | oneway onBackgroundScanStartFailure(FailureReason reason); |
| 40 | |
| 41 | /** |
| 42 | * Callback indicating that a scan was stopped |
| 43 | */ |
| 44 | oneway onBackgroundScanStopped(); |
| 45 | |
| 46 | /** |
| 47 | * Information elements contained within the |ScanResult| structure. |
| 48 | * These elements correspond to the IEEE_802.11 standard. |
| 49 | */ |
| 50 | struct InformationElement { |
| 51 | uint8_t id; |
| 52 | vec<uint8_t> data; |
| 53 | }; |
| 54 | |
| 55 | /** |
| 56 | * BSSID type. 6 octets representing the physical address of an AP. |
| 57 | */ |
| 58 | typedef uint8_t[6] Bssid; |
| 59 | |
| 60 | /** |
| 61 | * Structure describing all the information about a single access point seen |
| 62 | * during the scan. |
| 63 | */ |
| 64 | struct ScanResult { |
| 65 | int64_t timeStampInUs; |
| 66 | vec<uint8_t> ssid; |
| 67 | Bssid bssid; |
| 68 | uint32_t frequencyInMhz; |
| 69 | int8_t rssi; |
| 70 | uint16_t beaconPeriodInMs; |
| 71 | uint16_t capability; |
| 72 | vec<InformationElement> informationElements; |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * Mask of flags set in the |ScanData| instance. |
| 77 | */ |
| 78 | enum ScanDataFlagMask { |
| 79 | /** |
| 80 | * Indicates that a scan was interrupted/did not occur so results may be |
| 81 | * incomplete. |
| 82 | */ |
| 83 | WIFI_SCAN_FLAG_INTERRUPTED = 1 << 0, |
| 84 | }; |
| 85 | |
| 86 | /** |
| 87 | * Structure describing all the information about all the access points seen during |
| 88 | * the scan. |
| 89 | */ |
| 90 | struct ScanData { |
| 91 | /** |
| 92 | * Bitset containing |ScanDataFlagMask| values. |
| 93 | */ |
| 94 | uint32_t flags; |
| 95 | /** |
| 96 | * Bitset where each bit indicates if the bucket with that index was |
| 97 | * scanned. |
| 98 | */ |
| 99 | uint32_t bucketsScanned; |
| 100 | /** |
| 101 | * List of scan results. |
| 102 | */ |
| 103 | vec<ScanResult> results; |
| 104 | }; |
| 105 | |
| 106 | /** |
| 107 | * Called for each received beacon/probe response for a scan with the |
| 108 | * |REPORT_EVENTS_FULL_RESULTS| flag set in |
| 109 | * |BackgroundScanBucketParameters.eventReportScheme|. |
| 110 | * |
| 111 | * @param cmdId command Id corresponding to the request. |
| 112 | * @parm result Full scan result for an AP. |
| 113 | */ |
| 114 | oneway onBackgroundFullScanResult(CommandId cmdId, ScanResult result); |
| 115 | |
| 116 | /** |
| 117 | * Called when the |BackgroundScanBucketParameters.eventReportScheme| flags |
| 118 | * for at least one bucket that was just scanned was |
| 119 | * |REPORT_EVENTS_EACH_SCAN| or one of the configured thresholds was |
| 120 | * breached. |
| 121 | * |
| 122 | * @param cmdId command Id corresponding to the request. |
| 123 | * @parm scanDatas List of scan result for all AP's seen since last callback. |
| 124 | */ |
| 125 | oneway onBackgroundScanResults(CommandId cmdId, vec<ScanData> scanDatas); |
| 126 | }; |