• 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 #ifndef OHOS_BLUETOOTH_STANDARD_GATT_SERVER_CALLBACK_INTERFACE_H
17 #define OHOS_BLUETOOTH_STANDARD_GATT_SERVER_CALLBACK_INTERFACE_H
18 
19 #include "bluetooth_service_ipc_interface_code.h"
20 #include "iremote_broker.h"
21 #include "bluetooth_gatt_service_parcel.h"
22 #include "bluetooth_gatt_descriptor_parcel.h"
23 #include "bluetooth_gatt_device.h"
24 #include "bluetooth_gatt_characteristic_parcel.h"
25 
26 namespace OHOS {
27 namespace Bluetooth {
28 class IBluetoothGattServerCallback : public OHOS::IRemoteBroker {
29 public:
30     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ipc.IBluetoothGattServerCallback");
31 
32     virtual void OnConnectionStateChanged(
33         const BluetoothGattDevice &device, int32_t ret, int32_t state, int32_t disconnectReason) = 0;
34     virtual void OnAddService(int32_t ret, const BluetoothGattService &service) = 0;
35     virtual void OnCharacteristicReadRequest(
36         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic) = 0;
37     virtual void OnCharacteristicWriteRequest(
38         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, bool needRespones) = 0;
39     virtual void OnDescriptorReadRequest(
40         const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) = 0;
41     virtual void OnDescriptorWriteRequest(
42         const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) = 0;
43     virtual void OnMtuChanged(const BluetoothGattDevice &device, int32_t mtu) = 0;
44     virtual void OnNotifyConfirm(
45         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int result) = 0;
46     virtual void OnConnectionParameterChanged(
47         const BluetoothGattDevice &device, int32_t interval, int32_t latency, int32_t timeout, int32_t status) = 0;
48 };
49 }  // namespace Bluetooth
50 }  // namespace OHOS
51 
52 #endif  // BLUETOOTH_PARCEL_GATT_SERVER_CALLBACK_H