/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.media.bufferpool@1.0;

import IAccessor;
/**
 * IClientManager manages IConnection(s) inside a process. A locally
 * created IConnection represents a communication node(receiver) with the
 * specified buffer pool(IAccessor).
 * IConnection(s) are not exposed to other processes(IClientManager).
 * IClientManager instance must be unique within a process.
 */
interface IClientManager {

    /**
     * Sets up a buffer receiving communication node for the specified
     * buffer pool. A manager must create a IConnection to the buffer
     * pool if it does not already have a connection.
     *
     * @param bufferPool a buffer pool which is specified with the IAccessor.
     *     The specified buffer pool is the owner of received buffers.
     * @return status The status of the call.
     *     OK               - A sender was set successfully.
     *     NO_MEMORY        - Memory allocation failure occurred.
     *     ALREADY_EXISTS   - A sender was registered already.
     *     CRITICAL_ERROR   - Other errors.
     * @return connectionId the Id of the communication node to the buffer pool.
     *     This id is used in FMQ to notify IAccessor that a buffer has been
     *     sent to that connection during transfers.
     */
    registerSender(IAccessor bufferPool) generates
        (ResultStatus status, int64_t connectionId);
};
