mirror of
https://gitee.com/openharmony/telephony_cellular_data
synced 2024-11-23 07:49:51 +00:00
!592 updataNetworkInfo in event handler
Merge pull request !592 from 罗堡文/master
This commit is contained in:
commit
830aa3d65e
@ -74,6 +74,7 @@ public:
|
||||
void RegisterDataSettingObserver();
|
||||
void UnRegisterDataSettingObserver();
|
||||
int32_t GetIntelligenceSwitchState(bool &switchState);
|
||||
void HandleUpdateNetInfo(const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
private:
|
||||
std::shared_ptr<CellularDataStateMachine> CreateCellularDataConnect();
|
||||
@ -204,6 +205,7 @@ private:
|
||||
{ RadioEvent::RADIO_RIL_ADAPTER_HOST_DIED, &CellularDataHandler::OnRilAdapterHostDied },
|
||||
{ RadioEvent::RADIO_FACTORY_RESET, &CellularDataHandler::HandleFactoryReset },
|
||||
{ RadioEvent::RADIO_CLEAN_ALL_DATA_CONNECTIONS, &CellularDataHandler::OnCleanAllDataConnectionsDone },
|
||||
{ CellularDataEventCode::MSG_DATA_CALL_LIST_CHANGED, &CellularDataHandler::HandleUpdateNetInfo },
|
||||
};
|
||||
};
|
||||
} // namespace Telephony
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
static const uint32_t MSG_SM_INCALL_DATA_DSDS_CHANGED = BASE + 39;
|
||||
static const uint32_t MSG_INCALL_DATA_COMPLETE = BASE + 40;
|
||||
static const uint32_t MSG_SM_RIL_ADAPTER_HOST_DIED = BASE + 41;
|
||||
static const uint32_t MSG_DATA_CALL_LIST_CHANGED = BASE + 42;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
void SetConnectionBandwidth(const uint32_t upBandwidth, const uint32_t downBandwidth);
|
||||
void SetConnectionTcpBuffer(const std::string &tcpBuffer);
|
||||
void SplitProxyIpAddress(const std::string &proxyIpAddress, std::string &host, uint16_t &port);
|
||||
bool UpdateNetworkInfoInHandler(SetupDataCallResultInfo &info);
|
||||
|
||||
protected:
|
||||
sptr<State> activeState_;
|
||||
|
@ -2092,6 +2092,28 @@ std::shared_ptr<CellularDataStateMachine> CellularDataHandler::CheckForCompatibl
|
||||
return potentialDc;
|
||||
}
|
||||
|
||||
void CellularDataHandler::HandleUpdateNetInfo(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
TELEPHONY_LOGI("Slot%{public}d: receive HandleUpdateNetInfo event", slotId_);
|
||||
std::shared_ptr<SetupDataCallResultInfo> info = event->GetSharedObject<SetupDataCallResultInfo>();
|
||||
if (connectionManager_ == nullptr) {
|
||||
TELEPHONY_LOGE("Slot%{public}d: connectionManager is null", slotId_);
|
||||
return;
|
||||
}
|
||||
|
||||
if (info == nullptr) {
|
||||
TELEPHONY_LOGE("Info is null");
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<CellularDataStateMachine> dataConnect = connectionManager_->GetActiveConnectionByCid(info->cid);
|
||||
if (dataConnect == nullptr) {
|
||||
TELEPHONY_LOGE("get active connection by cid is := %{public}d flag:= %{public}d ", info->cid, info->flag);
|
||||
return;
|
||||
}
|
||||
dataConnect->UpdateNetworkInfo(*info);
|
||||
}
|
||||
|
||||
bool CellularDataHandler::IsGsm()
|
||||
{
|
||||
bool isGsm = false;
|
||||
|
@ -278,7 +278,10 @@ void CcmDefaultState::UpdateNetworkInfo(const AppExecFwk::InnerEvent::Pointer &e
|
||||
TELEPHONY_LOGE("get active connection by cid is := %{public}d flag:= %{public}d ", it.cid, it.flag);
|
||||
continue;
|
||||
}
|
||||
dataConnect->UpdateNetworkInfo(it);
|
||||
if (!dataConnect->UpdateNetworkInfoInHandler(it)) {
|
||||
TELEPHONY_LOGW("Update in handler failed cid %{public}d flag %{public}d ", it.cid, it.flag);
|
||||
dataConnect->UpdateNetworkInfo(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,5 +427,15 @@ void CellularDataStateMachine::SetConnectionTcpBuffer(const std::string &tcpBuff
|
||||
{
|
||||
tcpBuffer_ = tcpBuffer;
|
||||
}
|
||||
|
||||
bool CellularDataStateMachine::UpdateNetworkInfoInHandler(SetupDataCallResultInfo &info)
|
||||
{
|
||||
if (!cellularDataHandler_) {
|
||||
TELEPHONY_LOGE("cellularDataHandler is null!");
|
||||
return false;
|
||||
}
|
||||
auto netInfo = std::make_shared<SetupDataCallResultInfo>(info);
|
||||
return cellularDataHandler_->SendEvent(CellularDataEventCode::MSG_DATA_CALL_LIST_CHANGED, netInfo);
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user