Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -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.hidl.manager@1.0; |
| 18 | |
Steven Moreland | 40ede2c | 2016-11-09 13:51:53 -0800 | [diff] [blame^] | 19 | import IServiceNotification; |
| 20 | |
Steven Moreland | f1d03c7 | 2016-11-08 16:00:45 -0800 | [diff] [blame] | 21 | /** |
| 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 Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 37 | interface IServiceManager { |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
Steven Moreland | 40ede2c | 2016-11-09 13:51:53 -0800 | [diff] [blame^] | 40 | * Retrieve an existing service that supports the requested version. |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 41 | * |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 42 | * 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 Moreland | f1d03c7 | 2016-11-08 16:00:45 -0800 | [diff] [blame] | 46 | * @param name Instance name. Same as in IServiceManager::add. |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 47 | * |
| 48 | * @return service Handle to requested service, same as provided in |
Steven Moreland | 40ede2c | 2016-11-09 13:51:53 -0800 | [diff] [blame^] | 49 | * IServiceManager::add. Will be nullptr if not available. |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 50 | */ |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 51 | get(string fqName, string name) generates (interface service); |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
Steven Moreland | 40ede2c | 2016-11-09 13:51:53 -0800 | [diff] [blame^] | 54 | * Register a service. The service manager must be registered as all of the |
| 55 | * services that it inherits from. |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 56 | * |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 57 | * WARNING: This function is for libhidl/HwBinder use only. You are likely |
| 58 | * looking for 'INTERFACE::registerAsService("name")' instead. |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 59 | * |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 60 | * @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 Moreland | f1d03c7 | 2016-11-08 16:00:45 -0800 | [diff] [blame] | 63 | * @param name Instance name. Must also be used to retrieve service. |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 64 | * @param service Handle to registering service. |
| 65 | * |
| 66 | * @return success Whether or not the service was registered. |
| 67 | * |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 68 | */ |
Steven Moreland | f0cc097 | 2016-11-02 17:51:46 -0700 | [diff] [blame] | 69 | add(vec<string> interfaceChain, string name, interface service) |
| 70 | generates (bool success); |
Steven Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 71 | |
Steven Moreland | f1d03c7 | 2016-11-08 16:00:45 -0800 | [diff] [blame] | 72 | /** |
| 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 Moreland | 40ede2c | 2016-11-09 13:51:53 -0800 | [diff] [blame^] | 88 | /** |
| 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 Moreland | 5d5ef7f | 2016-10-20 19:19:55 -0700 | [diff] [blame] | 108 | }; |