1/*
2 * Copyright (C) 2018 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.media.bufferpool@2.0;
18
19import IAccessor;
20
21/**
22 * IClientManager manages IConnection(s) inside a process. A locally
23 * created IConnection represents a communication node(receiver) with the
24 * specified buffer pool(IAccessor).
25 * IConnection(s) are not exposed to other processes(IClientManager).
26 * IClientManager instance must be unique within a process.
27 */
28interface IClientManager {
29
30    /**
31     * Sets up a buffer receiving communication node for the specified
32     * buffer pool. A manager must create a IConnection to the buffer
33     * pool if it does not already have a connection.
34     *
35     * @param bufferPool a buffer pool which is specified with the IAccessor.
36     *     The specified buffer pool is the owner of received buffers.
37     * @return status The status of the call.
38     *     OK               - A sender was set successfully.
39     *     NO_MEMORY        - Memory allocation failure occurred.
40     *     ALREADY_EXISTS   - A sender was registered already.
41     *     CRITICAL_ERROR   - Other errors.
42     * @return connectionId the Id of the communication node to the buffer pool.
43     *     This id is used in FMQ to notify IAccessor that a buffer has been
44     *     sent to that connection during transfers.
45     */
46    registerSender(IAccessor bufferPool) generates
47        (ResultStatus status, int64_t connectionId);
48};
49