• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "state_notification.h"
17 
18 #include "core_manager_inner.h"
19 #include "telephony_ext_wrapper.h"
20 #include "telephony_log_wrapper.h"
21 #include "telephony_state_registry_client.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 StateNotification StateNotification::stateNotification_;
GetInstance()26 StateNotification &StateNotification::GetInstance()
27 {
28     return stateNotification_;
29 }
30 
UpdateCellularDataConnectState(int32_t slotId,ApnProfileState dataState,int32_t networkType)31 void StateNotification::UpdateCellularDataConnectState(int32_t slotId, ApnProfileState dataState, int32_t networkType)
32 {
33     int32_t state = CellularDataStateAdapter(dataState);
34     int32_t wrapState = WrapCellularDataState(state);
35     TELEPHONY_LOGI(
36         "slotId = %{public}d, wrapState = %{public}d, networkType = %{public}d", slotId, wrapState, networkType);
37     TelephonyStateRegistryClient::GetInstance().UpdateCellularDataConnectState(slotId, wrapState, networkType);
38 }
39 
OnUpDataFlowtype(int32_t slotId,CellDataFlowType flowType)40 void StateNotification::OnUpDataFlowtype(int32_t slotId, CellDataFlowType flowType)
41 {
42     TELEPHONY_LOGI("slotId = %{public}d, flowType = %{public}d", slotId, flowType);
43     TelephonyStateRegistryClient::GetInstance().UpdateCellularDataFlow(slotId, static_cast<int32_t>(flowType));
44 }
45 } // namespace Telephony
46 } // namespace OHOS