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
17package android.hardware.wifi.offload@1.0;
18
19import IOffloadCallback;
20
21interface IOffload {
22    /**
23     * Configure the offload module to perform scans and filter results
24     * Scans must not be triggered due to configuration of the module.
25     *
26     * @param ScanParam paramters for scanning
27     * @param ScanFilter settings to filter scan result
28     * @return OffloadStatus indicating status of operation provided by this API
29     * If OffloadStatusCode::OK is returned, the operation was successful
30     * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost
31     * If OffloadStatusCode::ERROR is returned, requested operation could not be completed
32     */
33    @entry
34    @callflow(next={"setEventCallback", "subscribeScanResults"})
35    configureScans(ScanParam param, ScanFilter filter) generates (OffloadStatus status);
36
37    /**
38     * Get scan statistics
39     *
40     * @return OffloadStatus indicating status of operation provided by this API
41     * @return ScanStats statistics of scans performed
42     * If OffloadStatusCode::OK is returned, the operation was successful
43     * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost
44     * If OffloadStatusCode::ERROR is returned, requested operation could not be completed
45     * If OffloadStatusCode::TIMEOUT is returned, time out waiting for the requested data
46     */
47    @exit
48    @callflow(next={"subscribeScanResults", "unsubscribeScanResults", "getScanStats"})
49    getScanStats() generates (OffloadStatus status, ScanStats scanStats);
50
51    /**
52     * Subscribe to asynchronous scan events sent by offload module. This enables
53     * offload scans to be performed as per scan parameters, filtering the scan
54     * results based on configured scan filter and delivering the results after
55     * at least delayMs milliseconds from this call. If the client is already
56     * subscribed to the scan results, a call to this API must be a no-op.
57     *
58     * @param delayMs an integer expressing the minimum delay in mS after
59     *        subscribing when scan results must be delivered to the client
60     * @return OffloadStatus indicating status of operation provided by this API
61     * If OffloadStatusCode::OK is returned, the operation was successful
62     * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost
63     * If OffloadStatusCode::ERROR is returned, requested operation could not be completed
64     */
65    @callflow(next={"unsubscribeScanResults", "getScanStats"})
66    subscribeScanResults(uint32_t delayMs) generates (OffloadStatus status);
67
68    /**
69     * Unsubscribe to scan events sent by the offload module, hence disabling scans.
70     * If the client is already unsubscribed, a call to this API will be a no-op.
71     */
72    @exit
73    @callflow(next={"*"})
74    unsubscribeScanResults();
75
76    /**
77     * Setup the HIDL interface for reporting asynchronous scan events. A maximum
78     * of one callback interface is supported. Only one callback must be registered
79     * at any given time. If two consecutive calls are made with different callback
80     * interface objects, the latest one must be used to deliver events to client.
81     *
82     * @param cb An instance of the |IOffloadCallback| HIDL interface object
83     */
84    @entry
85    @callflow(next={"subscribeScanStats", "configureScans"})
86    setEventCallback(IOffloadCallback cb);
87};
88