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 #ifndef OHOS_BLUETOOTH_STANDARD_GATT_SERVER_SERVER_H 16 #define OHOS_BLUETOOTH_STANDARD_GATT_SERVER_SERVER_H 17 18 #include "i_bluetooth_gatt_server.h" 19 #include "bluetooth_gatt_server_stub.h" 20 #include "if_system_ability_manager.h" 21 #include "iservice_registry.h" 22 #include "system_ability.h" 23 #include "bluetooth_types.h" 24 namespace OHOS { 25 namespace Bluetooth { 26 class BluetoothGattServerServer : public BluetoothGattServerStub { 27 public: 28 BluetoothGattServerServer(); 29 ~BluetoothGattServerServer() override; 30 31 int AddService(int32_t appId, BluetoothGattService *services) override; 32 void ClearServices(int appId) override; 33 void CancelConnection(const BluetoothGattDevice &device) override; 34 int RegisterApplication(const sptr<IBluetoothGattServerCallback> &callback) override; 35 int DeregisterApplication(int32_t appId) override; 36 int NotifyClient( 37 const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, bool needConfirm) override; 38 int RemoveService(int32_t appId, const BluetoothGattService &services) override; 39 int RespondCharacteristicRead( 40 const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, int32_t ret) override; 41 int RespondCharacteristicWrite( 42 const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int32_t ret) override; 43 int RespondDescriptorRead( 44 const BluetoothGattDevice &device, BluetoothGattDescriptor *descriptor, int32_t ret) override; 45 int RespondDescriptorWrite( 46 const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor, int32_t ret) override; 47 48 private: 49 BLUETOOTH_DECLARE_IMPL(); 50 BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothGattServerServer); 51 }; 52 } // namespace Bluetooth 53 } // namespace OHOS 54 #endif // OHOS_BLUETOOTH_STANDARD_A2DP_SOURCE_SERVER_H