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 #ifndef LOG_TAG
16 #define LOG_TAG "bt_cj_access_ffi"
17 #endif
18
19 #include "bluetooth_access_ffi.h"
20 #include "bluetooth_access_impl.h"
21 #include "bluetooth_log.h"
22
23 using namespace OHOS::FFI;
24
25 namespace OHOS {
26 namespace CJSystemapi {
27 namespace CJBluetoothAccess {
28
29 extern "C" {
FfiBluetoothAccEnableBluetooth(int32_t * errCode)30 void FfiBluetoothAccEnableBluetooth(int32_t* errCode)
31 {
32 return AccessImpl::EnableBluetooth(errCode);
33 }
34
FfiBluetoothAccDisableBluetooth(int32_t * errCode)35 void FfiBluetoothAccDisableBluetooth(int32_t* errCode)
36 {
37 return AccessImpl::DisableBluetooth(errCode);
38 }
39
FfiBluetoothAccGetState(int32_t * errCode)40 int32_t FfiBluetoothAccGetState(int32_t* errCode)
41 {
42 return AccessImpl::GetState(errCode);
43 }
44
FfiBluetoothAccOn(int32_t callbackType,void (* callback)(),int32_t * errCode)45 void FfiBluetoothAccOn(int32_t callbackType, void (*callback)(), int32_t* errCode)
46 {
47 return AccessImpl::RegisterAccessObserver(callbackType, callback, errCode);
48 }
49 }
50 } // namespace BluetoothAccess
51 } // namespace CJSystemapi
52 } // namespace OHOS