/*
 * 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.radio.config@1.1;

import @1.0::IRadioConfigResponse;
import @1.1::PhoneCapability;
import android.hardware.radio@1.0::RadioResponseInfo;
import @1.1::ModemsConfig;

/**
 * Note: IRadioConfig 1.1 is an intermediate layer between Android P and Android Q.
 * It's specifically designed for CBRS related interfaces. All other interfaces
 * for Q are be added in IRadioConfig 1.2.
 *
 * Interface declaring response functions to solicited radio config requests.
 */
interface IRadioConfigResponse extends @1.0::IRadioConfigResponse {
    /**
     * @param info Response info struct containing response type, serial no. and error
     * @param phoneCapability <@1.1::PhoneCapability> it defines modem's capability for example
     *        how many logical modems it has, how many data connections it supports.
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:INTERNAL_ERR
     */
    oneway getPhoneCapabilityResponse(RadioResponseInfo info, PhoneCapability phoneCapability);

    /**
     * @param info Response info struct containing response type, serial no. and error
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:INTERNAL_ERR
     *   RadioError:INVALID_ARGUMENTS
     */
    oneway setPreferredDataModemResponse(RadioResponseInfo info);

    /**
     * @param info Response info struct containing response type, serial no. and error
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:REQUEST_NOT_SUPPORTED
     *   RadioError:INVALID_ARGUMENTS
     */
    oneway setModemsConfigResponse(RadioResponseInfo info);

    /**
     * @param info Response info struct containing response type, serial no. and error
     * @param modemsConfig <@1.1::ModemsConfig> it defines all the modems' configurations
     *        at this time, only the number of live modems
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:REQUEST_NOT_SUPPORTED
     */
    oneway getModemsConfigResponse(RadioResponseInfo info, ModemsConfig modemsConfig);
};
