blob: 1efaa28ec66f44beeb06ec3fb42ba362c81dfd96 [file] [log] [blame]
Steven Moreland5d5ef7f2016-10-20 19:19:55 -07001/*
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
17package android.hidl.manager@1.0;
18
Steven Moreland40ede2c2016-11-09 13:51:53 -080019import IServiceNotification;
20
Steven Morelandf1d03c72016-11-08 16:00:45 -080021/**
22 * Manages all the hidl hals on a device.
23 *
24 * All examples in this file assume that there is one service registered with
25 * the service manager, "android.hidl.manager@1.0::IServiceManager/manager"
26 *
27 * Terminology:
28 * Package: "android.hidl.manager"
29 * Major version: "1"
30 * Minor version: "0"
31 * Version: "1.0"
32 * Interface name: "IServiceManager"
33 * Fully-qualified interface name: "android.hidl.manager@1.0::IServiceManager"
34 * Instance name: "manager"
35 * Fully-qualified instance name: "android.hidl.manager@1.0::IServiceManager/manager"
36 */
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070037interface IServiceManager {
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070038
39 /**
Steven Moreland40ede2c2016-11-09 13:51:53 -080040 * Retrieve an existing service that supports the requested version.
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070041 *
Steven Morelandf0cc0972016-11-02 17:51:46 -070042 * WARNING: This function is for libhidl/HwBinder use only. You are likely
43 * looking for 'IMyInterface::getService("name")' instead.
44 *
45 * @param iface Fully-qualified interface name.
Steven Morelandf1d03c72016-11-08 16:00:45 -080046 * @param name Instance name. Same as in IServiceManager::add.
Steven Morelandf0cc0972016-11-02 17:51:46 -070047 *
48 * @return service Handle to requested service, same as provided in
Steven Moreland40ede2c2016-11-09 13:51:53 -080049 * IServiceManager::add. Will be nullptr if not available.
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070050 */
Steven Morelandf0cc0972016-11-02 17:51:46 -070051 get(string fqName, string name) generates (interface service);
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070052
53 /**
Steven Moreland40ede2c2016-11-09 13:51:53 -080054 * Register a service. The service manager must be registered as all of the
55 * services that it inherits from.
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070056 *
Steven Morelandf0cc0972016-11-02 17:51:46 -070057 * WARNING: This function is for libhidl/HwBinder use only. You are likely
58 * looking for 'INTERFACE::registerAsService("name")' instead.
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070059 *
Steven Morelandf0cc0972016-11-02 17:51:46 -070060 * @param interfaceChain List of fully-qualified interface names. The first
61 * must be the actual interface name. Subsequent names must
62 * follow the inheritance hierarchy of the interface.
Steven Morelandf1d03c72016-11-08 16:00:45 -080063 * @param name Instance name. Must also be used to retrieve service.
Steven Morelandf0cc0972016-11-02 17:51:46 -070064 * @param service Handle to registering service.
65 *
66 * @return success Whether or not the service was registered.
67 *
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070068 */
Steven Morelandf0cc0972016-11-02 17:51:46 -070069 add(vec<string> interfaceChain, string name, interface service)
70 generates (bool success);
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070071
Steven Morelandf1d03c72016-11-08 16:00:45 -080072 /**
73 * List all registered services.
74 *
75 * @return fqInstanceNames List of fully-qualified instance names.
76 */
77 list() generates (vec<string> fqInstanceNames);
78
79 /**
80 * List all instances of a particular service.
81 *
82 * @param fqName Fully-qualified interface name.
83 *
84 * @return instanceNames List of instance names running the particular service.
85 */
86 listByInterface(string fqName) generates (vec<string> instanceNames);
87
Steven Moreland40ede2c2016-11-09 13:51:53 -080088 /**
89 * Register for service notifications for a particular service. Must support
90 * multiple registrations.
91 *
92 * onRegistration must be sent out for all services which support the
93 * version provided in the fqName. For instance, if a client registers for
94 * notifications from "android.hardware.foo@1.0", they must also get
95 * notifications from "android.hardware.foo@1.1".
96 *
97 * @param fqName Fully-qualified interface name.
98 * @param name Instance name. If name is empty, notifications must be
99 * sent out for all names.
100 * @param callback Client callback to recieve notifications.
101 *
102 * @return success Whether or not registration was successful.
103 */
104 registerForNotifications(string fqName,
105 string name,
106 IServiceNotification callback)
107 generates (bool success);
Steven Moreland5d5ef7f2016-10-20 19:19:55 -0700108};