IssueNo: 获取IMEISVN方式

Description: 获取IMEISVN方式
Sig:SIG_Telephony
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: zhoujie223 <zhoujie223@huawei.com>
This commit is contained in:
zhoujie223 2024-04-07 10:34:35 +08:00
parent ef74aee046
commit 67b7c20493
62 changed files with 513 additions and 37 deletions

View File

@ -168,6 +168,7 @@ ohos_shared_library("tel_core_service") {
"drivers_interface_ril:hril_innerkits",
"drivers_interface_ril:libril_proxy_1.1",
"drivers_interface_ril:libril_proxy_1.2",
"drivers_interface_ril:libril_proxy_1.3",
"eventhandler:libeventhandler",
"hdf_core:libhdi",
"hdf_core:libpub_utils",

5
frameworks/js/network_search/include/napi_radio.h Executable file → Normal file
View File

@ -235,6 +235,11 @@ struct GetIMEIContext : BaseContext {
std::string getIMEIResult = "";
};
struct GetIMEISVContext : BaseContext {
int32_t slotId = DEFAULT_SIM_SLOT_ID;
std::string getIMEISVResult = "";
};
struct GetMEIDContext : BaseContext {
int32_t slotId = DEFAULT_SIM_SLOT_ID;
std::string getMEIDResult = "";

View File

@ -1803,6 +1803,77 @@ static napi_value GetIMEI(napi_env env, napi_callback_info info)
return NapiUtil::HandleAsyncWork(env, asyncContext.release(), "GetIMEI", NativeGetIMEI, GetIMEICallback);
}
void NativeGetIMEISV(napi_env env, void *data)
{
auto context = static_cast<GetIMEISVContext *>(data);
if (!IsValidSlotId(context->slotId)) {
TELEPHONY_LOGE("NativeGetIMEISV slotId is invalid");
context->errorCode = ERROR_SLOT_ID_INVALID;
return;
}
std::u16string imeiSv = u"";
context->errorCode = DelayedRefSingleton<CoreServiceClient>::GetInstance().GetImeiSv(context->slotId, imeiSv);
if (context->errorCode == TELEPHONY_SUCCESS) {
context->resolved = true;
context->getIMEISVResult = NapiUtil::ToUtf8(imeiSv);
TELEPHONY_LOGI(
"NativeGetIMEISV len = %{public}lu", static_cast<unsigned long>(context->getIMEISVResult.length()));
}
}
void GetIMEISVCallback(napi_env env, napi_status status, void *data)
{
auto context = static_cast<GetIMEISVContext *>(data);
napi_value callbackValue = nullptr;
if (context->resolved) {
napi_create_string_utf8(env, context->getIMEISVResult.c_str(), context->getIMEISVResult.size(), &callbackValue);
} else {
JsError error =
NapiUtil::ConverErrorMessageWithPermissionForJs(context->errorCode, "getIMEISV", GET_TELEPHONY_STATE);
callbackValue = NapiUtil::CreateErrorMessage(env, error.errorMessage, error.errorCode);
}
NapiUtil::Handle2ValueCallback(env, context, callbackValue);
}
static napi_value GetIMEISV(napi_env env, napi_callback_info info)
{
size_t parameterCount = PARAMETER_COUNT_TWO;
napi_value parameters[PARAMETER_COUNT_TWO] = { 0 };
napi_value thisVar = nullptr;
void *data = nullptr;
NAPI_CALL(env, napi_get_cb_info(env, info, &parameterCount, parameters, &thisVar, &data));
if (!MatchGetIMEIParameter(env, parameters, parameterCount)) {
TELEPHONY_LOGE("parameter matching failed.");
NapiUtil::ThrowParameterError(env);
return nullptr;
}
auto asyncContext = std::make_unique<GetIMEISVContext>();
if (asyncContext == nullptr) {
TELEPHONY_LOGE("asyncContext is nullptr.");
NapiUtil::ThrowParameterError(env);
return nullptr;
}
if (parameterCount == PARAMETER_COUNT_ZERO) {
asyncContext->slotId = GetDefaultSlotId();
} else if (parameterCount == PARAMETER_COUNT_ONE) {
napi_valuetype valueType = napi_undefined;
NAPI_CALL(env, napi_typeof(env, parameters[0], &valueType));
if (valueType == napi_undefined || valueType == napi_null) {
TELEPHONY_LOGI("undefined or null parameter detected, treating as no parameter input.");
asyncContext->slotId = GetDefaultSlotId();
} else if (valueType == napi_number) {
NAPI_CALL(env, napi_get_value_int32(env, parameters[0], &asyncContext->slotId));
} else {
asyncContext->slotId = GetDefaultSlotId();
NAPI_CALL(env, napi_create_reference(env, parameters[0], DEFAULT_REF_COUNT, &asyncContext->callbackRef));
}
} else {
NAPI_CALL(env, napi_get_value_int32(env, parameters[0], &asyncContext->slotId));
NAPI_CALL(env, napi_create_reference(env, parameters[1], DEFAULT_REF_COUNT, &asyncContext->callbackRef));
}
return NapiUtil::HandleAsyncWork(env, asyncContext.release(), "GetIMEISV", NativeGetIMEISV, GetIMEISVCallback);
}
void NativeGetMEID(napi_env env, void *data)
{
auto context = static_cast<GetMEIDContext *>(data);
@ -3525,6 +3596,7 @@ static napi_value CreateFunctions(napi_env env, napi_value exports)
DECLARE_NAPI_FUNCTION("setNetworkCapability", SetNetworkCapability),
DECLARE_NAPI_FUNCTION("getNetworkCapability", GetNetworkCapability),
DECLARE_NAPI_FUNCTION("getIMEI", GetIMEI),
DECLARE_NAPI_FUNCTION("getIMEISV", GetIMEISV),
DECLARE_NAPI_FUNCTION("getMEID", GetMEID),
DECLARE_NAPI_FUNCTION("sendUpdateCellLocationRequest", SendUpdateCellLocationRequest),
DECLARE_NAPI_FUNCTION("getCellInformation", GetCellInformation),

9
frameworks/native/src/core_manager_inner.cpp Executable file → Normal file
View File

@ -1495,6 +1495,15 @@ int32_t CoreManagerInner::GetImei(int32_t slotId, std::u16string &imei)
return networkSearchManager_->GetImei(slotId, imei);
}
int32_t CoreManagerInner::GetImeiSv(int32_t slotId, std::u16string &imeiSv)
{
if (networkSearchManager_ == nullptr) {
TELEPHONY_LOGE("networkSearchManager is null!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return networkSearchManager_->GetImeiSv(slotId, imeiSv);
}
int32_t CoreManagerInner::GetMeid(int32_t slotId, std::u16string &meid)
{
if (networkSearchManager_ == nullptr) {

10
frameworks/native/src/core_service_client.cpp Executable file → Normal file
View File

@ -247,6 +247,16 @@ int32_t CoreServiceClient::GetImei(int32_t slotId, std::u16string &imei)
return proxy->GetImei(slotId, imei);
}
int32_t CoreServiceClient::GetImeiSv(int32_t slotId, std::u16string &imeiSv)
{
auto proxy = GetProxy();
if (proxy == nullptr) {
TELEPHONY_LOGE("proxy is null!");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
return proxy->GetImeiSv(slotId, imeiSv);
}
int32_t CoreServiceClient::HasSimCard(int32_t slotId, bool &hasSimCard)
{
auto proxy = GetProxy();

27
frameworks/native/src/core_service_proxy.cpp Executable file → Normal file
View File

@ -485,6 +485,33 @@ int32_t CoreServiceProxy::GetImei(int32_t slotId, std::u16string &imei)
return result;
}
int32_t CoreServiceProxy::GetImeiSv(int32_t slotId, std::u16string &imeiSv)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!WriteInterfaceToken(data)) {
TELEPHONY_LOGE("GetImeiSv WriteInterfaceToken is false");
return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
}
data.WriteInt32(slotId);
auto remote = Remote();
if (remote == nullptr) {
TELEPHONY_LOGE("GetImeiSv Remote is null");
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t error = remote->SendRequest(uint32_t(CoreServiceInterfaceCode::GET_IMEISV), data, reply, option);
if (error != ERR_NONE) {
TELEPHONY_LOGE("GetImeiSv failed, error code is %{public}d", error);
return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
}
int32_t result = reply.ReadInt32();
if (result == TELEPHONY_ERR_SUCCESS) {
imeiSv = reply.ReadString16();
}
return result;
}
int32_t CoreServiceProxy::GetMeid(int32_t slotId, std::u16string &meid)
{
MessageParcel data;

View File

@ -113,6 +113,7 @@ const std::string ResourceUtils::CALL_FAILED_CALL_BARRED = "call_failed_call_bar
const std::string ResourceUtils::CALL_FAILED_FDN_BLOCKED = "call_failed_fdn_blocked";
const std::string ResourceUtils::CALL_FAILED_IMSI_UNKNOWN_IN_VLR = "call_failed_imsi_unknow";
const std::string ResourceUtils::CALL_FAILED_IMEI_NOT_ACCEPTED = "call_failed_imei_not_accepted";
const std::string ResourceUtils::CALL_FAILED_IMEISV_NOT_ACCEPTED = "call_failed_imeisv_not_accepted";
const std::string ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_USSD = "call_failed_dial_modify_to_ussd";
const std::string ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_SS = "call_failed_dial_modify_to_ss";
const std::string ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_DIAL = "call_failed_dial_modify_to_dial";
@ -213,6 +214,7 @@ const std::map<std::string, ResourceUtils::ResourceType> ResourceUtils::mapResou
{ ResourceUtils::CALL_FAILED_FDN_BLOCKED, ResourceUtils::ResourceType::ResourceTypeString },
{ ResourceUtils::CALL_FAILED_IMSI_UNKNOWN_IN_VLR, ResourceUtils::ResourceType::ResourceTypeString },
{ ResourceUtils::CALL_FAILED_IMEI_NOT_ACCEPTED, ResourceUtils::ResourceType::ResourceTypeString },
{ ResourceUtils::CALL_FAILED_IMEISV_NOT_ACCEPTED, ResourceUtils::ResourceType::ResourceTypeString },
{ ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_USSD, ResourceUtils::ResourceType::ResourceTypeString },
{ ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_SS, ResourceUtils::ResourceType::ResourceTypeString },
{ ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_DIAL, ResourceUtils::ResourceType::ResourceTypeString },
@ -312,6 +314,7 @@ const std::map<int32_t, std::string> ResourceUtils::callFailedResourceName_ = {
{ DisconnectedReasons::FDN_BLOCKED, ResourceUtils::CALL_FAILED_FDN_BLOCKED },
{ DisconnectedReasons::IMSI_UNKNOWN_IN_VLR, ResourceUtils::CALL_FAILED_IMSI_UNKNOWN_IN_VLR },
{ DisconnectedReasons::IMEI_NOT_ACCEPTED, ResourceUtils::CALL_FAILED_IMEI_NOT_ACCEPTED },
{ DisconnectedReasons::IMEISV_NOT_ACCEPTED, ResourceUtils::CALL_FAILED_IMEISV_NOT_ACCEPTED },
{ DisconnectedReasons::DIAL_MODIFIED_TO_USSD, ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_USSD },
{ DisconnectedReasons::DIAL_MODIFIED_TO_SS, ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_SS },
{ DisconnectedReasons::DIAL_MODIFIED_TO_DIAL, ResourceUtils::CALL_FAILED_DIAL_MODIFIED_TO_DIAL },

1
interfaces/innerkits/include/core_manager_inner.h Executable file → Normal file
View File

@ -208,6 +208,7 @@ public:
int32_t GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode);
int32_t GetImei(int32_t slotId, std::u16string &imei);
int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv);
int32_t GetMeid(int32_t slotId, std::u16string &meid);
int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId);
PhoneType GetPhoneType(int32_t slotId);

9
interfaces/innerkits/include/core_service_client.h Executable file → Normal file
View File

@ -166,6 +166,15 @@ public:
*/
int32_t GetImei(int32_t slotId, std::u16string &imei);
/**
* @brief Obtains the software version number of a specified card slot of the device
*
* @param slotId[in], sim slot id
* @param imeiSv[out], the International Mobile Equipment Identification Number of the SIM card
* @return int32_t TELEPHONY_SUCCESS on success, others on failure.
*/
int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv);
/**
* @brief Checks whether a SIM card is inserted in a specified slot.
*

View File

@ -30,6 +30,7 @@ enum class CoreServiceInterfaceCode {
SET_RADIO_STATE,
GET_RADIO_STATE,
GET_IMEI,
GET_IMEISV,
GET_MEID,
GET_UNIQUE_DEVICE_ID,
HAS_SIM_CARD,

1
interfaces/innerkits/include/core_service_proxy.h Executable file → Normal file
View File

@ -38,6 +38,7 @@ public:
int32_t SetNrOptionMode(int32_t slotId, int32_t mode, const sptr<INetworkSearchCallback> &callback) override;
int32_t GetNrOptionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override;
int32_t GetImei(int32_t slotId, std::u16string &imei) override;
int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) override;
int32_t GetMeid(int32_t slotId, std::u16string &meid) override;
int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) override;
int32_t GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override;

1
interfaces/innerkits/include/i_core_service.h Executable file → Normal file
View File

@ -45,6 +45,7 @@ public:
virtual int32_t SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback) = 0;
virtual int32_t GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
virtual int32_t GetImei(int32_t slotId, std::u16string &imei) = 0;
virtual int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) = 0;
virtual int32_t GetMeid(int32_t slotId, std::u16string &meid) = 0;
virtual int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) = 0;
virtual bool IsNrSupported(int32_t slotId) = 0;

1
interfaces/innerkits/include/i_network_search.h Executable file → Normal file
View File

@ -95,6 +95,7 @@ public:
*/
virtual int32_t GetPsRoamingState(int32_t slotId) = 0;
virtual int32_t GetImei(int32_t slotId, std::u16string &imei) = 0;
virtual int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) = 0;
virtual int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) = 0;
virtual int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) = 0;
virtual int32_t SendUpdateCellLocationRequest(int32_t slotId) = 0;

