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 "../parcel/bluetooth_gatt_service_parcel.h"
22 #include "../parcel/bluetooth_gatt_descriptor_parcel.h"
23 #include "../parcel/bluetooth_gatt_device.h"
24 #include "../parcel/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(const BluetoothGattDevice &device, int32_t ret, int32_t state) = 0;
33     virtual void OnAddService(int32_t ret, const BluetoothGattService &service) = 0;
34     virtual void OnCharacteristicReadRequest(
35         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic) = 0;
36     virtual void OnCharacteristicWriteRequest(
37         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, bool needRespones) = 0;
38     virtual void OnDescriptorReadRequest(
39         const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) = 0;
40     virtual void OnDescriptorWriteRequest(
41         const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) = 0;
42     virtual void OnMtuChanged(const BluetoothGattDevice &device, int32_t mtu) = 0;
43     virtual void OnNotifyConfirm(
44         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int result) = 0;
45     virtual void OnConnectionParameterChanged(
46         const BluetoothGattDevice &device, int32_t interval, int32_t latency, int32_t timeout, int32_t status) = 0;
47 };
48 }  // namespace Bluetooth
49 }  // namespace OHOS
50 
51 #endif  // BLUETOOTH_PARCEL_GATT_SERVER_CALLBACK_H