1 /*
2 * Copyright (C) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "data_connection_manager.h"
17
18 #include "cellular_data_event_code.h"
19 #include "cellular_data_handler.h"
20 #include "cellular_data_state_machine.h"
21 #include "cellular_data_utils.h"
22 #include "core_manager_inner.h"
23 #include "tel_ril_data_parcel.h"
24 #include "operator_config_types.h"
25 #include "radio_event.h"
26 #include "telephony_log_wrapper.h"
27 #include "networkslice_client.h"
28 #include "singleton.h"
29
30 namespace OHOS {
31 namespace Telephony {
DataConnectionManager(int32_t slotId)32 DataConnectionManager::DataConnectionManager(int32_t slotId) : StateMachine("DataConnectionManager"), slotId_(slotId)
33 {
34 connectionMonitor_ = std::make_shared<DataConnectionMonitor>(slotId);
35 if (connectionMonitor_ == nullptr) {
36 TELEPHONY_LOGE("Slot%{public}d: connectionMonitor_ is null", slotId_);
37 return;
38 }
39 }
40
~DataConnectionManager()41 DataConnectionManager::~DataConnectionManager()
42 {
43 if (connectionMonitor_ != nullptr) {
44 connectionMonitor_->RemoveAllEvents();
45 }
46 }
47
Init()48 void DataConnectionManager::Init()
49 {
50 ccmDefaultState_ = std::make_unique<CcmDefaultState>(*this, "CcmDefaultState").release();
51 if (ccmDefaultState_ == nullptr) {
52 TELEPHONY_LOGE("Slot%{public}d: ccmDefaultState_ is null", slotId_);
53 return;
54 }
55 StateMachine::SetOriginalState(ccmDefaultState_);
56 StateMachine::Start();
57 }
58
AddConnectionStateMachine(const std::shared_ptr<CellularDataStateMachine> & stateMachine)59 void DataConnectionManager::AddConnectionStateMachine(const std::shared_ptr<CellularDataStateMachine> &stateMachine)
60 {
61 std::lock_guard<std::mutex> lock(stateMachineMutex_);
62 if (stateMachine != nullptr) {
63 stateMachines_.push_back(stateMachine);
64 }
65 }
66
RemoveConnectionStateMachine(const std::shared_ptr<CellularDataStateMachine> & stateMachine)67 void DataConnectionManager::RemoveConnectionStateMachine(const std::shared_ptr<CellularDataStateMachine> &stateMachine)
68 {
69 if (stateMachine == nullptr) {
70 TELEPHONY_LOGE("Slot%{public}d: stateMachine is null", slotId_);
71 return;
72 }
73 std::lock_guard<std::mutex> lock(stateMachineMutex_);
74 for (std::vector<std::shared_ptr<CellularDataStateMachine>>::const_iterator iter =
75 stateMachines_.begin(); iter != stateMachines_.end(); iter++) {
76 if (*iter.base() == stateMachine) {
77 stateMachines_.erase(iter);
78 break;
79 }
80 }
81 }
82
GetAllConnectionMachine()83 std::vector<std::shared_ptr<CellularDataStateMachine>> DataConnectionManager::GetAllConnectionMachine()
84 {
85 std::lock_guard<std::mutex> lock(stateMachineMutex_);
86 return stateMachines_;
87 }
88
AddActiveConnectionByCid(const std::shared_ptr<CellularDataStateMachine> & stateMachine)89 void DataConnectionManager::AddActiveConnectionByCid(const std::shared_ptr<CellularDataStateMachine> &stateMachine)
90 {
91 std::lock_guard<std::mutex> lock(activeConnectionMutex_);
92 if (stateMachine != nullptr) {
93 cidActiveConnectionMap_[stateMachine->GetCid()] = stateMachine;
94 }
95 }
96
GetActiveConnectionByCid(int32_t cid)97 std::shared_ptr<CellularDataStateMachine> DataConnectionManager::GetActiveConnectionByCid(int32_t cid)
98 {
99 std::lock_guard<std::mutex> lock(activeConnectionMutex_);
100 std::map<int32_t, std::shared_ptr<CellularDataStateMachine>>::const_iterator it = cidActiveConnectionMap_.find(cid);
101 if (it != cidActiveConnectionMap_.end()) {
102 return it->second;
103 }
104 return nullptr;
105 }
106
GetActiveConnection()107 std::map<int32_t, std::shared_ptr<CellularDataStateMachine>> DataConnectionManager::GetActiveConnection()
108 {
109 std::lock_guard<std::mutex> lock(activeConnectionMutex_);
110 return cidActiveConnectionMap_;
111 }
112
IsBandwidthSourceModem() const113 bool DataConnectionManager::IsBandwidthSourceModem() const
114 {
115 return bandwidthSourceModem_;
116 }
117
isNoActiveConnection()118 bool DataConnectionManager::isNoActiveConnection()
119 {
120 std::lock_guard<std::mutex> lock(activeConnectionMutex_);
121 if (cidActiveConnectionMap_.empty()) {
122 return true;
123 }
124 return false;
125 }
126
RemoveActiveConnectionByCid(int32_t cid)127 void DataConnectionManager::RemoveActiveConnectionByCid(int32_t cid)
128 {
129 std::lock_guard<std::mutex> lock(activeConnectionMutex_);
130 if (cidActiveConnectionMap_.find(cid) != cidActiveConnectionMap_.end()) {
131 cidActiveConnectionMap_.erase(cid);
132 }
133 }
134
StartStallDetectionTimer()135 void DataConnectionManager::StartStallDetectionTimer()
136 {
137 if (connectionMonitor_ != nullptr) {
138 connectionMonitor_->StartStallDetectionTimer();
139 }
140 }
141
StopStallDetectionTimer()142 void DataConnectionManager::StopStallDetectionTimer()
143 {
144 if (connectionMonitor_ != nullptr) {
145 connectionMonitor_->StopStallDetectionTimer();
146 }
147 }
148
RegisterRadioObserver()149 void DataConnectionManager::RegisterRadioObserver()
150 {
151 if (stateMachineEventHandler_ == nullptr) {
152 TELEPHONY_LOGE("stateMachineEventHandler_ is nullptr!");
153 return;
154 }
155 CoreManagerInner &coreInner = CoreManagerInner::GetInstance();
156 coreInner.RegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_CONNECTED, nullptr);
157 coreInner.RegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_DATA_CALL_LIST_CHANGED, nullptr);
158 coreInner.RegisterCoreNotify(
159 slotId_, stateMachineEventHandler_, RadioEvent::RADIO_LINK_CAPABILITY_CHANGED, nullptr);
160 coreInner.RegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_NETWORKSLICE_URSP_RPT, nullptr);
161 coreInner.RegisterCoreNotify(slotId_, stateMachineEventHandler_,
162 RadioEvent::RADIO_NETWORKSLICE_ALLOWEDNSSAI_RPT, nullptr);
163 coreInner.RegisterCoreNotify(slotId_, stateMachineEventHandler_,
164 RadioEvent::RADIO_NETWORKSLICE_EHPLMN_RPT, nullptr);
165 }
166
UnRegisterRadioObserver() const167 void DataConnectionManager::UnRegisterRadioObserver() const
168 {
169 if (stateMachineEventHandler_ == nullptr) {
170 TELEPHONY_LOGE("stateMachineEventHandler_ is nullptr!");
171 return;
172 }
173 CoreManagerInner &coreInner = CoreManagerInner::GetInstance();
174 coreInner.UnRegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_CONNECTED);
175 coreInner.UnRegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_DATA_CALL_LIST_CHANGED);
176 coreInner.UnRegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_LINK_CAPABILITY_CHANGED);
177 coreInner.UnRegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_NETWORKSLICE_URSP_RPT);
178 coreInner.UnRegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_NETWORKSLICE_ALLOWEDNSSAI_RPT);
179 coreInner.UnRegisterCoreNotify(slotId_, stateMachineEventHandler_, RadioEvent::RADIO_NETWORKSLICE_EHPLMN_RPT);
180 }
181
StateBegin()182 void CcmDefaultState::StateBegin()
183 {
184 connectManager_.RegisterRadioObserver();
185 }
186
StateEnd()187 void CcmDefaultState::StateEnd()
188 {
189 connectManager_.UnRegisterRadioObserver();
190 }
191
StateProcess(const AppExecFwk::InnerEvent::Pointer & event)192 bool CcmDefaultState::StateProcess(const AppExecFwk::InnerEvent::Pointer &event)
193 {
194 if (event == nullptr) {
195 TELEPHONY_LOGE("event is null");
196 return false;
197 }
198 int32_t id = event->GetInnerEventId();
199 switch (id) {
200 case RadioEvent::RADIO_CONNECTED:
201 TELEPHONY_LOGI("Radio is connected");
202 break;
203 case RadioEvent::RADIO_DATA_CALL_LIST_CHANGED:
204 RadioDataCallListChanged(event);
205 break;
206 case RadioEvent::RADIO_LINK_CAPABILITY_CHANGED:
207 RadioLinkCapabilityChanged(event);
208 break;
209 case RadioEvent::RADIO_NETWORKSLICE_URSP_RPT:
210 RadioNetworkSliceUrspRpt(event);
211 break;
212 case RadioEvent::RADIO_NETWORKSLICE_ALLOWEDNSSAI_RPT:
213 RadioNetworkSliceAllowedNssaiRpt(event);
214 break;
215 case RadioEvent::RADIO_NETWORKSLICE_EHPLMN_RPT:
216 RadioNetworkSliceEhplmnRpt(event);
217 break;
218 default:
219 TELEPHONY_LOGE("handle nothing!");
220 return false;
221 }
222 return true;
223 }
224
RadioDataCallListChanged(const AppExecFwk::InnerEvent::Pointer & event)225 void CcmDefaultState::RadioDataCallListChanged(const AppExecFwk::InnerEvent::Pointer &event)
226 {
227 std::shared_ptr<DataCallResultList> infos = event->GetSharedObject<DataCallResultList>();
228 if (infos == nullptr) {
229 TELEPHONY_LOGE("setupDataCallResultInfo is null");
230 return;
231 }
232 std::map<int32_t, std::shared_ptr<CellularDataStateMachine>> idActiveConnectionMap =
233 connectManager_.GetActiveConnection();
234 UpdateNetworkInfo(event);
235 for (const std::pair<const int32_t, std::shared_ptr<CellularDataStateMachine>>& it : idActiveConnectionMap) {
236 if (it.second == nullptr) {
237 TELEPHONY_LOGI("The activation item is null(%{public}d)", it.first);
238 continue;
239 }
240 int32_t cid = it.second->GetCid();
241 for (size_t i = 0; i < infos->dcList.size(); ++i) {
242 if (infos->dcList[i].cid == cid && infos->dcList[i].active <= 0) {
243 auto object = std::make_shared<SetupDataCallResultInfo>();
244 object->cid = cid;
245 object->reason = infos->dcList[i].reason;
246 object->retryTime = infos->dcList[i].retryTime;
247 object->retryScene = static_cast<int32_t>(RetryScene::RETRY_SCENE_MODEM_DEACTIVATE);
248 TELEPHONY_LOGI("add to retry (modem dend): cid=%{public}d, cause=%{public}d", cid, object->reason);
249 AppExecFwk::InnerEvent::Pointer event =
250 AppExecFwk::InnerEvent::Get(CellularDataEventCode::MSG_SM_LOST_CONNECTION, object);
251 it.second->SendEvent(event);
252 break;
253 }
254 }
255 }
256 }
257
RadioLinkCapabilityChanged(const AppExecFwk::InnerEvent::Pointer & event)258 void CcmDefaultState::RadioLinkCapabilityChanged(const AppExecFwk::InnerEvent::Pointer &event)
259 {
260 std::shared_ptr<DataLinkCapability> linkCapability = event->GetSharedObject<DataLinkCapability>();
261 if (linkCapability == nullptr) {
262 TELEPHONY_LOGE("linkCapability is null");
263 return;
264 }
265 if (connectManager_.IsBandwidthSourceModem()) {
266 std::map<int32_t, std::shared_ptr<CellularDataStateMachine>> idActiveConnectionMap =
267 connectManager_.GetActiveConnection();
268 for (const std::pair<const int32_t, std::shared_ptr<CellularDataStateMachine>> &it : idActiveConnectionMap) {
269 if (it.second == nullptr) {
270 TELEPHONY_LOGI("The activation item is null(%{public}d)", it.first);
271 continue;
272 }
273 AppExecFwk::InnerEvent::Pointer smEvent =
274 AppExecFwk::InnerEvent::Get(CellularDataEventCode::MSG_SM_LINK_CAPABILITY_CHANGED, linkCapability);
275 it.second->SendEvent(smEvent);
276 }
277 }
278 }
279
UpdateNetworkInfo(const AppExecFwk::InnerEvent::Pointer & event)280 void CcmDefaultState::UpdateNetworkInfo(const AppExecFwk::InnerEvent::Pointer &event)
281 {
282 std::shared_ptr<DataCallResultList> infos = event->GetSharedObject<DataCallResultList>();
283 if (infos == nullptr) {
284 TELEPHONY_LOGE("dataCallResultList is null");
285 return;
286 }
287 for (SetupDataCallResultInfo &it : infos->dcList) {
288 std::shared_ptr<CellularDataStateMachine> dataConnect = connectManager_.GetActiveConnectionByCid(it.cid);
289 if (dataConnect == nullptr) {
290 TELEPHONY_LOGE("get active connection by cid is := %{public}d flag:= %{public}d ", it.cid, it.flag);
291 continue;
292 }
293 dataConnect->UpdateNetworkInfoIfInActive(it);
294 }
295 }
296
BeginNetStatistics()297 void DataConnectionManager::BeginNetStatistics()
298 {
299 if (connectionMonitor_ != nullptr) {
300 connectionMonitor_->BeginNetStatistics();
301 }
302 }
303
EndNetStatistics()304 void DataConnectionManager::EndNetStatistics()
305 {
306 if (connectionMonitor_ != nullptr) {
307 connectionMonitor_->EndNetStatistics();
308 }
309 }
310
UpdateCallState(int32_t state)311 void DataConnectionManager::UpdateCallState(int32_t state)
312 {
313 if (connectionMonitor_ != nullptr) {
314 connectionMonitor_->UpdateCallState(state);
315 }
316 }
317
GetDataRecoveryState()318 int32_t DataConnectionManager::GetDataRecoveryState()
319 {
320 if (connectionMonitor_ != nullptr) {
321 return static_cast<int32_t>(connectionMonitor_->GetDataRecoveryState());
322 }
323 return -1;
324 }
325
GetSlotId() const326 int32_t DataConnectionManager::GetSlotId() const
327 {
328 return slotId_;
329 }
330
GetDataFlowType()331 int32_t DataConnectionManager::GetDataFlowType()
332 {
333 if (connectionMonitor_ == nullptr) {
334 TELEPHONY_LOGE("Slot%{public}d: connection monitor is null", slotId_);
335 return static_cast<int32_t>(CellDataFlowType::DATA_FLOW_TYPE_NONE);
336 }
337 CellDataFlowType flowType = connectionMonitor_->GetDataFlowType();
338 return static_cast<int32_t>(flowType);
339 }
340
SetDataFlowType(CellDataFlowType dataFlowType)341 void DataConnectionManager::SetDataFlowType(CellDataFlowType dataFlowType)
342 {
343 if (connectionMonitor_ == nullptr) {
344 TELEPHONY_LOGE("Slot%{public}d: connection monitor is null", slotId_);
345 return;
346 }
347 connectionMonitor_->SetDataFlowType(dataFlowType);
348 }
349
GetDefaultBandWidthsConfig()350 void DataConnectionManager::GetDefaultBandWidthsConfig()
351 {
352 OperatorConfig operatorConfig;
353 CoreManagerInner::GetInstance().GetOperatorConfigs(slotId_, operatorConfig);
354 if (operatorConfig.boolValue.find(KEY_BANDWIDTH_SOURCE_USE_MODEM_BOOL) != operatorConfig.boolValue.end()) {
355 bandwidthSourceModem_ = operatorConfig.boolValue[KEY_BANDWIDTH_SOURCE_USE_MODEM_BOOL];
356 }
357 if (operatorConfig.boolValue.find(KEY_UPLINK_BANDWIDTH_NR_NSA_USE_LTE_VALUE_BOOL) !=
358 operatorConfig.boolValue.end()) {
359 uplinkUseLte_ = operatorConfig.boolValue[KEY_UPLINK_BANDWIDTH_NR_NSA_USE_LTE_VALUE_BOOL];
360 }
361 std::vector<std::string> linkBandwidthVec;
362 if (operatorConfig.stringArrayValue.find(KEY_BANDWIDTH_STRING_ARRAY) != operatorConfig.stringArrayValue.end()) {
363 linkBandwidthVec = operatorConfig.stringArrayValue[KEY_BANDWIDTH_STRING_ARRAY];
364 }
365 if (linkBandwidthVec.empty()) {
366 linkBandwidthVec = CellularDataUtils::Split(DEFAULT_BANDWIDTH_CONFIG, ";");
367 }
368 std::lock_guard<std::mutex> lock(bandwidthConfigMutex_);
369 bandwidthConfigMap_.clear();
370 for (std::string temp : linkBandwidthVec) {
371 std::vector<std::string> linkBandwidths = CellularDataUtils::Split(temp, ":");
372 if (linkBandwidths.size() == VALID_VECTOR_SIZE) {
373 std::string key = linkBandwidths.front();
374 std::string linkUpDownBandwidth = linkBandwidths.back();
375 std::vector<std::string> upDownBandwidthValue = CellularDataUtils::Split(linkUpDownBandwidth, ",");
376 if (upDownBandwidthValue.size() == VALID_VECTOR_SIZE) {
377 LinkBandwidthInfo linkBandwidthInfo;
378 linkBandwidthInfo.downBandwidth = (atoi)(upDownBandwidthValue.front().c_str());
379 linkBandwidthInfo.upBandwidth = (atoi)(upDownBandwidthValue.back().c_str());
380 bandwidthConfigMap_.emplace(key, linkBandwidthInfo);
381 }
382 }
383 }
384 TELEPHONY_LOGI("Slot%{public}d: BANDWIDTH_CONFIG_MAP size is %{public}zu", slotId_, bandwidthConfigMap_.size());
385 UpdateBandWidthsUseLte();
386 }
387
UpdateBandWidthsUseLte()388 void DataConnectionManager::UpdateBandWidthsUseLte()
389 {
390 if (!uplinkUseLte_) {
391 return;
392 }
393 std::map<std::string, LinkBandwidthInfo>::iterator iter = bandwidthConfigMap_.find("LTE");
394 if (iter != bandwidthConfigMap_.end()) {
395 LinkBandwidthInfo lteLinkBandwidthInfo = iter->second;
396 TELEPHONY_LOGI("Slot%{public}d: name is %{public}s upBandwidth = %{public}u downBandwidth = %{public}u",
397 slotId_, iter->first.c_str(), lteLinkBandwidthInfo.upBandwidth, lteLinkBandwidthInfo.downBandwidth);
398 iter = bandwidthConfigMap_.find("NR_NSA");
399 if (iter != bandwidthConfigMap_.end()) {
400 iter->second.upBandwidth = lteLinkBandwidthInfo.upBandwidth;
401 }
402 iter = bandwidthConfigMap_.find("NR_NSA_MMWAVE");
403 if (iter != bandwidthConfigMap_.end()) {
404 iter->second.upBandwidth = lteLinkBandwidthInfo.upBandwidth;
405 }
406 }
407 }
408
GetDefaultTcpBufferConfig()409 void DataConnectionManager::GetDefaultTcpBufferConfig()
410 {
411 char tcpBufferConfig[MAX_BUFFER_SIZE] = {0};
412 GetParameter(CONFIG_TCP_BUFFER, DEFAULT_TCP_BUFFER_CONFIG, tcpBufferConfig, MAX_BUFFER_SIZE);
413 std::vector<std::string> tcpBufferVec = CellularDataUtils::Split(tcpBufferConfig, ";");
414 std::lock_guard<std::mutex> lock(tcpBufferConfigMutex_);
415 tcpBufferConfigMap_.clear();
416 for (std::string tcpBuffer : tcpBufferVec) {
417 std::vector<std::string> str = CellularDataUtils::Split(tcpBuffer, ":");
418 tcpBufferConfigMap_.emplace(str.front(), str.back());
419 }
420 TELEPHONY_LOGI("Slot%{public}d: TCP_BUFFER_CONFIG_MAP size is %{public}zu", slotId_, tcpBufferConfigMap_.size());
421 }
422
GetBandwidthsByRadioTech(const int32_t radioTech)423 LinkBandwidthInfo DataConnectionManager::GetBandwidthsByRadioTech(const int32_t radioTech)
424 {
425 LinkBandwidthInfo linkBandwidthInfo;
426 CoreManagerInner &coreInner = CoreManagerInner::GetInstance();
427 NrState nrState = coreInner.GetNrState(slotId_);
428 FrequencyType frequencyType = coreInner.GetFrequencyType(slotId_);
429 std::string radioTechName = CellularDataUtils::ConvertRadioTechToRadioName(radioTech);
430 if (radioTech == (int32_t)RadioTech::RADIO_TECHNOLOGY_LTE &&
431 (nrState == NrState::NR_NSA_STATE_DUAL_CONNECTED || nrState == NrState::NR_NSA_STATE_CONNECTED_DETECT)) {
432 if (frequencyType == FrequencyType::FREQ_TYPE_MMWAVE) {
433 radioTechName = "NR_NSA_MMWAVE";
434 } else {
435 radioTechName = "NR_NSA";
436 }
437 }
438 if (radioTechName == "NR") {
439 radioTechName = "NR_SA";
440 }
441 TELEPHONY_LOGI("Slot%{public}d: accessRadioName is %{private}s", slotId_, radioTechName.c_str());
442 std::lock_guard<std::mutex> lock(bandwidthConfigMutex_);
443 std::map<std::string, LinkBandwidthInfo>::iterator iter = bandwidthConfigMap_.find(radioTechName);
444 if (iter != bandwidthConfigMap_.end()) {
445 linkBandwidthInfo = iter->second;
446 TELEPHONY_LOGI("Slot%{public}d: name is %{private}s upBandwidth = %{public}u downBandwidth = %{public}u",
447 slotId_, iter->first.c_str(), linkBandwidthInfo.upBandwidth, linkBandwidthInfo.downBandwidth);
448 }
449 return linkBandwidthInfo;
450 }
451
GetTcpBufferByRadioTech(const int32_t radioTech)452 std::string DataConnectionManager::GetTcpBufferByRadioTech(const int32_t radioTech)
453 {
454 std::string tcpBuffer = "";
455 CoreManagerInner &coreInner = CoreManagerInner::GetInstance();
456 NrState nrState = coreInner.GetNrState(slotId_);
457 std::string radioTechName = CellularDataUtils::ConvertRadioTechToRadioName(radioTech);
458 if ((radioTech == (int32_t)RadioTech::RADIO_TECHNOLOGY_LTE ||
459 radioTech == (int32_t)RadioTech::RADIO_TECHNOLOGY_LTE_CA) &&
460 (nrState == NrState::NR_NSA_STATE_DUAL_CONNECTED || nrState == NrState::NR_NSA_STATE_CONNECTED_DETECT)) {
461 radioTechName = "NR";
462 }
463 std::lock_guard<std::mutex> lock(tcpBufferConfigMutex_);
464 std::map<std::string, std::string>::iterator iter = tcpBufferConfigMap_.find(radioTechName);
465 if (iter != tcpBufferConfigMap_.end()) {
466 tcpBuffer = iter->second;
467 }
468 return tcpBuffer;
469 }
470
IsNeedDoRecovery(bool needDoRecovery) const471 void DataConnectionManager::IsNeedDoRecovery(bool needDoRecovery) const
472 {
473 if (connectionMonitor_ != nullptr) {
474 connectionMonitor_->IsNeedDoRecovery(needDoRecovery);
475 }
476 }
477
HandleScreenStateChanged(bool isScreenOn) const478 void DataConnectionManager::HandleScreenStateChanged(bool isScreenOn) const
479 {
480 if (connectionMonitor_ == nullptr) {
481 TELEPHONY_LOGE("Slot%{public}d: connection monitor is null", slotId_);
482 return;
483 }
484 connectionMonitor_->HandleScreenStateChanged(isScreenOn);
485 }
486
RadioNetworkSliceUrspRpt(const AppExecFwk::InnerEvent::Pointer & event)487 void CcmDefaultState::RadioNetworkSliceUrspRpt(const AppExecFwk::InnerEvent::Pointer &event)
488 {
489 std::shared_ptr<NetworkSliceUrspInfo> networkSliceUrspInfo = event->GetSharedObject<NetworkSliceUrspInfo>();
490 if (networkSliceUrspInfo == nullptr) {
491 TELEPHONY_LOGE("networkSliceClient is null");
492 return;
493 }
494 std::vector<uint8_t> buffer = networkSliceUrspInfo->urspInfo;
495 DelayedSingleton<NetManagerStandard::NetworkSliceClient>::GetInstance()->SetNetworkSliceUePolicy(buffer);
496 }
497
RadioNetworkSliceAllowedNssaiRpt(const AppExecFwk::InnerEvent::Pointer & event)498 void CcmDefaultState::RadioNetworkSliceAllowedNssaiRpt(const AppExecFwk::InnerEvent::Pointer &event)
499 {
500 std::shared_ptr<NetworkSliceAllowedNssaiInfo> networkSliceAllowedNssaiInfo
501 = event->GetSharedObject<NetworkSliceAllowedNssaiInfo>();
502 if (networkSliceAllowedNssaiInfo == nullptr) {
503 TELEPHONY_LOGE("networkSliceClient is null");
504 return;
505 }
506 std::vector<uint8_t> buffer = networkSliceAllowedNssaiInfo->allowednssaiInfo;
507 DelayedSingleton<NetManagerStandard::NetworkSliceClient>::GetInstance()->NetworkSliceAllowedNssaiRpt(buffer);
508 }
509
RadioNetworkSliceEhplmnRpt(const AppExecFwk::InnerEvent::Pointer & event)510 void CcmDefaultState::RadioNetworkSliceEhplmnRpt(const AppExecFwk::InnerEvent::Pointer &event)
511 {
512 std::shared_ptr<NetworkSliceEhplmnInfo> networkSliceEhplmnInfo
513 = event->GetSharedObject<NetworkSliceEhplmnInfo>();
514 if (networkSliceEhplmnInfo == nullptr) {
515 TELEPHONY_LOGE("networkSliceClient is null");
516 return;
517 }
518 std::vector<uint8_t> buffer = networkSliceEhplmnInfo->ehplmnInfo;
519 DelayedSingleton<NetManagerStandard::NetworkSliceClient>::GetInstance()->NetworkSliceEhplmnRpt(buffer);
520 }
521
522 } // namespace Telephony
523 } // namespace OHOS
524