mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Migrate the slot related APIs"
This commit is contained in:
@@ -36,8 +36,6 @@ hidl_interface {
|
||||
"NetworkScanResult",
|
||||
"RadioConst",
|
||||
"ScanIntervalRange",
|
||||
"SimSlotStatus",
|
||||
"SlotState",
|
||||
],
|
||||
gen_java: true,
|
||||
}
|
||||
|
||||
@@ -37,46 +37,4 @@ interface IRadio extends @1.1::IRadio {
|
||||
* Response function is IRadioResponse.startNetworkScanResponse()
|
||||
*/
|
||||
oneway startNetworkScan_1_2(int32_t serial, NetworkScanRequest request);
|
||||
|
||||
/**
|
||||
* Get SIM Slot status.
|
||||
*
|
||||
* Request provides the slot status of all active and inactive SIM slots and whether card is
|
||||
* present in the slots or not.
|
||||
*
|
||||
* @param serial Serial number of request.
|
||||
*
|
||||
* Response callback is IRadioResponse.getSimSlotsStatusResponse()
|
||||
*/
|
||||
oneway getSimSlotsStatus(int32_t serial);
|
||||
|
||||
/**
|
||||
* Set SIM Slot mapping.
|
||||
|
||||
* Maps the logical slots to the physical slots. Logical slot is the slot that is seen by modem.
|
||||
* Physical slot is the actual physical slot. Request maps the physical slot to logical slot.
|
||||
* Logical slots that are already mapped to the requested physical slot are not impacted.
|
||||
*
|
||||
* Example no. of logical slots 1 and physical slots 2:
|
||||
* The only logical slot (index 0) can be mapped to first physical slot (value 0) or second
|
||||
* physical slot(value 1), while the other physical slot remains unmapped and inactive.
|
||||
* slotMap[0] = 1 or slotMap[0] = 0
|
||||
*
|
||||
* Example no. of logical slots 2 and physical slots 2:
|
||||
* First logical slot (index 0) can be mapped to physical slot 1 or 2 and other logical slot
|
||||
* can be mapped to other physical slot. Each logical slot must be mapped to a physical slot.
|
||||
* slotMap[0] = 0 and slotMap[1] = 1 or slotMap[0] = 1 and slotMap[1] = 0
|
||||
*
|
||||
* @param serial Serial number of request
|
||||
* @param slotMap Logical to physical slot mapping, size == no. of radio instances. Index is
|
||||
* mapping to logical slot and value to physical slot, need to provide all the slots
|
||||
* mapping when sending request in case of multi slot device.
|
||||
* EX: uint32_t slotMap[logical slot] = physical slot
|
||||
* index 0 is the first logical_slot number of logical slots is equal to number of Radio
|
||||
* instances and number of physical slots is equal to size of slotStatus in
|
||||
* getSimSlotsStatusResponse
|
||||
*
|
||||
* Response callback is IRadioResponse.setSimSlotsMappingResponse()
|
||||
*/
|
||||
oneway setSimSlotsMapping(int32_t serial, vec<uint32_t> slotMap);
|
||||
};
|
||||
|
||||
@@ -29,15 +29,6 @@ interface IRadioIndication extends @1.1::IRadioIndication {
|
||||
*/
|
||||
oneway networkScanResult_1_2(RadioIndicationType type, NetworkScanResult result);
|
||||
|
||||
/**
|
||||
* Indicates SIM slot status change.
|
||||
*
|
||||
* @param type Type of radio indication
|
||||
* @param slotStatus new slot status info with size equals to the number of physical slots on
|
||||
* the device
|
||||
*/
|
||||
oneway simSlotsStatusChanged(RadioIndicationType type, vec<SimSlotStatus> slotStatus);
|
||||
|
||||
/**
|
||||
* Request all of the current cell information known to the radio.
|
||||
* Same information as returned by getCellInfoList() in 1.0::IRadio.
|
||||
|
||||
@@ -50,33 +50,4 @@ interface IRadioResponse extends @1.1::IRadioResponse {
|
||||
* RadioError:NONE
|
||||
*/
|
||||
oneway getIccCardStatusResponse_1_2(RadioResponseInfo info, CardStatus cardStatus);
|
||||
|
||||
/**
|
||||
* @param info Response info struct containing response type, serial no. and error
|
||||
* @param slotStatus Sim slot struct containing all the physical SIM slots info with size
|
||||
* equals to the number of physical slots on the device
|
||||
*
|
||||
* Valid errors returned:
|
||||
* RadioError:NONE
|
||||
* RadioError:RADIO_NOT_AVAILABLE
|
||||
* RadioError:REQUEST_NOT_SUPPORTED
|
||||
* RadioError:NO_MEMORY
|
||||
* RadioError:INTERNAL_ERR
|
||||
* RadioError:MODEM_ERR
|
||||
* RadioError:INVALID_ARGUMENTS
|
||||
*/
|
||||
oneway getSimSlotsStatusResponse(RadioResponseInfo info, vec<SimSlotStatus> slotStatus);
|
||||
|
||||
/**
|
||||
* @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:NO_MEMORY
|
||||
* RadioError:INTERNAL_ERR
|
||||
* RadioError:MODEM_ERR
|
||||
*/
|
||||
oneway setSimSlotsMappingResponse(RadioResponseInfo info);
|
||||
};
|
||||
|
||||
@@ -224,17 +224,6 @@ struct CellInfo {
|
||||
vec<CellInfoTdscdma> tdscdma;
|
||||
};
|
||||
|
||||
enum SlotState : int32_t {
|
||||
/**
|
||||
* Physical slot is inactive
|
||||
*/
|
||||
INACTIVE = 0x00,
|
||||
/**
|
||||
* Physical slot is active
|
||||
*/
|
||||
ACTIVE = 0x01,
|
||||
};
|
||||
|
||||
struct CardStatus {
|
||||
@1.0::CardStatus base;
|
||||
uint32_t physicalSlotId;
|
||||
@@ -255,31 +244,3 @@ struct CardStatus {
|
||||
*/
|
||||
string iccid;
|
||||
};
|
||||
|
||||
struct SimSlotStatus {
|
||||
/**
|
||||
* Card state in the physical slot
|
||||
*/
|
||||
CardState cardState;
|
||||
/**
|
||||
* Slot state Active/Inactive
|
||||
*/
|
||||
SlotState slotState;
|
||||
/**
|
||||
* An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816
|
||||
* standards, following electrical reset of the card's chip. The ATR conveys information about
|
||||
* the communication parameters proposed by the card, and the card's nature and state.
|
||||
*
|
||||
* This data is applicable only when cardState is CardState:PRESENT.
|
||||
*/
|
||||
string atr;
|
||||
uint32_t logicalSlotId;
|
||||
/**
|
||||
* Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is
|
||||
* located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
|
||||
* the ITU-T recommendation E.118 ISO/IEC 7816.
|
||||
*
|
||||
* This data is applicable only when cardState is CardState:PRESENT.
|
||||
*/
|
||||
string iccid;
|
||||
};
|
||||
|
||||
25
radio/config/1.0/Android.bp
Normal file
25
radio/config/1.0/Android.bp
Normal file
@@ -0,0 +1,25 @@
|
||||
// This file is autogenerated by hidl-gen -Landroidbp.
|
||||
|
||||
hidl_interface {
|
||||
name: "android.hardware.radio.config@1.0",
|
||||
root: "android.hardware",
|
||||
vndk: {
|
||||
enabled: true,
|
||||
},
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IRadioConfig.hal",
|
||||
"IRadioConfigIndication.hal",
|
||||
"IRadioConfigResponse.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hardware.radio@1.0",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
types: [
|
||||
"SimSlotStatus",
|
||||
"SlotState",
|
||||
],
|
||||
gen_java: true,
|
||||
}
|
||||
|
||||
82
radio/config/1.0/IRadioConfig.hal
Normal file
82
radio/config/1.0/IRadioConfig.hal
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.0;
|
||||
|
||||
import IRadioConfigResponse;
|
||||
import IRadioConfigIndication;
|
||||
|
||||
/**
|
||||
* This interface is used by telephony and telecom to talk to cellular radio for the purpose of
|
||||
* radio configuration, and it is not associated with any specific modem or slot.
|
||||
* All the functions have minimum one parameter:
|
||||
* serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
|
||||
* duration of a method call. If clients provide colliding serials (including passing the same
|
||||
* serial to different methods), multiple responses (one for each method call) must still be served.
|
||||
*/
|
||||
interface IRadioConfig {
|
||||
|
||||
/**
|
||||
* Set response functions for radio config requests & radio config indications.
|
||||
*
|
||||
* @param radioConfigResponse Object containing radio config response functions
|
||||
* @param radioConfigIndication Object containing radio config indications
|
||||
*/
|
||||
setResponseFunctions(IRadioConfigResponse radioConfigResponse,
|
||||
IRadioConfigIndication radioConfigIndication);
|
||||
|
||||
/**
|
||||
* Get SIM Slot status.
|
||||
*
|
||||
* Request provides the slot status of all active and inactive SIM slots and whether card is
|
||||
* present in the slots or not.
|
||||
*
|
||||
* @param serial Serial number of request.
|
||||
*
|
||||
* Response callback is IRadioConfigResponse.getSimSlotsStatusResponse()
|
||||
*/
|
||||
oneway getSimSlotsStatus(int32_t serial);
|
||||
|
||||
/**
|
||||
* Set SIM Slot mapping.
|
||||
|
||||
* Maps the logical slots to the physical slots. Logical slot is the slot that is seen by modem.
|
||||
* Physical slot is the actual physical slot. Request maps the physical slot to logical slot.
|
||||
* Logical slots that are already mapped to the requested physical slot are not impacted.
|
||||
*
|
||||
* Example no. of logical slots 1 and physical slots 2:
|
||||
* The only logical slot (index 0) can be mapped to first physical slot (value 0) or second
|
||||
* physical slot(value 1), while the other physical slot remains unmapped and inactive.
|
||||
* slotMap[0] = 1 or slotMap[0] = 0
|
||||
*
|
||||
* Example no. of logical slots 2 and physical slots 2:
|
||||
* First logical slot (index 0) can be mapped to physical slot 1 or 2 and other logical slot
|
||||
* can be mapped to other physical slot. Each logical slot must be mapped to a physical slot.
|
||||
* slotMap[0] = 0 and slotMap[1] = 1 or slotMap[0] = 1 and slotMap[1] = 0
|
||||
*
|
||||
* @param serial Serial number of request
|
||||
* @param slotMap Logical to physical slot mapping, size == no. of radio instances. Index is
|
||||
* mapping to logical slot and value to physical slot, need to provide all the slots
|
||||
* mapping when sending request in case of multi slot device.
|
||||
* EX: uint32_t slotMap[logical slot] = physical slot
|
||||
* index 0 is the first logical_slot number of logical slots is equal to number of Radio
|
||||
* instances and number of physical slots is equal to size of slotStatus in
|
||||
* getSimSlotsStatusResponse
|
||||
*
|
||||
* Response callback is IRadioConfigResponse.setSimSlotsMappingResponse()
|
||||
*/
|
||||
oneway setSimSlotsMapping(int32_t serial, vec<uint32_t> slotMap);
|
||||
};
|
||||
38
radio/config/1.0/IRadioConfigIndication.hal
Normal file
38
radio/config/1.0/IRadioConfigIndication.hal
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.0;
|
||||
|
||||
import android.hardware.radio@1.0::RadioIndicationType;
|
||||
|
||||
/**
|
||||
* Interface declaring unsolicited radio config indications.
|
||||
*/
|
||||
interface IRadioConfigIndication {
|
||||
|
||||
/**
|
||||
* Indicates SIM slot status change.
|
||||
|
||||
* This indication must be sent by the modem whenever there is any slot status change, even the
|
||||
* slot is inactive. For example, this indication must be triggered if a SIM card is inserted
|
||||
* into an inactive slot.
|
||||
*
|
||||
* @param type Type of radio indication
|
||||
* @param slotStatus new slot status info with size equals to the number of physical slots on
|
||||
* the device
|
||||
*/
|
||||
oneway simSlotsStatusChanged(RadioIndicationType type, vec<SimSlotStatus> slotStatus);
|
||||
};
|
||||
52
radio/config/1.0/IRadioConfigResponse.hal
Normal file
52
radio/config/1.0/IRadioConfigResponse.hal
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.0;
|
||||
|
||||
import android.hardware.radio@1.0::RadioResponseInfo;
|
||||
|
||||
/**
|
||||
* Interface declaring response functions to solicited radio config requests.
|
||||
*/
|
||||
interface IRadioConfigResponse {
|
||||
|
||||
/**
|
||||
* @param info Response info struct containing response type, serial no. and error
|
||||
* @param slotStatus Sim slot struct containing all the physical SIM slots info with size
|
||||
* equals to the number of physical slots on the device
|
||||
*
|
||||
* Valid errors returned:
|
||||
* RadioError:NONE
|
||||
* RadioError:RADIO_NOT_AVAILABLE
|
||||
* RadioError:NO_MEMORY
|
||||
* RadioError:INTERNAL_ERR
|
||||
* RadioError:MODEM_ERR
|
||||
*/
|
||||
oneway getSimSlotsStatusResponse(RadioResponseInfo info, vec<SimSlotStatus> slotStatus);
|
||||
|
||||
/**
|
||||
* @param info Response info struct containing response type, serial no. and error
|
||||
*
|
||||
* Valid errors returned:
|
||||
* RadioError:NONE
|
||||
* RadioError:RADIO_NOT_AVAILABLE
|
||||
* RadioError:NO_MEMORY
|
||||
* RadioError:INTERNAL_ERR
|
||||
* RadioError:MODEM_ERR
|
||||
* RadioError:INVALID_ARGUMENTS
|
||||
*/
|
||||
oneway setSimSlotsMappingResponse(RadioResponseInfo info);
|
||||
};
|
||||
58
radio/config/1.0/types.hal
Normal file
58
radio/config/1.0/types.hal
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.0;
|
||||
|
||||
import android.hardware.radio@1.0::CardState;
|
||||
|
||||
enum SlotState : int32_t {
|
||||
/**
|
||||
* Physical slot is inactive
|
||||
*/
|
||||
INACTIVE = 0x00,
|
||||
/**
|
||||
* Physical slot is active
|
||||
*/
|
||||
ACTIVE = 0x01,
|
||||
};
|
||||
|
||||
struct SimSlotStatus {
|
||||
/**
|
||||
* Card state in the physical slot
|
||||
*/
|
||||
CardState cardState;
|
||||
/**
|
||||
* Slot state Active/Inactive
|
||||
*/
|
||||
SlotState slotState;
|
||||
/**
|
||||
* An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816
|
||||
* standards, following electrical reset of the card's chip. The ATR conveys information about
|
||||
* the communication parameters proposed by the card, and the card's nature and state.
|
||||
*
|
||||
* This data is applicable only when cardState is CardState:PRESENT.
|
||||
*/
|
||||
string atr;
|
||||
uint32_t logicalSlotId;
|
||||
/**
|
||||
* Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is
|
||||
* located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
|
||||
* the ITU-T recommendation E.118 ISO/IEC 7816.
|
||||
*
|
||||
* This data is applicable only when cardState is CardState:PRESENT.
|
||||
*/
|
||||
string iccid;
|
||||
};
|
||||
31
radio/config/1.0/vts/functional/Android.bp
Normal file
31
radio/config/1.0/vts/functional/Android.bp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalRadioConfigV1_0TargetTest",
|
||||
defaults: ["VtsHalTargetTestDefaults"],
|
||||
srcs: [
|
||||
"radio_config_hidl_hal_api.cpp",
|
||||
"radio_config_hidl_hal_test.cpp",
|
||||
"radio_config_response.cpp",
|
||||
"radio_config_indication.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"RadioVtsTestUtilBase",
|
||||
"android.hardware.radio.config@1.0",
|
||||
],
|
||||
header_libs: ["radio.util.header@1.0"],
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
|
||||
|
||||
/*
|
||||
* Test IRadioConfig.getSimSlotsStatus()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, getSimSlotsStatus) {
|
||||
const int serial = GetRandomSerialNumber();
|
||||
Return<void> res = radioConfig->getSimSlotsStatus(serial);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
|
||||
ALOGI("getIccSlotsStatus, rspInfo.error = %s\n",
|
||||
toString(radioConfigRsp->rspInfo.error).c_str());
|
||||
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
|
||||
}
|
||||
|
||||
/*
|
||||
* Test IRadioConfig.setSimSlotsMapping()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, setSimSlotsMapping) {
|
||||
const int serial = GetRandomSerialNumber();
|
||||
android::hardware::hidl_vec<uint32_t> mapping = {0};
|
||||
Return<void> res = radioConfig->setSimSlotsMapping(serial, mapping);
|
||||
ASSERT_OK(res);
|
||||
EXPECT_EQ(std::cv_status::no_timeout, wait());
|
||||
EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
|
||||
EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
|
||||
ALOGI("setSimSlotsMapping, rspInfo.error = %s\n",
|
||||
toString(radioConfigRsp->rspInfo.error).c_str());
|
||||
|
||||
ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
|
||||
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
void RadioConfigHidlTest::SetUp() {
|
||||
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
|
||||
hidl_string(RADIO_SERVICE_NAME));
|
||||
if (radioConfig == NULL) {
|
||||
sleep(60);
|
||||
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
|
||||
hidl_string(RADIO_SERVICE_NAME));
|
||||
}
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
|
||||
radioConfigRsp = new (std::nothrow) RadioConfigResponse(*this);
|
||||
ASSERT_NE(nullptr, radioConfigRsp.get());
|
||||
|
||||
count_ = 0;
|
||||
|
||||
radioConfigInd = new (std::nothrow) RadioConfigIndication(*this);
|
||||
ASSERT_NE(nullptr, radioConfigInd.get());
|
||||
|
||||
radioConfig->setResponseFunctions(radioConfigRsp, radioConfigInd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify that the response message is received.
|
||||
*/
|
||||
void RadioConfigHidlTest::notify() {
|
||||
std::unique_lock<std::mutex> lock(mtx_);
|
||||
count_++;
|
||||
cv_.notify_one();
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait till the response message is notified or till TIMEOUT_PERIOD.
|
||||
*/
|
||||
std::cv_status RadioConfigHidlTest::wait() {
|
||||
std::unique_lock<std::mutex> lock(mtx_);
|
||||
|
||||
std::cv_status status = std::cv_status::no_timeout;
|
||||
auto now = std::chrono::system_clock::now();
|
||||
while (count_ == 0) {
|
||||
status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
|
||||
if (status == std::cv_status::timeout) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
count_--;
|
||||
return status;
|
||||
}
|
||||
102
radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h
Normal file
102
radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
||||
#include <android/hardware/radio/config/1.0/IRadioConfig.h>
|
||||
#include <android/hardware/radio/config/1.0/IRadioConfigIndication.h>
|
||||
#include <android/hardware/radio/config/1.0/IRadioConfigResponse.h>
|
||||
#include <android/hardware/radio/config/1.0/types.h>
|
||||
|
||||
#include "vts_test_util.h"
|
||||
|
||||
using namespace ::android::hardware::radio::config::V1_0;
|
||||
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::radio::V1_0::RadioIndicationType;
|
||||
using ::android::hardware::radio::V1_0::RadioResponseInfo;
|
||||
using ::android::hardware::radio::V1_0::RadioResponseType;
|
||||
using ::android::sp;
|
||||
|
||||
#define TIMEOUT_PERIOD 75
|
||||
#define RADIO_SERVICE_NAME "slot1"
|
||||
|
||||
class RadioConfigHidlTest;
|
||||
|
||||
/* Callback class for radio config response */
|
||||
class RadioConfigResponse : public IRadioConfigResponse {
|
||||
protected:
|
||||
RadioConfigHidlTest& parent;
|
||||
|
||||
public:
|
||||
RadioResponseInfo rspInfo;
|
||||
|
||||
RadioConfigResponse(RadioConfigHidlTest& parent);
|
||||
virtual ~RadioConfigResponse() = default;
|
||||
|
||||
Return<void> getSimSlotsStatusResponse(
|
||||
const RadioResponseInfo& info,
|
||||
const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
|
||||
|
||||
Return<void> setSimSlotsMappingResponse(const RadioResponseInfo& info);
|
||||
};
|
||||
|
||||
/* Callback class for radio config indication */
|
||||
class RadioConfigIndication : public IRadioConfigIndication {
|
||||
protected:
|
||||
RadioConfigHidlTest& parent;
|
||||
|
||||
public:
|
||||
RadioConfigIndication(RadioConfigHidlTest& parent);
|
||||
virtual ~RadioConfigIndication() = default;
|
||||
|
||||
Return<void> simSlotsStatusChanged(
|
||||
RadioIndicationType type, const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
|
||||
};
|
||||
|
||||
// The main test class for Radio config HIDL.
|
||||
class RadioConfigHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
protected:
|
||||
std::mutex mtx_;
|
||||
std::condition_variable cv_;
|
||||
int count_;
|
||||
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
/* Used as a mechanism to inform the test about data/event callback */
|
||||
void notify();
|
||||
|
||||
/* Test code calls this function to wait for response */
|
||||
std::cv_status wait();
|
||||
|
||||
/* radio config service handle */
|
||||
sp<IRadioConfig> radioConfig;
|
||||
|
||||
/* radio config response handle */
|
||||
sp<RadioConfigResponse> radioConfigRsp;
|
||||
|
||||
/* radio config indication handle */
|
||||
sp<RadioConfigIndication> radioConfigInd;
|
||||
};
|
||||
25
radio/config/1.0/vts/functional/radio_config_indication.cpp
Normal file
25
radio/config/1.0/vts/functional/radio_config_indication.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
RadioConfigIndication::RadioConfigIndication(RadioConfigHidlTest& parent) : parent(parent) {}
|
||||
|
||||
Return<void> RadioConfigIndication::simSlotsStatusChanged(
|
||||
RadioIndicationType /*type*/,
|
||||
const ::android::hardware::hidl_vec<SimSlotStatus>& /*slotStatus*/) {
|
||||
return Void();
|
||||
}
|
||||
31
radio/config/1.0/vts/functional/radio_config_response.cpp
Normal file
31
radio/config/1.0/vts/functional/radio_config_response.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
SimSlotStatus slotStatus;
|
||||
|
||||
RadioConfigResponse::RadioConfigResponse(RadioConfigHidlTest& parent) : parent(parent) {}
|
||||
|
||||
Return<void> RadioConfigResponse::getSimSlotsStatusResponse(
|
||||
const RadioResponseInfo& /* info */,
|
||||
const ::android::hardware::hidl_vec<SimSlotStatus>& /* slotStatus */) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& /* info */) {
|
||||
return Void();
|
||||
}
|
||||
Reference in New Issue
Block a user