mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-23 14:50:20 +00:00
commit
1fc783b51e
29
ConnectivityKit/bluetooth/BUILD.gn
Normal file
29
ConnectivityKit/bluetooth/BUILD.gn
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (C) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
import("//build/ohos/ndk/ndk.gni")
|
||||
|
||||
ohos_ndk_headers("bluetooth_ndk_header") {
|
||||
dest_dir = "$ndk_headers_out_dir/ConnectivityKit/bluetooth"
|
||||
sources = [ "./oh_bluetooth.h" ]
|
||||
}
|
||||
|
||||
ohos_ndk_library("libbluetooth_ndk") {
|
||||
ndk_description_file = "./libbluetooth.ndk.json"
|
||||
output_name = "bluetooth_ndk"
|
||||
output_extension = "so"
|
||||
min_compact_version = "13"
|
||||
system_capability = "SystemCapability.Communication.Bluetooth.Core"
|
||||
system_capability_headers = [ "./oh_bluetooth.h" ]
|
||||
}
|
5
ConnectivityKit/bluetooth/libbluetooth.ndk.json
Normal file
5
ConnectivityKit/bluetooth/libbluetooth.ndk.json
Normal file
@ -0,0 +1,5 @@
|
||||
[
|
||||
{
|
||||
"name": "OH_Bluetooth_GetBluetoothSwitchState"
|
||||
}
|
||||
]
|
95
ConnectivityKit/bluetooth/oh_bluetooth.h
Normal file
95
ConnectivityKit/bluetooth/oh_bluetooth.h
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Bluetooth
|
||||
* @{
|
||||
*
|
||||
* @brief Provide functions for querying the status of bluetooth switch.
|
||||
* @since 13
|
||||
*/
|
||||
/**
|
||||
* @file oh_bluetooth.h
|
||||
* @kit ConnectivityKit
|
||||
* @brief Define interfaces for querying bluetooth switch status.
|
||||
* @library libbluetooth.so
|
||||
* @syscap SystemCapability.Communication.Bluetooth.Core
|
||||
* @since 13
|
||||
*/
|
||||
|
||||
#ifndef OH_BLUETOOTH_H
|
||||
#define OH_BLUETOOTH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enumeration state of bluetooth switch.
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
typedef enum Bluetooth_SwitchState {
|
||||
/** Indicates the local bluetooth is off. */
|
||||
BLUETOOTH_STATE_OFF = 0,
|
||||
/** Indicates the local bluetooth is turning on. */
|
||||
BLUETOOTH_STATE_TURNING_ON = 1,
|
||||
/** Indicates the local bluetooth is on, and ready for use. */
|
||||
BLUETOOTH_STATE_ON = 2,
|
||||
/** Indicates the local bluetooth is turning off. */
|
||||
BLUETOOTH_STATE_TURNING_OFF = 3,
|
||||
/** Indicates the local bluetooth is turning LE mode on. */
|
||||
BLUETOOTH_STATE_BLE_TURNING_ON = 4,
|
||||
/** Indicates the local bluetooth is in LE only mode. */
|
||||
BLUETOOTH_STATE_BLE_ON = 5,
|
||||
/** Indicates the local bluetooth is turning off LE only mode. */
|
||||
BLUETOOTH_STATE_BLE_TURNING_OFF = 6
|
||||
} Bluetooth_SwitchState;
|
||||
|
||||
/**
|
||||
* @brief Enumeration the bluetooth result codes.
|
||||
*
|
||||
* @since 13
|
||||
*/
|
||||
typedef enum Bluetooth_ResultCode {
|
||||
/**
|
||||
* @error The operation is successful.
|
||||
*/
|
||||
BLUETOOTH_SUCCESS = 0,
|
||||
/**
|
||||
* @error Parameter error. Possible reasons: 1. The input parameter is a null pointer;
|
||||
* 2. Parameter values exceed the defined range.
|
||||
*/
|
||||
BLUETOOTH_INVALID_PARAM = 401,
|
||||
} Bluetooth_ResultCode;
|
||||
|
||||
/**
|
||||
* @brief Get the bluetooth switch state.
|
||||
*
|
||||
* @param state - It is a pointer used to receive bluetooth switch status values.
|
||||
* The caller needs to pass in a non empty boolean pointer, otherwise an error will be returned.
|
||||
* For a detailed definition, please refer to {@link Bluetooth_SwitchState}.
|
||||
* @return Bluetooth functions result code.
|
||||
* For a detailed definition, please refer to {@link Bluetooth_ResultCode}.
|
||||
* {@link BLUETOOTH_SUCCESS} Successfully obtained the bluetooth switch status.
|
||||
* {@link BLUETOOTH_INVALID_PARAM} The input parameter enabled is a null pointer.
|
||||
* @since 13
|
||||
*/
|
||||
Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/** @} */
|
||||
#endif // OH_BLUETOOTH_H
|
Loading…
Reference in New Issue
Block a user