mirror of
https://gitee.com/openharmony/telephony_ril_adapter
synced 2024-11-23 15:50:13 +00:00
commit
656135e858
@ -151,6 +151,10 @@ typedef struct {
|
||||
* SIM card status:
|
||||
*/
|
||||
HRilSimState simState;
|
||||
/**
|
||||
* SIM card iccid:
|
||||
*/
|
||||
char *iccid;
|
||||
} HRilCardState;
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ private:
|
||||
void AddNotificationHandlerToMap();
|
||||
int32_t GetSimIOResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const void *response, size_t responseLen);
|
||||
int32_t GetSimStatusResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
int32_t GetSimCardStatusResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const void *response, size_t responseLen);
|
||||
int32_t GetImsiResponse(int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const void *response, size_t responseLen);
|
||||
|
@ -39,7 +39,7 @@ void HRilSim::AddHandlerToMap()
|
||||
{
|
||||
// response
|
||||
respMemberFuncMap_[HREQ_SIM_GET_SIM_IO] = &HRilSim::GetSimIOResponse;
|
||||
respMemberFuncMap_[HREQ_SIM_GET_SIM_STATUS] = &HRilSim::GetSimStatusResponse;
|
||||
respMemberFuncMap_[HREQ_SIM_GET_SIM_STATUS] = &HRilSim::GetSimCardStatusResponse;
|
||||
respMemberFuncMap_[HREQ_SIM_GET_IMSI] = &HRilSim::GetImsiResponse;
|
||||
respMemberFuncMap_[HREQ_SIM_GET_SIM_LOCK_STATUS] = &HRilSim::GetSimLockStatusResponse;
|
||||
respMemberFuncMap_[HREQ_SIM_SET_SIM_LOCK] = &HRilSim::SetSimLockResponse;
|
||||
@ -310,10 +310,10 @@ int32_t HRilSim::GetSimIOResponse(
|
||||
return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetSimIOResponse, result);
|
||||
}
|
||||
|
||||
int32_t HRilSim::GetSimStatusResponse(
|
||||
int32_t HRilSim::GetSimCardStatusResponse(
|
||||
int32_t requestNum, HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
|
||||
{
|
||||
HDI::Ril::V1_1::CardStatusInfo rilCardStatus = {};
|
||||
HDI::Ril::V1_3::SimCardStatusInfo rilCardStatus = {};
|
||||
if ((response == nullptr && responseLen != 0) ||
|
||||
(response != nullptr && responseLen != sizeof(HRilCardState))) {
|
||||
TELEPHONY_LOGE("Invalid response: Vendor exception!");
|
||||
@ -324,13 +324,16 @@ int32_t HRilSim::GetSimStatusResponse(
|
||||
if (responseInfo.error == HDI::Ril::V1_1::RilErrType::NONE) {
|
||||
responseInfo.error = HDI::Ril::V1_1::RilErrType::RIL_ERR_INVALID_RESPONSE;
|
||||
}
|
||||
return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetSimStatusResponse, rilCardStatus);
|
||||
return Response(responseInfo, &HDI::Ril::V1_3::IRilCallback::GetSimCardStatusResponse, rilCardStatus);
|
||||
}
|
||||
const HRilCardState *curPtr = static_cast<const HRilCardState *>(response);
|
||||
rilCardStatus.index = curPtr->index;
|
||||
rilCardStatus.simType = curPtr->simType;
|
||||
rilCardStatus.simState = curPtr->simState;
|
||||
return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetSimStatusResponse, rilCardStatus);
|
||||
if (curPtr != nullptr) {
|
||||
rilCardStatus.index = curPtr->index;
|
||||
rilCardStatus.simType = curPtr->simType;
|
||||
rilCardStatus.simState = curPtr->simState;
|
||||
rilCardStatus.iccid = (curPtr->iccid == nullptr) ? "" : curPtr->iccid;
|
||||
}
|
||||
return Response(responseInfo, &HDI::Ril::V1_3::IRilCallback::GetSimCardStatusResponse, rilCardStatus);
|
||||
}
|
||||
|
||||
int32_t HRilSim::GetImsiResponse(
|
||||
|
@ -146,6 +146,8 @@ public:
|
||||
const HDI::Ril::V1_1::IccIoResultInfo &result) override;
|
||||
int32_t GetSimStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const HDI::Ril::V1_1::CardStatusInfo &result) override;
|
||||
int32_t GetSimCardStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const HDI::Ril::V1_3::SimCardStatusInfo &result) override;
|
||||
int32_t GetImsiResponse(
|
||||
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &response) override;
|
||||
int32_t GetSimLockStatusResponse(
|
||||
|
@ -363,6 +363,8 @@ public:
|
||||
const HDI::Ril::V1_1::IccIoResultInfo &result) override;
|
||||
int32_t GetSimStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const HDI::Ril::V1_1::CardStatusInfo &result) override;
|
||||
int32_t GetSimCardStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const HDI::Ril::V1_3::SimCardStatusInfo &result) override;
|
||||
int32_t GetImsiResponse(
|
||||
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &response) override;
|
||||
int32_t GetSimLockStatusResponse(
|
||||
|
@ -131,6 +131,19 @@ int32_t RilCallbackTest::GetSimStatusResponse(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t RilCallbackTest::GetSimCardStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
|
||||
const HDI::Ril::V1_3::SimCardStatusInfo &result)
|
||||
{
|
||||
TELEPHONY_LOGI("GetBoolResult GetSimCardStatus result : slotId = %{public}d, simType = %{public}d,"
|
||||
"simState = %{public}d", responseInfo.slotId, result.simType, result.simState);
|
||||
simState_[responseInfo.slotId] = result.simState;
|
||||
TELEPHONY_LOGI("IsReady %{public}d %{public}d", responseInfo.slotId, simState_[responseInfo.slotId]);
|
||||
hdiId_ = HdiId::HREQ_SIM_GET_SIM_STATUS;
|
||||
resultInfo_ = responseInfo;
|
||||
NotifyAll();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t RilCallbackTest::GetSimIOResponse(const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
|
||||
{
|
||||
TELEPHONY_LOGI("GetBoolResult GetSimIO result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
|
||||
|
@ -669,7 +669,7 @@ HWTEST_F(BranchTest, Telephony_HrilManager_Sim_002, Function | MediumTest | Leve
|
||||
auto sim = std::make_unique<HRilSim>(0);
|
||||
HDI::Ril::V1_1::RilRadioResponseInfo responseInfo;
|
||||
EXPECT_NE(HDF_SUCCESS, sim->GetSimIOResponse(0, responseInfo, nullptr, 0));
|
||||
EXPECT_NE(HDF_SUCCESS, sim->GetSimStatusResponse(0, responseInfo, nullptr, 0));
|
||||
EXPECT_NE(HDF_SUCCESS, sim->GetSimCardStatusResponse(0, responseInfo, nullptr, 0));
|
||||
EXPECT_NE(HDF_SUCCESS, sim->GetImsiResponse(0, responseInfo, nullptr, 0));
|
||||
EXPECT_NE(HDF_SUCCESS, sim->GetSimLockStatusResponse(0, responseInfo, nullptr, 0));
|
||||
EXPECT_NE(HDF_SUCCESS, sim->SetSimLockResponse(0, responseInfo, nullptr, 0));
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
using namespace OHOS::HDI::Ril::V1_2;
|
||||
using namespace OHOS::HDI::Ril::V1_3;
|
||||
using namespace std;
|
||||
|
||||
enum class RatType {
|
||||
@ -97,6 +97,16 @@ int32_t RilCallbackTest::GetSimStatusResponse(const RilRadioResponseInfo &respon
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t RilCallbackTest::GetSimCardStatusResponse(const RilRadioResponseInfo &responseInfo,
|
||||
const SimCardStatusInfo &result)
|
||||
{
|
||||
PrintResponseInfo("GetSimCardStatusResponse", responseInfo);
|
||||
cout << "[SimCardStatusInfo] -->[index] : " << result.index << " -->[simType] : " << result.simType
|
||||
<< " -->[simState] : " << result.simState;
|
||||
cout << endl << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t RilCallbackTest::GetSimIOResponse(const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
|
||||
{
|
||||
PrintResponseInfo("GetSimIOResponse", responseInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user