2
interfaces/innerkits/include/i_tel_ril_manager.h Executable file → Normal file
View File

@ -121,6 +121,8 @@ public:
virtual int32_t GetImei(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
virtual int32_t GetImeiSv(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
virtual int32_t GetMeid(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;
virtual int32_t GetVoiceRadioTechnology(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) = 0;

1
interfaces/innerkits/include/radio_event.h Executable file → Normal file
View File

@ -135,6 +135,7 @@ enum RadioEvent {
RADIO_NITZ_UPDATE,
RADIO_GET_IMS_REG_STATUS,
RADIO_GET_IMEI,
RADIO_GET_IMEISV,
RADIO_SET_PS_ATTACH_STATUS,
RADIO_GET_MEID,
RADIO_CHANNEL_CONFIG_UPDATE,

View File

@ -107,6 +107,7 @@ enum DisconnectedReasons {
RADIO_RELEASE_ABNORMAL = 259, // RRC connection release, abnormal
ACCESS_CLASS_BLOCKED = 260, // Access class barring
NETWORK_DETACH = 261, // Explicit network detach
IMEISV_NOT_ACCEPTED = 262, // ImeiSv not accepted
FAILED_INVALID_PARAMETER = 1025,
SIM_NOT_EXIT = 1026,
SIM_PIN_NEED = 1027,
@ -180,6 +181,7 @@ public:
static const std::string CALL_FAILED_FDN_BLOCKED;
static const std::string CALL_FAILED_IMSI_UNKNOWN_IN_VLR;
static const std::string CALL_FAILED_IMEI_NOT_ACCEPTED;
static const std::string CALL_FAILED_IMEISV_NOT_ACCEPTED;
static const std::string CALL_FAILED_DIAL_MODIFIED_TO_USSD;
static const std::string CALL_FAILED_DIAL_MODIFIED_TO_SS;
static const std::string CALL_FAILED_DIAL_MODIFIED_TO_DIAL;

19
interfaces/kits/js/@ohos.telephony.radio.d.ts vendored Executable file → Normal file
View File

@ -617,6 +617,25 @@ declare namespace radio {
*/
function getIMEI(callback: AsyncCallback<string>): void;
/**
* Obtains the software version number of a specified card slot of the device.
*
* @permission ohos.permission.GET_TELEPHONY_STATE
* @param { number } slotId - Indicates the card slot index number, ranging from 0 to the maximum card slot
* index number supported by the device.
* @returns { Promise<string> } Returns the IMEISV. Returns an empty string if the IMEISV does not exist.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications use system APIs.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 8300001 - Invalid parameter value.
* @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service.
* @throws { BusinessError } 8300003 - System internal error.
* @throws { BusinessError } 8300999 - Unknown error code.
* @systemapi Hide this for inner system use.
* @since 12
*/
function getIMEISV(slotId?: number): Promise<string>;
/**
* Obtains the MEID of a specified card slot of the device.
*

2
services/core/include/core_service.h Executable file → Normal file
View File

@ -58,6 +58,8 @@ public:
int32_t GetImei(int32_t slotId, std::u16string &imei) override;
int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) override;
int32_t GetMeid(int32_t slotId, std::u16string &meid) override;
int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) override;

1
services/core/include/core_service_stub.h Executable file → Normal file
View File

@ -51,6 +51,7 @@ private:
int32_t OnGetNetworkSelectionMode(MessageParcel &data, MessageParcel &reply);
int32_t OnGetIsoCountryCodeForNetwork(MessageParcel &data, MessageParcel &reply);
int32_t OnGetImei(MessageParcel &data, MessageParcel &reply);
int32_t OnGetImeiSv(MessageParcel &data, MessageParcel &reply);
int32_t OnGetMeid(MessageParcel &data, MessageParcel &reply);
int32_t OnGetUniqueDeviceId(MessageParcel &data, MessageParcel &reply);
int32_t OnIsNrSupported(MessageParcel &data, MessageParcel &reply);

View File

@ -279,6 +279,23 @@ int32_t CoreService::GetImei(int32_t slotId, std::u16string &imei)
return networkSearchManager_->GetImei(slotId, imei);
}
int32_t CoreService::GetImeiSv(int32_t slotId, std::u16string &imeiSv)
{
if (!TelephonyPermission::CheckCallerIsSystemApp()) {
TELEPHONY_LOGE("Non-system applications use system APIs!");
return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API;
}
if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) {
TELEPHONY_LOGE("permission denied!");
return TELEPHONY_ERR_PERMISSION_ERR;
}
if (networkSearchManager_ == nullptr) {
TELEPHONY_LOGE("networkSearchManager_ is null");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return networkSearchManager_->GetImeiSv(slotId, imeiSv);
}
int32_t CoreService::GetMeid(int32_t slotId, std::u16string &meid)
{
if (!TelephonyPermission::CheckCallerIsSystemApp()) {

View File

@ -52,6 +52,7 @@ void CoreServiceStub::AddHandlerNetWorkToMap()
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::GET_ISO_COUNTRY_CODE_FOR_NETWORK)] =
&CoreServiceStub::OnGetIsoCountryCodeForNetwork;
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::GET_IMEI)] = &CoreServiceStub::OnGetImei;
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::GET_IMEISV)] = &CoreServiceStub::OnGetImeiSv;
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::GET_MEID)] = &CoreServiceStub::OnGetMeid;
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::GET_UNIQUE_DEVICE_ID)] = &CoreServiceStub::OnGetUniqueDeviceId;
memberFuncMap_[uint32_t(CoreServiceInterfaceCode::GET_IMS_REG_STATUS)] = &CoreServiceStub::OnGetImsRegStatus;
@ -354,6 +355,25 @@ int32_t CoreServiceStub::OnGetImei(MessageParcel &data, MessageParcel &reply)
return result;
}
int32_t CoreServiceStub::OnGetImeiSv(MessageParcel &data, MessageParcel &reply)
{
int32_t slotId = data.ReadInt32();
std::u16string imeiSv = u"";
int32_t result = GetImeiSv(slotId, imeiSv);
if (!reply.WriteInt32(result)) {
TELEPHONY_LOGE("OnRemoteRequest::OnGetImeiSv write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
}
if (result != TELEPHONY_ERR_SUCCESS) {
return result;
}
if (!reply.WriteString16(imeiSv)) {
TELEPHONY_LOGE("OnRemoteRequest::OnGetImeiSv write reply failed.");
return TELEPHONY_ERR_WRITE_REPLY_FAIL;
}
return result;
}
int32_t CoreServiceStub::OnGetMeid(MessageParcel &data, MessageParcel &reply)
{
int32_t slotId = data.ReadInt32();

View File

@ -124,6 +124,7 @@ private:
void SetPreferredNetworkResponse(const AppExecFwk::InnerEvent::Pointer &event);
void RadioNitzUpdate(const AppExecFwk::InnerEvent::Pointer &event);
void RadioGetImei(const AppExecFwk::InnerEvent::Pointer &event);
void RadioGetImeiSv(const AppExecFwk::InnerEvent::Pointer &event);
void RadioGetMeid(const AppExecFwk::InnerEvent::Pointer &event);
void RadioGetNeighboringCellInfo(const AppExecFwk::InnerEvent::Pointer &event);
void RadioGetCurrentCellInfo(const AppExecFwk::InnerEvent::Pointer &event);

View File

@ -66,6 +66,7 @@ struct NetworkSearchManagerInner {
SelectionMode selection_ = SelectionMode::MODE_TYPE_UNKNOWN;
ModemPowerState radioState_ = ModemPowerState::CORE_SERVICE_POWER_OFF;
std::u16string imei_ = u"";
std::u16string imeiSv_ = u"";
std::u16string meid_ = u"";
std::string residentNetworkNumeric_ = "";
std::string basebandVersion_ = "";
@ -174,6 +175,7 @@ public:
int32_t SetPreferredNetwork(int32_t slotId, int32_t networkMode, NSCALLBACK &callback) override;
int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode) override;
int32_t GetImei(int32_t slotId, std::u16string &imei) override;
int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) override;
int32_t GetPsRegState(int32_t slotId) override;
int32_t GetCsRegState(int32_t slotId) override;
int32_t GetPsRoamingState(int32_t slotId) override;
@ -235,6 +237,7 @@ public:
int32_t GetPreferredNetworkValue(int32_t slotId) const;
void UpdatePhone(int32_t slotId, RadioTech csRadioTech, const RadioTech &psRadioTech);
void SetImei(int32_t slotId, std::u16string imei);
void SetImeiSv(int32_t slotId, std::u16string imeiSv);
void UpdateCellLocation(int32_t slotId, int32_t techType, int32_t cellId, int32_t lac);
void SetMeid(int32_t slotId, std::u16string meid);
void SetFrequencyType(int32_t slotId, FrequencyType type);

View File

@ -36,6 +36,7 @@ public:
void ProcessSetRadioState(const AppExecFwk::InnerEvent::Pointer &event) const;
void RadioFirstPowerOn(std::shared_ptr<NetworkSearchManager> &nsm, ModemPowerState radioState) const;
void ProcessGetImei(const AppExecFwk::InnerEvent::Pointer &event) const;
void ProcessGetImeiSv(const AppExecFwk::InnerEvent::Pointer &event) const;
void ProcessGetMeid(const AppExecFwk::InnerEvent::Pointer &event) const;
void UpdatePhone(RadioTech csRadioTech, const RadioTech &psRadioTech);
void SetPhoneType(PhoneType phoneType);

View File

@ -54,6 +54,7 @@ const std::map<uint32_t, NetworkSearchHandler::NsHandlerFunc> NetworkSearchHandl
{ RadioEvent::RADIO_IMS_SERVICE_STATUS_UPDATE, &NetworkSearchHandler::UpdateImsServiceStatus },
{ RadioEvent::RADIO_IMS_REGISTER_STATE_UPDATE, &NetworkSearchHandler::UpdateImsRegisterState },
{ RadioEvent::RADIO_GET_IMEI, &NetworkSearchHandler::RadioGetImei },
{ RadioEvent::RADIO_GET_IMEISV, &NetworkSearchHandler::RadioGetImeiSv },
{ RadioEvent::RADIO_GET_MEID, &NetworkSearchHandler::RadioGetMeid },
{ RadioEvent::RADIO_GET_NEIGHBORING_CELL_INFO, &NetworkSearchHandler::RadioGetNeighboringCellInfo },
{ RadioEvent::RADIO_GET_CURRENT_CELL_INFO, &NetworkSearchHandler::RadioGetCurrentCellInfo },
@ -779,6 +780,20 @@ void NetworkSearchHandler::RadioGetImei(const AppExecFwk::InnerEvent::Pointer &e
}
}
void NetworkSearchHandler::RadioGetImeiSv(const AppExecFwk::InnerEvent::Pointer &event)
{
if (event == nullptr) {
TELEPHONY_LOGE("NetworkSearchHandler::RadioGetImeiSv event is nullptr!");
return;
}
TELEPHONY_LOGD("NetworkSearchHandler::RadioGetImeiSv start slotId:%{public}d", slotId_);
if (radioInfo_ != nullptr) {
radioInfo_->ProcessGetImeiSv(event);
} else {
TELEPHONY_LOGE("RadioGetImeiSv radioInfo_ is null slotId:%{public}d", slotId_);
}
}
void NetworkSearchHandler::RadioGetMeid(const AppExecFwk::InnerEvent::Pointer &event)
{
TELEPHONY_LOGD("NetworkSearchHandler::RadioGetMeid start slotId:%{public}d", slotId_);

View File

@ -966,6 +966,14 @@ void NetworkSearchManager::SetImei(int32_t slotId, std::u16string imei)
}
}
void NetworkSearchManager::SetImeiSv(int32_t slotId, std::u16string imeiSv)
{
auto inner = FindManagerInner(slotId);
if (inner != nullptr) {
inner->imeiSv_ = imeiSv;
}
}
int32_t NetworkSearchManager::GetImei(int32_t slotId, std::u16string &imei)
{
TELEPHONY_LOGD("NetworkSearchManager::GetImei start slotId:%{public}d", slotId);
@ -988,6 +996,23 @@ int32_t NetworkSearchManager::GetImei(int32_t slotId, std::u16string &imei)
return TELEPHONY_ERR_SUCCESS;
}
int32_t NetworkSearchManager::GetImeiSv(int32_t slotId, std::u16string &imeiSv)
{
TELEPHONY_LOGD("NetworkSearchManager::GetImeiSv start slotId:%{public}d", slotId);
imeiSv = u"";
auto inner = FindManagerInner(slotId);
if (inner == nullptr || eventSender_ == nullptr) {
TELEPHONY_LOGE("slotId:%{public}d inner or eventSender_ is null", slotId);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (inner->imeiSv_.empty()) {
eventSender_->SendBase(slotId, RadioEvent::RADIO_GET_IMEISV);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
imeiSv = inner->imeiSv_;
return TELEPHONY_ERR_SUCCESS;
}
int32_t NetworkSearchManager::GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo)
{
auto inner = FindManagerInner(slotId);

1
services/network_search/src/network_utils.cpp Executable file → Normal file
View File

@ -227,6 +227,7 @@ const std::map<RadioEvent, std::any> EventSender::mapFunctions_ = {
{ RadioEvent::RADIO_SET_STATUS, &ITelRilManager::SetRadioState },
{ RadioEvent::RADIO_GET_STATUS, &ITelRilManager::GetRadioState },
{ RadioEvent::RADIO_GET_IMEI, &ITelRilManager::GetImei },
{ RadioEvent::RADIO_GET_IMEISV, &ITelRilManager::GetImeiSv },
{ RadioEvent::RADIO_GET_MEID, &ITelRilManager::GetMeid },
{ RadioEvent::RADIO_NETWORK_SEARCH_RESULT, &ITelRilManager::GetNetworkSearchInformation },
{ RadioEvent::RADIO_GET_VOICE_TECH, &ITelRilManager::GetVoiceRadioTechnology },

View File

@ -149,6 +149,29 @@ void RadioInfo::ProcessGetImei(const AppExecFwk::InnerEvent::Pointer &event) con
nsm->SetImei(slotId_, Str8ToStr16(imeiID->data));
}
void RadioInfo::ProcessGetImeiSv(const AppExecFwk::InnerEvent::Pointer &event) const
{
std::shared_ptr<NetworkSearchManager> nsm = networkSearchManager_.lock();
TELEPHONY_LOGI("RadioInfo::ProcessGetImeiSv slotId:%{public}d", slotId_);
if (event == nullptr) {
TELEPHONY_LOGE("RadioInfo::ProcessGetImeiSv event is nullptr slotId:%{public}d", slotId_);
return;
}
if (nsm == nullptr) {
TELEPHONY_LOGE("RadioInfo::ProcessGetImeiSv nsm is nullptr slotId:%{public}d", slotId_);
return;
}
std::shared_ptr<HRilStringParcel> imeiSvID = event->GetSharedObject<HRilStringParcel>();
if (imeiSvID == nullptr) {
TELEPHONY_LOGE("RadioInfo::ProcessGetImeiSv imeiSv is nullptr slotId:%{public}d", slotId_);
nsm->SetImeiSv(slotId_, u"");
return;
}
TELEPHONY_LOGI("RadioInfo::ProcessGetImeiSv get imeiSv success");
nsm->SetImeiSv(slotId_, Str8ToStr16(imeiSvID->data));
}
void RadioInfo::ProcessGetMeid(const AppExecFwk::InnerEvent::Pointer &event) const
{
std::shared_ptr<NetworkSearchManager> nsm = networkSearchManager_.lock();
@ -207,8 +230,10 @@ void RadioInfo::UpdatePhone(RadioTech csRadioTech, const RadioTech &psRadioTech)
networkSearchManager->InitSimRadioProtocol(slotId_);
std::u16string meid = u"";
std::u16string imei = u"";
std::u16string imeiSv = u"";
std::string basebandVersion = "";
networkSearchManager->GetImei(slotId_, imei);
networkSearchManager->GetImeiSv(slotId_, imeiSv);
networkSearchManager->GetMeid(slotId_, meid);
networkSearchManager->GetBasebandVersion(slotId_, basebandVersion);
if (static_cast<ModemPowerState>(radioState) == CORE_SERVICE_POWER_ON) {

19
services/network_search/test/test.cpp Executable file → Normal file
View File

@ -71,6 +71,7 @@ const int32_t INPUT_SET_NR_OPTION_MODE = 33;
const int32_t INPUT_FACTORY_RESET = 34;
const int32_t INPUT_GET_NR_SSBID = 35;
const int32_t INPUT_GET_RESIDENT_NETWORK_NUMERIC = 36;
const int32_t INPUT_GET_IMEISV = 37;
const int32_t INPUT_INIT_TIME = 99;
const int32_t INPUT_QUIT = 100;
const int32_t SLEEP_TIME = 5;
@ -613,6 +614,22 @@ void TestGetImei()
std::cout << "imei:" << str << std::endl;
}
void TestGetImeiSv()
{
AccessToken token;
if (g_telephonyService == nullptr) {
std::cout << "TestGetImeiSv g_telephonyService is nullptr." << std::endl;
return;
}
std::u16string imeiSv = u"";
int32_t result = g_telephonyService->GetImeiSv(InputSlotId(), imeiSv);
if (result != TELEPHONY_ERR_SUCCESS) {
std::cout << "error:" << result << std::endl;
}
std::string str = Str16ToStr8(imeiSv);
std::cout << "imeiSv:" << str << std::endl;
}
void TestGetMeid()
{
AccessToken token;
@ -773,6 +790,7 @@ void Prompt()
"34:FactoryReset\n"
"35:GetNrSsbId\n"
"36:GetResidentNetworkNumeric\n"
"37:GetImeiSv\n"
"99:InitTimeAndTimeZone\n"
"100:exit \n");
}
@ -849,6 +867,7 @@ void Init()
memberFuncMap_[INPUT_SET_NR_OPTION_MODE] = TestSetNrOptionMode;
memberFuncMap_[INPUT_GET_NR_SSBID] = TestGetNrSsbId;
memberFuncMap_[INPUT_GET_RESIDENT_NETWORK_NUMERIC] = TestGetResidentNetworkNumeric;
memberFuncMap_[INPUT_GET_IMEISV] = TestGetImeiSv;
memberFuncMap_[INPUT_FACTORY_RESET] = TestFactoryReset;
}

View File

@ -32,7 +32,7 @@
#include "telephony_errors.h"
#include "telephony_log_wrapper.h"
#include "telephony_types.h"
#include "v1_2/iril.h"
#include "v1_3/iril.h"
namespace OHOS {
namespace Telephony {
@ -53,13 +53,13 @@ private:
class TelRilBase {
public:
TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
virtual ~TelRilBase() = default;
static std::shared_ptr<TelRilRequest> CreateTelRilRequest(
int32_t request, const AppExecFwk::InnerEvent::Pointer &result);
void ResetRilInterface(sptr<HDI::Ril::V1_2::IRil> rilInterface);
void ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface);
static std::shared_ptr<TelRilRequest> FindTelRilRequest(const HRilRadioResponseInfo &responseInfo);
int32_t ErrorResponse(std::shared_ptr<TelRilRequest> telRilRequest, const HRilRadioResponseInfo &responseInfo);
@ -91,7 +91,7 @@ protected:
protected:
std::shared_ptr<ObserverHandler> observerHandler_;
sptr<HDI::Ril::V1_2::IRil> rilInterface_;
sptr<HDI::Ril::V1_3::IRil> rilInterface_;
int32_t slotId_;
private:

View File

@ -23,7 +23,7 @@ namespace OHOS {
namespace Telephony {
class TelRilCall : public TelRilBase {
public:
TelRilCall(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilCall(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
~TelRilCall() = default;

View File

@ -16,13 +16,13 @@
#ifndef TEL_RIL_CALLBACK_H
#define TEL_RIL_CALLBACK_H
#include <v1_2/iril.h>
#include <v1_3/iril.h>
#include "tel_ril_manager.h"
namespace OHOS {
namespace Telephony {
class TelRilCallback : public HDI::Ril::V1_2::IRilCallback {
class TelRilCallback : public HDI::Ril::V1_3::IRilCallback {
public:
explicit TelRilCallback(std::shared_ptr<TelRilManager> telRilManager);
~TelRilCallback() = default;
@ -115,6 +115,8 @@ public:
int32_t SetRadioStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override;
int32_t GetRadioStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t state) override;
int32_t GetImeiResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imei) override;
int32_t GetImeiSvResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imeiSv) override;
int32_t GetMeidResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &meid) override;
int32_t GetVoiceRadioTechnologyResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology) override;

View File

@ -24,7 +24,7 @@ namespace OHOS {
namespace Telephony {
class TelRilData : public TelRilBase {
public:
TelRilData(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilData(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
~TelRilData() = default;

View File

@ -17,7 +17,7 @@
#define TEL_RIL_MANAGER_H
#include <singleton.h>
#include <v1_2/iril.h>
#include <v1_3/iril.h>
#include "hdf_service_status_listener.h"
#include "i_tel_ril_manager.h"
@ -125,6 +125,8 @@ public:
int32_t GetImei(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) override;
int32_t GetImeiSv(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) override;
int32_t GetMeid(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) override;
int32_t GetVoiceRadioTechnology(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response) override;
@ -363,7 +365,7 @@ private:
std::shared_ptr<TelRilHandler> handler_ = nullptr;
sptr<OHOS::HDI::ServiceManager::V1_0::IServiceManager> servMgr_ = nullptr;
sptr<HdfServiceStatusListener::IServStatListener> hdfListener_ = nullptr;
sptr<HDI::Ril::V1_2::IRil> rilInterface_ = nullptr;
sptr<HDI::Ril::V1_3::IRil> rilInterface_ = nullptr;
};
} // namespace Telephony
} // namespace OHOS

View File

@ -24,7 +24,7 @@ namespace OHOS {
namespace Telephony {
class TelRilModem : public TelRilBase {
public:
TelRilModem(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilModem(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
~TelRilModem() = default;
@ -38,10 +38,12 @@ public:
int32_t SetRadioState(int32_t fun, int32_t rst, const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetRadioState(const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetImei(const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetImeiSv(const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetMeid(const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetVoiceRadioTechnology(const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetBasebandVersion(const AppExecFwk::InnerEvent::Pointer &response);
int32_t GetImeiResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imei);
int32_t GetImeiSvResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imeiSv);
int32_t GetMeidResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &meid);
int32_t GetVoiceRadioTechnologyResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology);

View File

@ -23,7 +23,7 @@ namespace OHOS {
namespace Telephony {
class TelRilNetwork : public TelRilBase {
public:
TelRilNetwork(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilNetwork(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
~TelRilNetwork() = default;

View File

@ -24,7 +24,7 @@ namespace OHOS {
namespace Telephony {
class TelRilSim : public TelRilBase {
public:
TelRilSim(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface, std::shared_ptr<ObserverHandler> observerHandler,
TelRilSim(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface, std::shared_ptr<ObserverHandler> observerHandler,
std::shared_ptr<TelRilHandler> handler);
~TelRilSim() = default;

View File

@ -23,7 +23,7 @@ namespace OHOS {
namespace Telephony {
class TelRilSms : public TelRilBase {
public:
TelRilSms(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface, std::shared_ptr<ObserverHandler> observerHandler,
TelRilSms(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface, std::shared_ptr<ObserverHandler> observerHandler,
std::shared_ptr<TelRilHandler> handler);
~TelRilSms() = default;

View File

@ -24,14 +24,14 @@ std::unordered_map<int32_t, std::shared_ptr<TelRilRequest>> TelRilBase::requestM
std::mutex TelRilBase::requestLock_;
std::shared_ptr<TelRilHandler> TelRilBase::handler_;
TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: observerHandler_(observerHandler), rilInterface_(rilInterface), slotId_(slotId)
{
handler_ = handler;
}
void TelRilBase::ResetRilInterface(sptr<HDI::Ril::V1_2::IRil> rilInterface)
void TelRilBase::ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface)
{
rilInterface_ = rilInterface;
}

View File

@ -28,7 +28,7 @@ static const int32_t DTMF_ON_LENGTH = 150;
static const int32_t DTMF_OFF_LENGTH = 70;
static const int32_t DTMF_STRING_LENGTH = 1;
TelRilCall::TelRilCall(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilCall::TelRilCall(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: TelRilBase(slotId, rilInterface, observerHandler, handler)
{}

View File

@ -355,6 +355,12 @@ int32_t TelRilCallback::GetImeiResponse(
return Response(responseInfo, &TelRilManager::GetTelRilModem, &TelRilModem::GetImeiResponse, imei);
}
int32_t TelRilCallback::GetImeiSvResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imeiSv)
{
return Response(responseInfo, &TelRilManager::GetTelRilModem, &TelRilModem::GetImeiSvResponse, imeiSv);
}
int32_t TelRilCallback::GetMeidResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &meid)
{

View File

@ -23,7 +23,7 @@
namespace OHOS {
namespace Telephony {
TelRilData::TelRilData(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilData::TelRilData(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: TelRilBase(slotId, rilInterface, observerHandler, handler)
{}

View File

@ -60,12 +60,12 @@ bool TelRilManager::DeInit()
bool TelRilManager::ConnectRilInterface()
{
std::lock_guard<std::mutex> lock_l(mutex_);
rilInterface_ = HDI::Ril::V1_2::IRil::Get();
rilInterface_ = HDI::Ril::V1_3::IRil::Get();
if (rilInterface_ == nullptr) {
TELEPHONY_LOGE("TelRilManager not find RilInterfaceService");
return false;
}
rilInterface_->SetCallback1_2(new TelRilCallback(shared_from_this()));
rilInterface_->SetCallback1_3(new TelRilCallback(shared_from_this()));
return true;
}
@ -295,6 +295,11 @@ int32_t TelRilManager::GetImei(int32_t slotId, const AppExecFwk::InnerEvent::Poi
return TaskSchedule(response, "TelRilModem", GetTelRilModem(slotId), &TelRilModem::GetImei);
}
int32_t TelRilManager::GetImeiSv(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response)
{
return TaskSchedule(response, "TelRilModem", GetTelRilModem(slotId), &TelRilModem::GetImeiSv);
}
int32_t TelRilManager::GetMeid(int32_t slotId, const AppExecFwk::InnerEvent::Pointer &response)
{
return TaskSchedule(response, "TelRilModem", GetTelRilModem(slotId), &TelRilModem::GetMeid);

View File

@ -24,7 +24,7 @@
namespace OHOS {
namespace Telephony {
TelRilModem::TelRilModem(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilModem::TelRilModem(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: TelRilBase(slotId, rilInterface, observerHandler, handler)
{}
@ -73,6 +73,11 @@ int32_t TelRilModem::GetImei(const AppExecFwk::InnerEvent::Pointer &response)
return Request(TELEPHONY_LOG_FUNC_NAME, response, HREQ_MODEM_GET_IMEI, &HDI::Ril::V1_1::IRil::GetImei);
}
int32_t TelRilModem::GetImeiSv(const AppExecFwk::InnerEvent::Pointer &response)
{
return Request(TELEPHONY_LOG_FUNC_NAME, response, HREQ_MODEM_GET_IMEISV, &HDI::Ril::V1_3::IRil::GetImeiSv);
}
int32_t TelRilModem::GetMeid(const AppExecFwk::InnerEvent::Pointer &response)
{
return Request(TELEPHONY_LOG_FUNC_NAME, response, HREQ_MODEM_GET_MEID, &HDI::Ril::V1_1::IRil::GetMeid);
@ -100,6 +105,13 @@ int32_t TelRilModem::GetImeiResponse(const HDI::Ril::V1_1::RilRadioResponseInfo
return Response<HRilStringParcel>(TELEPHONY_LOG_FUNC_NAME, responseInfo, std::make_shared<HRilStringParcel>(imei));
}
int32_t TelRilModem::GetImeiSvResponse(
const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imeiSv)
{
return Response<HRilStringParcel>(
TELEPHONY_LOG_FUNC_NAME, responseInfo, std::make_shared<HRilStringParcel>(imeiSv));
}
int32_t TelRilModem::GetMeidResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &meid)
{
return Response<HRilStringParcel>(TELEPHONY_LOG_FUNC_NAME, responseInfo, std::make_shared<HRilStringParcel>(meid));

View File

@ -26,7 +26,7 @@ using OHOS::IRemoteObject;
using OHOS::sptr;
namespace OHOS {
namespace Telephony {
TelRilNetwork::TelRilNetwork(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilNetwork::TelRilNetwork(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: TelRilBase(slotId, rilInterface, observerHandler, handler)
{}

View File

@ -23,7 +23,7 @@
namespace OHOS {
namespace Telephony {
TelRilSim::TelRilSim(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilSim::TelRilSim(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: TelRilBase(slotId, rilInterface, observerHandler, handler)
{}

View File

@ -22,7 +22,7 @@
namespace OHOS {
namespace Telephony {
TelRilSms::TelRilSms(int32_t slotId, sptr<HDI::Ril::V1_2::IRil> rilInterface,
TelRilSms::TelRilSms(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler)
: TelRilBase(slotId, rilInterface, observerHandler, handler)
{}

13
services/tel_ril/test/tel_ril_test.cpp Executable file → Normal file
View File

@ -177,6 +177,7 @@ void TelRilTest::OnInitNetwork()
memberFuncMap_[DiffInterfaceId::TEST_GET_PREFERRED_NETWORK_TYPE] = &TelRilTest::OnRequestGetPreferredNetworkTest;
memberFuncMap_[DiffInterfaceId::TEST_SET_PREFERRED_NETWORK_TYPE] = &TelRilTest::OnRequestSetPreferredNetworkTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_IMEI] = &TelRilTest::OnRequestGetImeiTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_IMEISV] = &TelRilTest::OnRequestGetImeiSvTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_BASEBAND_VERSION] = &TelRilTest::OnRequestGetBasebandVersionTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_MEID] = &TelRilTest::OnRequestGetMeidTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_CS_REG_STATUS] = &TelRilTest::OnRequestGetCsRegStatusTest;
@ -1431,6 +1432,17 @@ void TelRilTest::OnRequestGetImeiTest(int32_t slotId, const std::shared_ptr<AppE
}
}
void TelRilTest::OnRequestGetImeiSvTest(int32_t slotId, const std::shared_ptr<AppExecFwk::EventHandler> &handler)
{
auto event = AppExecFwk::InnerEvent::Get(TYPESBITMAP);
if (event != nullptr && telRilManager_ != nullptr) {
event->SetOwner(handler);
TELEPHONY_LOGI("TelRilTest::OnRequestGetImeiSvTest -->");
telRilManager_->GetImeiSv(slotId, event);
TELEPHONY_LOGI("OnRequestGetImeiSvTest finished");
}
}
void TelRilTest::OnRequestGetBasebandVersionTest(int32_t slotId,
const std::shared_ptr<AppExecFwk::EventHandler> &handler)
{
@ -2144,6 +2156,7 @@ void Promote()
cout << static_cast<int32_t>(DiffInterfaceId::TEST_SET_POWER_STATE) << " --> OnRequestSetRadioStateTest" << endl;
cout << static_cast<int32_t>(DiffInterfaceId::TEST_GET_POWER_STATE) << " --> OnRequestGetRadioStateTest" << endl;
cout << static_cast<int32_t>(DiffInterfaceId::TEST_GET_IMEI) << "--> OnRequestGetImeiTest" << endl;
cout << static_cast<int32_t>(DiffInterfaceId::TEST_GET_IMEISV) << "--> OnRequestGetImeiSvTest" << endl;
cout << static_cast<int32_t>(DiffInterfaceId::TEST_GET_BASEBAND_VERSION) << "--> OnRequestGetBasebandVersionTest"
<< endl;
cout << static_cast<int32_t>(DiffInterfaceId::TEST_GET_MEID) << "--> OnRequestGetMeidTest" << endl;

View File

@ -113,6 +113,7 @@ enum class DiffInterfaceId {
TEST_GET_PREFERRED_NETWORK_TYPE,
TEST_SET_PREFERRED_NETWORK_TYPE,
TEST_GET_IMEI,
TEST_GET_IMEISV,
TEST_GET_BASEBAND_VERSION,
TEST_GET_MEID,
TEST_SET_CALL_PREFERENCE_MODE,

8
telephonyres/main/resources/base/element/string.json Executable file → Normal file
View File

@ -240,6 +240,14 @@
"name": "call_failed_imei_not_accepted",
"value": "IMSI unavailable, please insert a valid SIM card"
},
{
"name": "call_failed_imsiSv_unknow",
"value": "IMEISV unkown, please insert a valid SIM card"
},
{
"name": "call_failed_imeiSv_not_accepted",
"value": "IMSISV unavailable, please insert a valid SIM card"
},
{
"name": "call_failed_dial_modify_to_ussd",
"value": "Call modified to USSD request"

View File

@ -58,6 +58,7 @@ ohos_fuzztest("SendSmsMoreModeFuzzTest") {
"drivers_interface_ril:hril_innerkits",
"drivers_interface_ril:libril_proxy_1.1",
"drivers_interface_ril:libril_proxy_1.2",
"drivers_interface_ril:libril_proxy_1.3",
"eventhandler:libeventhandler",
"hdf_core:libhdi",
"hdf_core:libpub_utils",

View File

@ -50,7 +50,7 @@ void SendSmsMoreMode(const uint8_t *data, size_t size)
std::string address(reinterpret_cast<const char *>(data), size);
std::unique_ptr<uint8_t> object = std::make_unique<uint8_t>(*data);
AppExecFwk::InnerEvent::Pointer response = AppExecFwk::InnerEvent::Get(responseId, object);
auto rilInterface_ = HDI::Ril::V1_2::IRil::Get();
auto rilInterface_ = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilSms = std::make_shared<TelRilSms>(slotId, rilInterface_, observerHandler, nullptr);
telRilSms->SendSmsMoreMode(smscPdu, pdu, response);
@ -85,7 +85,7 @@ void GetCallList(const uint8_t *data, size_t size)
std::string newPassword(reinterpret_cast<const char *>(data), size);
std::unique_ptr<uint8_t> object = std::make_unique<uint8_t>(*data);
AppExecFwk::InnerEvent::Pointer result = AppExecFwk::InnerEvent::Get(resultId, object);
auto rilInterface_ = HDI::Ril::V1_2::IRil::Get();
auto rilInterface_ = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilCall = std::make_shared<TelRilCall>(slotId, rilInterface_, observerHandler, nullptr);
telRilCall->GetCallList(result);
@ -120,7 +120,7 @@ void AnswerResponse(const uint8_t *data, size_t size)
AppExecFwk::InnerEvent::Pointer result = AppExecFwk::InnerEvent::Get(resultId, object);
HDI::Ril::V1_1::RilRadioResponseInfo responseInfo;
responseInfo.slotId = slotId;
auto rilInterface_ = HDI::Ril::V1_2::IRil::Get();
auto rilInterface_ = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilCall = std::make_shared<TelRilCall>(slotId, rilInterface_, observerHandler, nullptr);
telRilCall->HoldCall(result);
@ -161,7 +161,7 @@ void DeactivatePdpContext(const uint8_t *data, size_t size)
dataProfile.userName = userName;
dataProfile.password = password;
dataProfile.roamingProtocol = roamingProtocol;
auto rilInterface_ = HDI::Ril::V1_2::IRil::Get();
auto rilInterface_ = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilData = std::make_shared<TelRilData>(slotId, rilInterface_, observerHandler, nullptr);
telRilData->DeactivatePdpContext(cid, reason, response);
@ -187,7 +187,7 @@ void SimStkProactiveNotify(const uint8_t *data, size_t size)
std::string response(reinterpret_cast<const char *>(data), size);
HDI::Ril::V1_1::RilRadioResponseInfo responseInfo;
responseInfo.slotId = slotId;
auto rilInterface_ = HDI::Ril::V1_2::IRil::Get();
auto rilInterface_ = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilSim = std::make_shared<TelRilSim>(slotId, rilInterface_, observerHandler, nullptr);
telRilSim->SimStkProactiveNotify(response);
@ -228,7 +228,7 @@ void GetSimStatus(const uint8_t *data, size_t size)
simIoInfo.aid = aid;
std::unique_ptr<uint8_t> object = std::make_unique<uint8_t>(*data);
AppExecFwk::InnerEvent::Pointer result = AppExecFwk::InnerEvent::Get(resultId, object);
auto rilInterface_ = HDI::Ril::V1_2::IRil::Get();
auto rilInterface_ = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilSim = std::make_shared<TelRilSim>(slotId, rilInterface_, observerHandler, nullptr);
telRilSim->GetSimStatus(result);

View File

@ -79,6 +79,21 @@ void GetImei(const uint8_t *data, size_t size)
DelayedSingleton<CoreService>::GetInstance()->OnGetImei(dataMessageParcel, reply);
}
void GetImeiSv(const uint8_t *data, size_t size)
{
if (!IsServiceInited()) {
return;
}
int32_t slotId = static_cast<int32_t>(size % SLOT_NUM);
MessageParcel dataMessageParcel;
dataMessageParcel.WriteInt32(slotId);
dataMessageParcel.WriteBuffer(data, size);
dataMessageParcel.RewindRead(0);
MessageParcel reply;
DelayedSingleton<CoreService>::GetInstance()->OnGetImeiSv(dataMessageParcel, reply);
}
void GetSimOperatorNumeric(const uint8_t *data, size_t size)
{
if (!IsServiceInited()) {
@ -133,6 +148,7 @@ void DoSomethingInterestingWithMyAPI(const uint8_t *data, size_t size)
GetNetworkState(data, size);
GetImei(data, size);
GetImeiSv(data, size);
GetNetworkState(data, size);
GetISOCountryCodeForSim(data, size);
SendTerminalResponseCmd(data, size);

View File

@ -1621,6 +1621,63 @@ HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_GetImei_0300, Function | Med
EXPECT_EQ(ret, TELEPHONY_ERR_PERMISSION_ERR);
}
/**
* @tc.number Telephony_NetworkSearch_GetImeiSv_0100
* @tc.name Get ImeiSv
* @tc.desc Function test
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_GetImeiSv_0100, Function | MediumTest | Level2)
{
AccessToken token;
if (NetworkSearchTest::telephonyService_ == nullptr || !(NetworkSearchTest::HasSimCard(SLOT_ID))) {
TELEPHONY_LOGI("TelephonyTestService Remote service is null");
NetworkSearchTest::telephonyService_ = GetProxy();
} else {
std::u16string result = u"";
int32_t ret = CoreServiceClient::GetInstance().GetImeiSv(SLOT_ID, result);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
std::string imei = Str16ToStr8(result);
EXPECT_STRNE(imei.c_str(), "");
}
}
/**
* @tc.number Telephony_NetworkSearch_GetImeiSv_0200
* @tc.name Get ImeiSv
* @tc.desc Function test
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_GetImeiSv_0200, Function | MediumTest | Level2)
{
AccessToken token;
if (NetworkSearchTest::telephonyService_ == nullptr || !(NetworkSearchTest::HasSimCard(SLOT_ID1))) {
TELEPHONY_LOGI("TelephonyTestService Remote service is null");
NetworkSearchTest::telephonyService_ = GetProxy();
} else {
std::u16string result = u"";
int32_t ret = CoreServiceClient::GetInstance().GetImeiSv(SLOT_ID1, result);
EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
std::string imei = Str16ToStr8(result);
EXPECT_STRNE(imei.c_str(), "");
}
}
/**
* @tc.number Telephony_NetworkSearch_GetImeiSv_0300
* @tc.name Get ImeiSv without permission
* @tc.desc Function test
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_GetImeiSv_0300, Function | MediumTest | Level2)
{
if (NetworkSearchTest::telephonyService_ == nullptr || !(NetworkSearchTest::HasSimCard(SLOT_ID))) {
TELEPHONY_LOGI("TelephonyTestService Remote service is null");
NetworkSearchTest::telephonyService_ = GetProxy();
return;
}
std::u16string result = u"";
int32_t ret = CoreServiceClient::GetInstance().GetImeiSv(SLOT_ID, result);
EXPECT_EQ(ret, TELEPHONY_ERR_PERMISSION_ERR);
}
/**
* @tc.number Telephony_NetworkSearch_GetMeid_0100
* @tc.name Get Meid

View File

@ -46,6 +46,7 @@ HWTEST_F(SimTest, Telephony_Sim_CoreService_0100, Function | MediumTest | Level3
mCoreService->SetRadioState(0, true, callback);
std::u16string testU16Str = u"";
EXPECT_NE(mCoreService->GetImei(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetImeiSv(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetMeid(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetUniqueDeviceId(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetNrOptionMode(0, callback), TELEPHONY_ERR_SUCCESS);
@ -192,6 +193,7 @@ HWTEST_F(SimTest, Telephony_Sim_CoreService_0400, Function | MediumTest | Level3
mCoreService->SetRadioState(0, true, callback);
std::u16string testU16Str = u"";
EXPECT_NE(mCoreService->GetImei(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetImeiSv(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetMeid(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetUniqueDeviceId(0, testU16Str), TELEPHONY_ERR_SUCCESS);
EXPECT_NE(mCoreService->GetNrOptionMode(0, callback), TELEPHONY_ERR_SUCCESS);

View File

@ -974,6 +974,8 @@ HWTEST_F(BranchTest, Telephony_CoreManagerInner_003, Function | MediumTest | Lev
std::u16string result = u"";
EXPECT_NE(mInner.GetImei(0, result), TELEPHONY_ERR_SUCCESS);
EXPECT_EQ(result, std::u16string());
EXPECT_NE(mInner.GetImeiSv(0, result), TELEPHONY_ERR_SUCCESS);
EXPECT_EQ(result, std::u16string());
EXPECT_NE(mInner.GetMeid(0, result), TELEPHONY_ERR_SUCCESS);
EXPECT_EQ(result, std::u16string());
EXPECT_NE(mInner.GetUniqueDeviceId(0, result), TELEPHONY_ERR_SUCCESS);
@ -1941,6 +1943,8 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_001, Function | MediumTest |
EXPECT_EQ(result, testStr);
EXPECT_NE(networkSearchManager->GetImei(INVALID_SLOTID, result), TELEPHONY_ERR_SUCCESS);
EXPECT_EQ(result, testStr);
EXPECT_NE(networkSearchManager->GetImeiSv(INVALID_SLOTID, result), TELEPHONY_ERR_SUCCESS);
EXPECT_EQ(result, testStr);
EXPECT_EQ(networkSearchManager->GetImsRegStatus(INVALID_SLOTID, ImsServiceType::TYPE_SMS, info),
TELEPHONY_ERR_LOCAL_PTR_NULL);
EXPECT_NE(networkSearchManager->GetUniqueDeviceId(INVALID_SLOTID, result), TELEPHONY_ERR_SUCCESS);
@ -1970,6 +1974,7 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_002, Function | MediumTest |
inner->networkSearchHandler_ = networkSearchHandler;
std::string bundleName = "qwe";
std::u16string imei = u"";
std::u16string imeiSv = u"";
sptr<ImsRegInfoCallback> callback = nullptr;
networkSearchManager->SetLocateUpdate(INVALID_SLOTID);
networkSearchManager->GetVoiceTech(INVALID_SLOTID);
@ -1989,6 +1994,7 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchManager_002, Function | MediumTest |
networkSearchManager->SetRadioStateValue(INVALID_SLOTID, ModemPowerState::CORE_SERVICE_POWER_NOT_AVAILABLE);
networkSearchManager->SetNetworkSelectionValue(INVALID_SLOTID, SelectionMode::MODE_TYPE_UNKNOWN);
networkSearchManager->SetImei(INVALID_SLOTID, imei);
networkSearchManager->SetImeiSv(INVALID_SLOTID, imeiSv);
networkSearchManager->UpdateCellLocation(INVALID_SLOTID, 1, 1, 1);
networkSearchManager->SetMeid(INVALID_SLOTID, imei);
networkSearchManager->SetFrequencyType(INVALID_SLOTID, FrequencyType::FREQ_TYPE_MMWAVE);
@ -2246,6 +2252,7 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchHandler_001, Function | MediumTest |
networkSearchHandler->GetPreferredNetworkResponse(event);
networkSearchHandler->SetPreferredNetworkResponse(event);
networkSearchHandler->RadioGetImei(event);
networkSearchHandler->RadioGetImeiSv(event);
networkSearchHandler->RadioGetMeid(event);
event = nullptr;
networkSearchHandler->ProcessEvent(event);
@ -2347,6 +2354,7 @@ HWTEST_F(BranchTest, Telephony_NetworkSearchHandler_003, Function | MediumTest |
networkSearchHandler->HandleDelayNotifyEvent(event);
networkSearchHandler->NetworkSearchResult(event);
networkSearchHandler->RadioGetNeighboringCellInfo(event);
networkSearchHandler->RadioGetImeiSv(event);
EXPECT_EQ(networkSearchHandler->GetRegServiceState(regState), TELEPHONY_ERR_LOCAL_PTR_NULL);
EXPECT_EQ(networkSearchHandler->HandleRrcStateChanged(status), TELEPHONY_ERR_LOCAL_PTR_NULL);
EXPECT_EQ(networkSearchHandler->RevertLastTechnology(), TELEPHONY_ERR_LOCAL_PTR_NULL);

View File

@ -146,6 +146,7 @@ HWTEST_F(CoreServiceBranchTest, Telephony_CoreService_NetWork_002, Function | Me
std::u16string u16Ret = u"";
DelayedSingleton<CoreService>::GetInstance()->GetIsoCountryCodeForNetwork(SLOT_ID, u16Ret);
DelayedSingleton<CoreService>::GetInstance()->GetImei(SLOT_ID, u16Ret);
DelayedSingleton<CoreService>::GetInstance()->GetImeiSv(SLOT_ID, u16Ret);
DelayedSingleton<CoreService>::GetInstance()->GetMeid(SLOT_ID, u16Ret);
DelayedSingleton<CoreService>::GetInstance()->GetUniqueDeviceId(SLOT_ID, u16Ret);
DelayedSingleton<CoreService>::GetInstance()->IsNrSupported(SLOT_ID);

View File

@ -54,6 +54,7 @@ ohos_unittest("tel_ril_gtest") {
"drivers_interface_ril:hril_innerkits",
"drivers_interface_ril:libril_proxy_1.1",
"drivers_interface_ril:libril_proxy_1.2",
"drivers_interface_ril:libril_proxy_1.3",
"drivers_interface_ril:ril_idl_headers",
"eventhandler:libeventhandler",
"hdf_core:libhdi",

View File

@ -259,6 +259,28 @@ HWTEST_F(TelRilTest, Telephony_TelRil_GetImeiTest_0201, Function | MediumTest |
return;
}
/**
* @tc.number Telephony_TelRil_GetImeiSvTest_0101 to do ...
* @tc.name Get ImeiSv information of the card 1
* @tc.desc Function test
*/
HWTEST_F(TelRilTest, Telephony_TelRil_GetImeiSvTest_0101, Function | MediumTest | Level3)
{
ASSERT_TRUE(ProcessTest(static_cast<int32_t>(DiffInterfaceId::TEST_GET_IMEISV), SLOT_ID_0, GetHandler()));
return;
}
/**
* @tc.number Telephony_TelRil_GetImeiSvTest_0201 to do ...
* @tc.name Get ImeiSv information of the card 2
* @tc.desc Function test
*/
HWTEST_F(TelRilTest, Telephony_TelRil_GetImeiSvTest_0201, Function | MediumTest | Level3)
{
ASSERT_TRUE(ProcessTest(static_cast<int32_t>(DiffInterfaceId::TEST_GET_IMEISV), SLOT_ID_1, GetHandler()));
return;
}
/**
* @tc.number Telephony_TelRil_GetMeidTest_0101 to do ...
* @tc.name Get Meid information of the card 1

20
test/unittest/tel_ril_gtest/tel_ril_test_util.cpp Executable file → Normal file
View File

@ -273,6 +273,7 @@ void TelRilTest::InitNetwork()
memberFuncMap_[DiffInterfaceId::TEST_GET_PREFERRED_NETWORK_TYPE] = &TelRilTest::GetPreferredNetworkParaTest;
memberFuncMap_[DiffInterfaceId::TEST_SET_PREFERRED_NETWORK_TYPE] = &TelRilTest::SetPreferredNetworkParaTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_IMEI] = &TelRilTest::GetImeiTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_IMEISV] = &TelRilTest::GetImeiSvTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_MEID] = &TelRilTest::GetMeidTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_VOICE_RADIO_INFO] = &TelRilTest::GetVoiceRadioTechnologyTest;
memberFuncMap_[DiffInterfaceId::TEST_GET_PHYSICAL_CHANNEL_CONFIG] = &TelRilTest::GetPhysicalChannelConfigTest;
@ -1675,6 +1676,25 @@ void TelRilTest::GetImeiTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHa
}
}
/**
* @brief Get IMEISV
*
* @param handler
*/
void TelRilTest::GetImeiSvTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler)
{
int32_t eventId = static_cast<int32_t>(DiffInterfaceId::TEST_GET_IMEISV);
auto event = AppExecFwk::InnerEvent::Get(eventId);
if (event != nullptr && telRilManager_ != nullptr) {
event->SetOwner(handler);
TELEPHONY_LOGI("TelRilTest::GetImeisVTest -->");
telRilManager_->GetImeiSv(slotId, event);
TELEPHONY_LOGI("TelRilTest::GetImeiSvTest --> finished");
bool syncResult = WaitGetResult(eventId, handler, WAIT_TIME_SECOND);
ASSERT_TRUE(syncResult);
}
}
/**
* @brief Get MEID
*

2
test/unittest/tel_ril_gtest/tel_ril_test_util.h Executable file → Normal file
View File

@ -113,6 +113,7 @@ enum class DiffInterfaceId {
TEST_GET_PREFERRED_NETWORK_TYPE,
TEST_SET_PREFERRED_NETWORK_TYPE,
TEST_GET_IMEI,
TEST_GET_IMEISV,
TEST_GET_MEID,
TEST_GET_RADIO_PROTOCOL,
TEST_SET_RADIO_PROTOCOL,
@ -267,6 +268,7 @@ private:
void SetPreferredNetworkParaTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);
void GetPreferredNetworkParaTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);
void GetImeiTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);
void GetImeiSvTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);
void GetMeidTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);
void GetVoiceRadioTechnologyTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);
void GetPhysicalChannelConfigTest(int32_t slotId, std::shared_ptr<AppExecFwk::EventHandler> handler);

View File

@ -107,7 +107,7 @@ HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Callback_001, Function | MediumTest
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Base_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Base_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilBase = std::make_shared<TelRilBase>(SLOT_ID, rilInterface, observerHandler, nullptr);
AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(1, 1);
@ -151,7 +151,7 @@ HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Base_001, Function | MediumTest | L
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Network_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Network_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilNetwork = std::make_shared<TelRilNetwork>(SLOT_ID, rilInterface, observerHandler, nullptr);
@ -182,7 +182,7 @@ HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Network_001, Function | MediumTest
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Sms_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Sms_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilSms = std::make_shared<TelRilSms>(SLOT_ID, rilInterface, observerHandler, nullptr);
@ -251,7 +251,7 @@ HWTEST_F(TelRilBranchTest, Telephony_observerhandler_001, Function | MediumTest
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Modem_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Modem_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilModem = std::make_shared<TelRilModem>(SLOT_ID, rilInterface, observerHandler, nullptr);
HDI::Ril::V1_1::VoiceRadioTechnology voiceRadioTechnology;
@ -268,7 +268,7 @@ HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Modem_001, Function | MediumTest |
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Data_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Data_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilData = std::make_shared<TelRilData>(SLOT_ID, rilInterface, observerHandler, nullptr);
HDI::Ril::V1_1::DataCallResultList iDataCallResultList;
@ -289,7 +289,7 @@ HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Data_001, Function | MediumTest | L
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Sim_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Sim_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilSim = std::make_shared<TelRilSim>(SLOT_ID, rilInterface, observerHandler, nullptr);
@ -326,7 +326,7 @@ HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Sim_001, Function | MediumTest | Le
HWTEST_F(TelRilBranchTest, Telephony_tel_ril_Call_001, Function | MediumTest | Level1)
{
TELEPHONY_LOGI("Telephony_tel_ril_Call_001 entry");
auto rilInterface = HDI::Ril::V1_2::IRil::Get();
auto rilInterface = HDI::Ril::V1_3::IRil::Get();
std::shared_ptr<ObserverHandler> observerHandler = std::make_shared<ObserverHandler>();
auto telRilCall = std::make_shared<TelRilCall>(SLOT_ID, rilInterface, observerHandler, nullptr);