1/*
2 * Copyright (C) 2020 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.contexthub@1.2;
18
19import @1.0::ContextHub;
20import @1.0::Result;
21import @1.1::IContexthub;
22import @1.1::SettingValue;
23import IContexthubCallback;
24
25interface IContexthub extends @1.1::IContexthub {
26    /**
27     * Enumerate all available context hubs on the system.
28     *
29     * @return hubs                 list of hubs on this system.
30     * @return supportedPermissions list of Android permissions all hubs
31     *                              support for nanoapps to enforce host
32     *                              endpoints are granted in order to
33     *                              communicate with them.
34     */
35    getHubs_1_2() generates (vec<ContextHub> hubs, vec<string> supportedPermissions);
36
37    /**
38     * Register a callback for the HAL implementation to send asynchronous
39     * messages to the service from a context hub. There can be a maximum of
40     * one callback registered with the HAL. A call to this function when a
41     * callback has already been registered must override the previous
42     * registration.
43     *
44     * @param hubId    identifier for the hub
45     * @param callback an implementation of the IContextHubCallbacks
46     *
47     * @return result OK on success
48     *                BAD_VALUE if parameters are not valid
49     *
50     */
51    registerCallback_1_2(uint32_t hubId, IContexthubCallback cb) generates (Result result);
52
53    /**
54     * Notification sent by the framework to indicate that the user
55     * has changed a setting.
56     *
57     * @param setting User setting that has been modified.
58     * @param newValue The update value of the user setting.
59     */
60    onSettingChanged_1_2(Setting setting, @1.1::SettingValue newValue);
61};
62