1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_BLUETOOTH_AUDIO_V2_1_IBLUETOOTHAUDIOPROVIDERSFACTORY_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_BLUETOOTH_AUDIO_V2_1_IBLUETOOTHAUDIOPROVIDERSFACTORY_H
3
4 #include <android/hardware/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.h>
5 #include <android/hardware/bluetooth/audio/2.0/types.h>
6 #include <android/hardware/bluetooth/audio/2.1/IBluetoothAudioProvider.h>
7 #include <android/hardware/bluetooth/audio/2.1/types.h>
8
9 #include <android/hidl/manager/1.0/IServiceNotification.h>
10
11 #include <hidl/HidlSupport.h>
12 #include <hidl/MQDescriptor.h>
13 #include <hidl/Status.h>
14 #include <utils/NativeHandle.h>
15 #include <utils/misc.h>
16
17 namespace android {
18 namespace hardware {
19 namespace bluetooth {
20 namespace audio {
21 namespace V2_1 {
22
23 /**
24 * This factory allows a HAL implementation to be split into multiple
25 * independent providers.
26 *
27 * When the Bluetooth stack is ready to create an audio session, it must first
28 * obtain the IBluetoothAudioProvider for that session type by calling
29 * openProvider().
30 *
31 * Note: For HIDL APIs with a "generates" statement, the callback parameter used
32 * for return value must be invoked synchronously before the API call returns.
33 */
34 struct IBluetoothAudioProvidersFactory : public ::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioProvidersFactory {
35 /**
36 * Type tag for use in template logic that indicates this is a 'pure' class.
37 */
38 typedef ::android::hardware::details::i_tag _hidl_tag;
39
40 /**
41 * Fully qualified interface name: "[email protected]::IBluetoothAudioProvidersFactory"
42 */
43 static const char* descriptor;
44
45 /**
46 * Returns whether this object's implementation is outside of the current process.
47 */
isRemoteIBluetoothAudioProvidersFactory48 virtual bool isRemote() const override { return false; }
49
50 /**
51 * Return callback for openProvider
52 */
53 using openProvider_cb = std::function<void(::android::hardware::bluetooth::audio::V2_0::Status status, const ::android::sp<::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioProvider>& provider)>;
54 /**
55 * Opens an audio provider for a session type. To close the provider, it is
56 * necessary to release references to the returned provider object.
57 *
58 * @param sessionType The session type (e.g.
59 * A2DP_SOFTWARE_ENCODING_DATAPATH).
60 *
61 * @return status One of the following
62 * SUCCESS if the Audio HAL successfully opens the provider with the
63 * given session type
64 * FAILURE if the Audio HAL cannot open the provider
65 * @return provider The provider of the specified session type
66 */
67 virtual ::android::hardware::Return<void> openProvider(::android::hardware::bluetooth::audio::V2_0::SessionType sessionType, openProvider_cb _hidl_cb) override = 0;
68
69 /**
70 * Return callback for getProviderCapabilities
71 */
72 using getProviderCapabilities_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::bluetooth::audio::V2_0::AudioCapabilities>& audioCapabilities)>;
73 /**
74 * Gets a list of audio capabilities for a session type.
75 *
76 * For software encoding, the PCM capabilities are returned.
77 * For hardware encoding, the supported codecs and their capabilities are
78 * returned.
79 *
80 * @param sessionType The session type (e.g.
81 * A2DP_SOFTWARE_ENCODING_DATAPATH).
82 * @return audioCapabilities A list containing all the capabilities
83 * supported by the sesson type. The capabilities is a list of
84 * available options when configuring the codec for the session.
85 * For software encoding it is the PCM data rate.
86 * For hardware encoding it is the list of supported codecs and their
87 * capabilities.
88 * If a provider isn't supported, an empty list should be returned.
89 * Note: Only one entry should exist per codec when using hardware
90 * encoding.
91 */
92 virtual ::android::hardware::Return<void> getProviderCapabilities(::android::hardware::bluetooth::audio::V2_0::SessionType sessionType, getProviderCapabilities_cb _hidl_cb) override = 0;
93
94 /**
95 * Return callback for openProvider_2_1
96 */
97 using openProvider_2_1_cb = std::function<void(::android::hardware::bluetooth::audio::V2_0::Status status, const ::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvider>& provider)>;
98 /**
99 * Opens an audio provider for a session type. To close the provider, it is
100 * necessary to release references to the returned provider object.
101 *
102 * @param sessionType The session type (e.g.
103 * LE_AUDIO_SOFTWARE_ENCODING_DATAPATH).
104 *
105 * @return status One of the following
106 * SUCCESS if the Audio HAL successfully opens the provider with the
107 * given session type
108 * FAILURE if the Audio HAL cannot open the provider
109 * @return provider The provider of the specified session type
110 */
111 virtual ::android::hardware::Return<void> openProvider_2_1(::android::hardware::bluetooth::audio::V2_1::SessionType sessionType, openProvider_2_1_cb _hidl_cb) = 0;
112
113 /**
114 * Return callback for getProviderCapabilities_2_1
115 */
116 using getProviderCapabilities_2_1_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::bluetooth::audio::V2_1::AudioCapabilities>& audioCapabilities)>;
117 /**
118 * Gets a list of audio capabilities for a session type.
119 *
120 * For software encoding, the PCM capabilities are returned.
121 * For hardware encoding, the supported codecs and their capabilities are
122 * returned.
123 *
124 * @param sessionType The session type (e.g.
125 * A2DP_SOFTWARE_ENCODING_DATAPATH).
126 * @return audioCapabilities A list containing all the capabilities
127 * supported by the sesson type. The capabilities is a list of
128 * available options when configuring the codec for the session.
129 * For software encoding it is the PCM data rate.
130 * For hardware encoding it is the list of supported codecs and their
131 * capabilities.
132 * If a provider isn't supported, an empty list should be returned.
133 * Note: Only one entry should exist per codec when using hardware
134 * encoding.
135 */
136 virtual ::android::hardware::Return<void> getProviderCapabilities_2_1(::android::hardware::bluetooth::audio::V2_1::SessionType sessionType, getProviderCapabilities_2_1_cb _hidl_cb) = 0;
137
138 /**
139 * Return callback for interfaceChain
140 */
141 using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
142 /*
143 * Provides run-time type information for this object.
144 * For example, for the following interface definition:
145 * package [email protected];
146 * interface IParent {};
147 * interface IChild extends IParent {};
148 * Calling interfaceChain on an IChild object must yield the following:
149 * ["[email protected]::IChild",
150 * "[email protected]::IParent"
151 * "[email protected]::IBase"]
152 *
153 * @return descriptors a vector of descriptors of the run-time type of the
154 * object.
155 */
156 virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
157
158 /*
159 * Emit diagnostic information to the given file.
160 *
161 * Optionally overriden.
162 *
163 * @param fd File descriptor to dump data to.
164 * Must only be used for the duration of this call.
165 * @param options Arguments for debugging.
166 * Must support empty for default debug information.
167 */
168 virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
169
170 /**
171 * Return callback for interfaceDescriptor
172 */
173 using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
174 /*
175 * Provides run-time type information for this object.
176 * For example, for the following interface definition:
177 * package [email protected];
178 * interface IParent {};
179 * interface IChild extends IParent {};
180 * Calling interfaceDescriptor on an IChild object must yield
181 * "[email protected]::IChild"
182 *
183 * @return descriptor a descriptor of the run-time type of the
184 * object (the first element of the vector returned by
185 * interfaceChain())
186 */
187 virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
188
189 /**
190 * Return callback for getHashChain
191 */
192 using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
193 /*
194 * Returns hashes of the source HAL files that define the interfaces of the
195 * runtime type information on the object.
196 * For example, for the following interface definition:
197 * package [email protected];
198 * interface IParent {};
199 * interface IChild extends IParent {};
200 * Calling interfaceChain on an IChild object must yield the following:
201 * [(hash of IChild.hal),
202 * (hash of IParent.hal)
203 * (hash of IBase.hal)].
204 *
205 * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
206 * according to SHA-256 standard.
207 *
208 * @return hashchain a vector of SHA-1 digests
209 */
210 virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
211
212 /*
213 * This method trigger the interface to enable/disable instrumentation based
214 * on system property hal.instrumentation.enable.
215 */
216 virtual ::android::hardware::Return<void> setHALInstrumentation() override;
217
218 /*
219 * Registers a death recipient, to be called when the process hosting this
220 * interface dies.
221 *
222 * @param recipient a hidl_death_recipient callback object
223 * @param cookie a cookie that must be returned with the callback
224 * @return success whether the death recipient was registered successfully.
225 */
226 virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
227
228 /*
229 * Provides way to determine if interface is running without requesting
230 * any functionality.
231 */
232 virtual ::android::hardware::Return<void> ping() override;
233
234 /**
235 * Return callback for getDebugInfo
236 */
237 using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
238 /*
239 * Get debug information on references on this interface.
240 * @return info debugging information. See comments of DebugInfo.
241 */
242 virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
243
244 /*
245 * This method notifies the interface that one or more system properties
246 * have changed. The default implementation calls
247 * (C++) report_sysprop_change() in libcutils or
248 * (Java) android.os.SystemProperties.reportSyspropChanged,
249 * which in turn calls a set of registered callbacks (eg to update trace
250 * tags).
251 */
252 virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
253
254 /*
255 * Unregisters the registered death recipient. If this service was registered
256 * multiple times with the same exact death recipient, this unlinks the most
257 * recently registered one.
258 *
259 * @param recipient a previously registered hidl_death_recipient callback
260 * @return success whether the death recipient was unregistered successfully.
261 */
262 virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
263
264 // cast static functions
265 /**
266 * This performs a checked cast based on what the underlying implementation actually is.
267 */
268 static ::android::hardware::Return<::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory>> castFrom(const ::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory>& parent, bool emitError = false);
269 /**
270 * This performs a checked cast based on what the underlying implementation actually is.
271 */
272 static ::android::hardware::Return<::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory>> castFrom(const ::android::sp<::android::hardware::bluetooth::audio::V2_0::IBluetoothAudioProvidersFactory>& parent, bool emitError = false);
273 /**
274 * This performs a checked cast based on what the underlying implementation actually is.
275 */
276 static ::android::hardware::Return<::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
277
278 // helper methods for interactions with the hwservicemanager
279 /**
280 * This gets the service of this type with the specified instance name. If the
281 * service is currently not available or not in the VINTF manifest on a Trebilized
282 * device, this will return nullptr. This is useful when you don't want to block
283 * during device boot. If getStub is true, this will try to return an unwrapped
284 * passthrough implementation in the same process. This is useful when getting an
285 * implementation from the same partition/compilation group.
286 *
287 * In general, prefer getService(std::string,bool)
288 */
289 static ::android::sp<IBluetoothAudioProvidersFactory> tryGetService(const std::string &serviceName="default", bool getStub=false);
290 /**
291 * Deprecated. See tryGetService(std::string, bool)
292 */
293 static ::android::sp<IBluetoothAudioProvidersFactory> tryGetService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return tryGetService(str, getStub); }
294 /**
295 * Deprecated. See tryGetService(std::string, bool)
296 */
297 static ::android::sp<IBluetoothAudioProvidersFactory> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return tryGetService(str, getStub); }
298 /**
299 * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
300 */
tryGetServiceIBluetoothAudioProvidersFactory301 static ::android::sp<IBluetoothAudioProvidersFactory> tryGetService(bool getStub) { return tryGetService("default", getStub); }
302 /**
303 * This gets the service of this type with the specified instance name. If the
304 * service is not in the VINTF manifest on a Trebilized device, this will return
305 * nullptr. If the service is not available, this will wait for the service to
306 * become available. If the service is a lazy service, this will start the service
307 * and return when it becomes available. If getStub is true, this will try to
308 * return an unwrapped passthrough implementation in the same process. This is
309 * useful when getting an implementation from the same partition/compilation group.
310 */
311 static ::android::sp<IBluetoothAudioProvidersFactory> getService(const std::string &serviceName="default", bool getStub=false);
312 /**
313 * Deprecated. See getService(std::string, bool)
314 */
315 static ::android::sp<IBluetoothAudioProvidersFactory> getService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return getService(str, getStub); }
316 /**
317 * Deprecated. See getService(std::string, bool)
318 */
319 static ::android::sp<IBluetoothAudioProvidersFactory> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return getService(str, getStub); }
320 /**
321 * Calls getService("default", bool). This is the recommended instance name for singleton services.
322 */
getServiceIBluetoothAudioProvidersFactory323 static ::android::sp<IBluetoothAudioProvidersFactory> getService(bool getStub) { return getService("default", getStub); }
324 /**
325 * Registers a service with the service manager. For Trebilized devices, the service
326 * must also be in the VINTF manifest.
327 */
328 __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
329 /**
330 * Registers for notifications for when a service is registered.
331 */
332 static bool registerForNotifications(
333 const std::string &serviceName,
334 const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> ¬ification);
335 };
336
337 //
338 // type declarations for package
339 //
340
341 static inline std::string toString(const ::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory>& o);
342
343 //
344 // type header definitions for package
345 //
346
toString(const::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory> & o)347 static inline std::string toString(const ::android::sp<::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory>& o) {
348 std::string os = "[class or subclass of ";
349 os += ::android::hardware::bluetooth::audio::V2_1::IBluetoothAudioProvidersFactory::descriptor;
350 os += "]";
351 os += o->isRemote() ? "@remote" : "@local";
352 return os;
353 }
354
355
356 } // namespace V2_1
357 } // namespace audio
358 } // namespace bluetooth
359 } // namespace hardware
360 } // namespace android
361
362 //
363 // global type declarations for package
364 //
365
366
367 #endif // HIDL_GENERATED_ANDROID_HARDWARE_BLUETOOTH_AUDIO_V2_1_IBLUETOOTHAUDIOPROVIDERSFACTORY_H
368