mirror of
https://gitee.com/openharmony/telephony_core_service
synced 2024-11-23 08:00:07 +00:00
commit
5927c2cf9e
@ -57,6 +57,7 @@ public:
|
|||||||
|
|
||||||
static std::shared_ptr<TelRilRequest> CreateTelRilRequest(const AppExecFwk::InnerEvent::Pointer &result);
|
static std::shared_ptr<TelRilRequest> CreateTelRilRequest(const AppExecFwk::InnerEvent::Pointer &result);
|
||||||
void ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface);
|
void ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface);
|
||||||
|
sptr<HDI::Ril::V1_3::IRil> GetRilInterface();
|
||||||
static std::shared_ptr<TelRilRequest> FindTelRilRequest(const RadioResponseInfo &responseInfo);
|
static std::shared_ptr<TelRilRequest> FindTelRilRequest(const RadioResponseInfo &responseInfo);
|
||||||
int32_t ErrorResponse(std::shared_ptr<TelRilRequest> telRilRequest, const RadioResponseInfo &responseInfo);
|
int32_t ErrorResponse(std::shared_ptr<TelRilRequest> telRilRequest, const RadioResponseInfo &responseInfo);
|
||||||
|
|
||||||
@ -114,7 +115,8 @@ template<typename FuncType, typename... ParamTypes>
|
|||||||
inline int32_t TelRilBase::Request(const char *funcName, const AppExecFwk::InnerEvent::Pointer &response,
|
inline int32_t TelRilBase::Request(const char *funcName, const AppExecFwk::InnerEvent::Pointer &response,
|
||||||
FuncType &&_func, ParamTypes &&... _args)
|
FuncType &&_func, ParamTypes &&... _args)
|
||||||
{
|
{
|
||||||
if (rilInterface_ == nullptr) {
|
sptr<HDI::Ril::V1_3::IRil> rilInterface = GetRilInterface();
|
||||||
|
if (rilInterface == nullptr) {
|
||||||
TELEPHONY_LOGE("%{public}s() rilInterface_ is null", funcName);
|
TELEPHONY_LOGE("%{public}s() rilInterface_ is null", funcName);
|
||||||
return TELEPHONY_ERR_LOCAL_PTR_NULL;
|
return TELEPHONY_ERR_LOCAL_PTR_NULL;
|
||||||
}
|
}
|
||||||
@ -123,7 +125,7 @@ inline int32_t TelRilBase::Request(const char *funcName, const AppExecFwk::Inner
|
|||||||
TELEPHONY_LOGE("%{public}s() telRilRequest is null", funcName);
|
TELEPHONY_LOGE("%{public}s() telRilRequest is null", funcName);
|
||||||
return TELEPHONY_ERR_LOCAL_PTR_NULL;
|
return TELEPHONY_ERR_LOCAL_PTR_NULL;
|
||||||
}
|
}
|
||||||
return (rilInterface_->*(_func))(slotId_, telRilRequest->serialId_, std::forward<ParamTypes>(_args)...);
|
return (rilInterface->*(_func))(slotId_, telRilRequest->serialId_, std::forward<ParamTypes>(_args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32_t TelRilBase::Response(const char *funcName, const HDI::Ril::V1_1::RilRadioResponseInfo &iResponseInfo)
|
inline int32_t TelRilBase::Response(const char *funcName, const HDI::Ril::V1_1::RilRadioResponseInfo &iResponseInfo)
|
||||||
|
@ -22,6 +22,7 @@ namespace Telephony {
|
|||||||
std::atomic_int TelRilBase::nextSerialId_(1);
|
std::atomic_int TelRilBase::nextSerialId_(1);
|
||||||
std::unordered_map<int32_t, std::shared_ptr<TelRilRequest>> TelRilBase::requestMap_;
|
std::unordered_map<int32_t, std::shared_ptr<TelRilRequest>> TelRilBase::requestMap_;
|
||||||
std::mutex TelRilBase::requestLock_;
|
std::mutex TelRilBase::requestLock_;
|
||||||
|
std::mutex dealLock_;
|
||||||
std::shared_ptr<TelRilHandler> TelRilBase::handler_;
|
std::shared_ptr<TelRilHandler> TelRilBase::handler_;
|
||||||
|
|
||||||
TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
|
TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
|
||||||
@ -33,9 +34,16 @@ TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
|
|||||||
|
|
||||||
void TelRilBase::ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface)
|
void TelRilBase::ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(dealLock_);
|
||||||
rilInterface_ = rilInterface;
|
rilInterface_ = rilInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sptr<HDI::Ril::V1_3::IRil> TelRilBase::GetRilInterface()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(dealLock_);
|
||||||
|
return rilInterface_;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<TelRilRequest> TelRilBase::CreateTelRilRequest(const AppExecFwk::InnerEvent::Pointer &result)
|
std::shared_ptr<TelRilRequest> TelRilBase::CreateTelRilRequest(const AppExecFwk::InnerEvent::Pointer &result)
|
||||||
{
|
{
|
||||||
std::shared_ptr<TelRilRequest> telRilRequest = std::make_shared<TelRilRequest>(GetNextSerialId(), result);
|
std::shared_ptr<TelRilRequest> telRilRequest = std::make_shared<TelRilRequest>(GetNextSerialId(), result);
|
||||||
@ -83,7 +91,7 @@ std::shared_ptr<TelRilRequest> TelRilBase::FindTelRilRequest(const RadioResponse
|
|||||||
|
|
||||||
int32_t TelRilBase::GetSerialId(const AppExecFwk::InnerEvent::Pointer &response)
|
int32_t TelRilBase::GetSerialId(const AppExecFwk::InnerEvent::Pointer &response)
|
||||||
{
|
{
|
||||||
if (rilInterface_ == nullptr) {
|
if (GetRilInterface() == nullptr) {
|
||||||
TELEPHONY_LOGE("ERROR : rilInterface_ == nullptr !!!");
|
TELEPHONY_LOGE("ERROR : rilInterface_ == nullptr !!!");
|
||||||
return -TELEPHONY_ERR_ARGUMENT_INVALID;
|
return -TELEPHONY_ERR_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user