/* mbed Microcontroller Library * Copyright (c) 2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * 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. */ #include "ble/GattClient.h" namespace ble { namespace interface { template ble_error_t GattClient::launchServiceDiscovery( ble::connection_handle_t connectionHandle, ServiceDiscovery::ServiceCallback_t sc, ServiceDiscovery::CharacteristicCallback_t cc, const UUID &matchingServiceUUID, const UUID &matchingCharacteristicUUIDIn ) { return impl()->launchServiceDiscovery_( connectionHandle, sc, cc, matchingServiceUUID, matchingCharacteristicUUIDIn ); } template ble_error_t GattClient::discoverServices( ble::connection_handle_t connectionHandle, ServiceDiscovery::ServiceCallback_t callback, GattAttribute::Handle_t startHandle, GattAttribute::Handle_t endHandle ) { return impl()->discoverServices_( connectionHandle, callback, startHandle, endHandle ); } template bool GattClient::isServiceDiscoveryActive(void) const { return impl()->isServiceDiscoveryActive_(); } template void GattClient::terminateServiceDiscovery(void) { return impl()->terminateServiceDiscovery_(); } template ble_error_t GattClient::read( ble::connection_handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset ) const { return impl()->read_(connHandle, attributeHandle, offset); } template ble_error_t GattClient::write( GattClient::WriteOp_t cmd, ble::connection_handle_t connHandle, GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value ) const { return impl()->write_( cmd, connHandle, attributeHandle, length, value ); } template void GattClient::onServiceDiscoveryTermination( ServiceDiscovery::TerminationCallback_t callback ) { return impl()->onServiceDiscoveryTermination_(callback); } template ble_error_t GattClient::discoverCharacteristicDescriptors( const DiscoveredCharacteristic& characteristic, const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback, const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback ) { return impl()->discoverCharacteristicDescriptors_( characteristic, discoveryCallback, terminationCallback ); } template bool GattClient::isCharacteristicDescriptorDiscoveryActive( const DiscoveredCharacteristic& characteristic ) const { return impl()->isCharacteristicDescriptorDiscoveryActive_(characteristic); } template void GattClient::terminateCharacteristicDescriptorDiscovery( const DiscoveredCharacteristic& characteristic ) { return impl()->terminateCharacteristicDescriptorDiscovery_(characteristic); } template ble_error_t GattClient::reset(void) { return impl()->reset_(); } /* ------------------------ Default implementations ------------------------- */ template ble_error_t GattClient::reset_(void) { /* Notify that the instance is about to shut down. */ shutdownCallChain.call(this); shutdownCallChain.clear(); onDataReadCallbackChain.clear(); onDataWriteCallbackChain.clear(); onHVXCallbackChain.clear(); return BLE_ERROR_NONE; } template ble_error_t GattClient::discoverServices_( ble::connection_handle_t connectionHandle, ServiceDiscovery::ServiceCallback_t callback, GattAttribute::Handle_t startHandle, GattAttribute::Handle_t endHandle ) { return BLE_ERROR_NOT_IMPLEMENTED; } template ble_error_t GattClient::launchServiceDiscovery_( ble::connection_handle_t connectionHandle, ServiceDiscovery::ServiceCallback_t sc, ServiceDiscovery::CharacteristicCallback_t cc, const UUID &matchingServiceUUID, const UUID &matchingCharacteristicUUIDIn ) { return BLE_ERROR_NOT_IMPLEMENTED; } template bool GattClient::isServiceDiscoveryActive_(void) const { return false; } template void GattClient::terminateServiceDiscovery_(void) { } template ble_error_t GattClient::read_( ble::connection_handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset ) const { return BLE_ERROR_NOT_IMPLEMENTED; } template ble_error_t GattClient::write_( GattClient::WriteOp_t cmd, ble::connection_handle_t connHandle, GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value ) const { return BLE_ERROR_NOT_IMPLEMENTED; } template void GattClient::onServiceDiscoveryTermination_( ServiceDiscovery::TerminationCallback_t callback ) { } template ble_error_t GattClient::discoverCharacteristicDescriptors_( const DiscoveredCharacteristic& characteristic, const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback, const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback ) { return BLE_ERROR_NOT_IMPLEMENTED; } template bool GattClient::isCharacteristicDescriptorDiscoveryActive_( const DiscoveredCharacteristic& characteristic ) const { return false; } template void GattClient::terminateCharacteristicDescriptorDiscovery_( const DiscoveredCharacteristic& characteristic ) { } } // interface } // ble