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_call_ffi.h"
17 #include "telephony_call_impl.h"
18 
19 using namespace OHOS::FFI;
20 
21 namespace OHOS {
22 namespace Telephony {
23 extern "C" {
FfiOHOSTelephonyCallIsRinging(int32_t * errCode)24     bool FfiOHOSTelephonyCallIsRinging(int32_t *errCode)
25     {
26         return TelephonyCallImpl::IsRinging(errCode);
27     }
28 
FfiOHOSTelephonyCallFormatPhoneNumberToE164(char * cPhoneNumber,char * cCountryCode,int32_t * errCode)29     char* FfiOHOSTelephonyCallFormatPhoneNumberToE164(char *cPhoneNumber, char *cCountryCode, int32_t *errCode)
30     {
31         return TelephonyCallImpl::FormatPhoneNumberToE164(cPhoneNumber, cCountryCode, errCode);
32     }
33 
FfiOHOSTelephonyCallMakeCall(char * number)34     int32_t FfiOHOSTelephonyCallMakeCall(char* number)
35     {
36         return TelephonyCallImpl::MakeCall(number);
37     }
38 
FfiOHOSTelephonyCallIsEmergencyPhoneNumber(char * phoneNumber,int32_t slotId,int32_t * errCode)39     bool FfiOHOSTelephonyCallIsEmergencyPhoneNumber(char* phoneNumber, int32_t slotId, int32_t* errCode)
40     {
41         return TelephonyCallImpl::IsEmergencyPhoneNumber(phoneNumber, slotId, errCode);
42     }
43 
FfiOHOSTelephonyCallHasCall()44     bool FfiOHOSTelephonyCallHasCall()
45     {
46         return TelephonyCallImpl::HasCall();
47     }
48 
FfiOHOSTelephonyCallGetCallState()49     int32_t FfiOHOSTelephonyCallGetCallState()
50     {
51         return TelephonyCallImpl::GetCallState();
52     }
53 
FfiOHOSTelephonyCallInit()54     void FfiOHOSTelephonyCallInit()
55     {
56         return TelephonyCallImpl::Init();
57     }
58 
FfiOHOSTelephonyCallDialCall(char * phoneNumber,DialCallOptions options)59     int32_t FfiOHOSTelephonyCallDialCall(char *phoneNumber, DialCallOptions options)
60     {
61         return TelephonyCallImpl::DialCall(phoneNumber, options);
62     }
63 
FfiOHOSTelephonyCallHasVoiceCapability()64     bool FfiOHOSTelephonyCallHasVoiceCapability()
65     {
66         return TelephonyCallImpl::HasVoiceCapability();
67     }
68 
FfiOHOSTelephonyCallFormatPhoneNumber(char * phoneNumber,char * countryCode,int32_t * errCode)69     char* FfiOHOSTelephonyCallFormatPhoneNumber(char *phoneNumber, char *countryCode, int32_t *errCode)
70     {
71         return TelephonyCallImpl::FormatPhoneNumber(phoneNumber, countryCode, errCode);
72     }
73 }
74 }  // namespace Telephony
75 }  // namespace OHOS
76