1 2 /* 3 * Copyright (C) 2021 Huawei Device Co., Ltd. 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef OHOS_BLUETOOTH_STANDARD_GATT_SERVER_INTERFACE_H 17 #define OHOS_BLUETOOTH_STANDARD_GATT_SERVER_INTERFACE_H 18 19 #include "bluetooth_service_ipc_interface_code.h" 20 #include "i_bluetooth_gatt_server_callback.h" 21 #include "iremote_broker.h" 22 #include "../parcel/bluetooth_gatt_characteristic_parcel.h" 23 #include "../parcel/bluetooth_gatt_descriptor_parcel.h" 24 #include "../parcel/bluetooth_gatt_device.h" 25 #include "../parcel/bluetooth_gatt_service_parcel.h" 26 #include "../common/gatt_data.h" 27 namespace OHOS { 28 namespace Bluetooth { 29 class IBluetoothGattServer : public OHOS::IRemoteBroker { 30 public: 31 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ipc.IBluetoothGattServer"); 32 33 virtual int AddService(int32_t appId, BluetoothGattService *services) = 0; 34 virtual void ClearServices(int appId) = 0; 35 virtual int RegisterApplication(const sptr<IBluetoothGattServerCallback> &callback) = 0; 36 virtual int DeregisterApplication(int appId) = 0; 37 virtual int Connect(int appId, const BluetoothGattDevice &device, bool isDirect) = 0; 38 virtual int CancelConnection(int appId, const BluetoothGattDevice &device) = 0; 39 virtual int NotifyClient( 40 const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, bool needConfirm) = 0; 41 virtual int RemoveService(int32_t appId, const BluetoothGattService &services) = 0; 42 virtual int RespondCharacteristicRead( 43 const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, int32_t ret) = 0; 44 virtual int RespondCharacteristicWrite( 45 const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int32_t ret) = 0; 46 virtual int RespondDescriptorRead( 47 const BluetoothGattDevice &device, BluetoothGattDescriptor *descriptor, int32_t ret) = 0; 48 virtual int RespondDescriptorWrite( 49 const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor, int32_t ret) = 0; 50 }; 51 } // namespace Bluetooth 52 } // namespace OHOS 53 54 #endif // OHOS_BLUETOOTH_STANDARD_GATT_SERVER_INTERFACE_H 55