1 /* 2 * Copyright (c) 2024 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 "telephony_observer_ffi.h" 17 #include "telephony_observer_impl.h" 18 19 using namespace OHOS::FFI; 20 21 namespace OHOS { 22 namespace Telephony { 23 extern "C" { 24 FfiTelephonyObserverOnNetworkStateChange(ObserverOptions options,int64_t funcId)25 int32_t FfiTelephonyObserverOnNetworkStateChange(ObserverOptions options, int64_t funcId) 26 { 27 return TelephonyObserverImpl::OnNetworkStateChange(options, funcId); 28 } 29 FfiTelephonyObserverOffNetworkStateChange(int64_t funcId)30 int32_t FfiTelephonyObserverOffNetworkStateChange(int64_t funcId) 31 { 32 return TelephonyObserverImpl::OffNetworkStateChange(funcId); 33 } 34 FfiTelephonyObserverOffAllNetworkStateChange()35 int32_t FfiTelephonyObserverOffAllNetworkStateChange() 36 { 37 return TelephonyObserverImpl::OffAllNetworkStateChange(); 38 } 39 FfiTelephonyObserverOnSignalInfoChange(ObserverOptions options,int64_t funcId)40 int32_t FfiTelephonyObserverOnSignalInfoChange(ObserverOptions options, int64_t funcId) 41 { 42 return TelephonyObserverImpl::OnSignalInfoChange(options, funcId); 43 } 44 FfiTelephonyObserverOffSignalInfoChange(int64_t funcId)45 int32_t FfiTelephonyObserverOffSignalInfoChange(int64_t funcId) 46 { 47 return TelephonyObserverImpl::OffSignalInfoChange(funcId); 48 } 49 FfiTelephonyObserverOffAllSignalInfoChange()50 int32_t FfiTelephonyObserverOffAllSignalInfoChange() 51 { 52 return TelephonyObserverImpl::OffAllSignalInfoChange(); 53 } 54 FfiTelephonyObserverOnCallStateChange(ObserverOptions options,int64_t funcId)55 int32_t FfiTelephonyObserverOnCallStateChange(ObserverOptions options, int64_t funcId) 56 { 57 return TelephonyObserverImpl::OnCallStateChange(options, funcId); 58 } 59 FfiTelephonyObserverOffCallStateChange(int64_t funcId)60 int32_t FfiTelephonyObserverOffCallStateChange(int64_t funcId) 61 { 62 return TelephonyObserverImpl::OffCallStateChange(funcId); 63 } 64 FfiTelephonyObserverOffAllCallStateChange()65 int32_t FfiTelephonyObserverOffAllCallStateChange() 66 { 67 return TelephonyObserverImpl::OffAllCallStateChange(); 68 } 69 FfiTelephonyObserverOnCellularDataConnectionStateChange(ObserverOptions options,int64_t funcId)70 int32_t FfiTelephonyObserverOnCellularDataConnectionStateChange( 71 ObserverOptions options, 72 int64_t funcId) 73 { 74 return TelephonyObserverImpl::OnCellularDataConnectionStateChange(options, funcId); 75 } 76 FfiTelephonyObserverOffCellularDataConnectionStateChange(int64_t funcId)77 int32_t FfiTelephonyObserverOffCellularDataConnectionStateChange(int64_t funcId) 78 { 79 return TelephonyObserverImpl::OffCellularDataConnectionStateChange(funcId); 80 } 81 FfiTelephonyObserverOffAllCellularDataConnectionStateChange()82 int32_t FfiTelephonyObserverOffAllCellularDataConnectionStateChange() 83 { 84 return TelephonyObserverImpl::OffAllCellularDataConnectionStateChange(); 85 } 86 FfiTelephonyObserverOnCellularDataFlowChange(ObserverOptions options,int64_t funcId)87 int32_t FfiTelephonyObserverOnCellularDataFlowChange(ObserverOptions options, int64_t funcId) 88 { 89 return TelephonyObserverImpl::OnCellularDataFlowChange(options, funcId); 90 } 91 FfiTelephonyObserverOffCellularDataFlowChange(int64_t funcId)92 int32_t FfiTelephonyObserverOffCellularDataFlowChange(int64_t funcId) 93 { 94 return TelephonyObserverImpl::OffCellularDataFlowChange(funcId); 95 } 96 FfiTelephonyObserverOffAllCellularDataFlowChange()97 int32_t FfiTelephonyObserverOffAllCellularDataFlowChange() 98 { 99 return TelephonyObserverImpl::OffAllCellularDataFlowChange(); 100 } 101 FfiTelephonyObserverOnSimStateChange(ObserverOptions options,int64_t funcId)102 int32_t FfiTelephonyObserverOnSimStateChange(ObserverOptions options, int64_t funcId) 103 { 104 return TelephonyObserverImpl::OnSimStateChange(options, funcId); 105 } 106 FfiTelephonyObserverOffSimStateChange(int64_t funcId)107 int32_t FfiTelephonyObserverOffSimStateChange(int64_t funcId) 108 { 109 return TelephonyObserverImpl::OffSimStateChange(funcId); 110 } 111 FfiTelephonyObserverOffAllSimStateChange()112 int32_t FfiTelephonyObserverOffAllSimStateChange() 113 { 114 return TelephonyObserverImpl::OffAllSimStateChange(); 115 } 116 FfiTelephonyObserverOnIccAccountInfoChange(int64_t funcId)117 int32_t FfiTelephonyObserverOnIccAccountInfoChange(int64_t funcId) 118 { 119 ObserverOptions options; 120 return TelephonyObserverImpl::OnIccAccountInfoChange(options, funcId); 121 } 122 FfiTelephonyObserverOffIccAccountInfoChange(int64_t funcId)123 int32_t FfiTelephonyObserverOffIccAccountInfoChange(int64_t funcId) 124 { 125 return TelephonyObserverImpl::OffIccAccountInfoChange(funcId); 126 } 127 FfiTelephonyObserverOffAllIccAccountInfoChange()128 int32_t FfiTelephonyObserverOffAllIccAccountInfoChange() 129 { 130 return TelephonyObserverImpl::OffAllIccAccountInfoChange(); 131 } 132 } 133 } // namespace Telephony 134 } // namespace OHOS 135