mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			route mtu changed events to server and client instead of gap
							parent
							
								
									a3f635eb88
								
							
						
					
					
						commit
						b628285254
					
				| 
						 | 
				
			
			@ -83,6 +83,38 @@
 | 
			
		|||
 */
 | 
			
		||||
class GattClient {
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Definition of the general handler of GattClient related events.
 | 
			
		||||
     */
 | 
			
		||||
    struct EventHandler {
 | 
			
		||||
        /**
 | 
			
		||||
         * Function invoked when the connections changes the ATT_MTU which controls
 | 
			
		||||
         * the maximum size of an attribute that can be read in a single L2CAP packet
 | 
			
		||||
         * which might be fragmented across multiple packets.
 | 
			
		||||
         *
 | 
			
		||||
         * @param connectionHandle The handle of the connection that changed the size.
 | 
			
		||||
         * @param attMtuSize
 | 
			
		||||
         */
 | 
			
		||||
        virtual void onAttMtuChange(
 | 
			
		||||
            ble::connection_handle_t connectionHandle,
 | 
			
		||||
            uint16_t attMtuSize
 | 
			
		||||
        )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Assign the event handler implementation that will be used by the
 | 
			
		||||
     * module to signal events back to the application.
 | 
			
		||||
     *
 | 
			
		||||
     * @param handler Application implementation of an EventHandler.
 | 
			
		||||
     */
 | 
			
		||||
    void setEventHandler(EventHandler *handler)
 | 
			
		||||
    {
 | 
			
		||||
        _eventHandler = handler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Attribute read event handler.
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -815,6 +847,11 @@ public:
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    /**
 | 
			
		||||
     * Event handler provided by the application.
 | 
			
		||||
     */
 | 
			
		||||
    EventHandler *_eventHandler;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Callchain containing all registered event handlers for data read
 | 
			
		||||
     * events.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,6 +87,38 @@
 | 
			
		|||
 */
 | 
			
		||||
class GattServer {
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Definition of the general handler of GattServer related events.
 | 
			
		||||
     */
 | 
			
		||||
    struct EventHandler {
 | 
			
		||||
        /**
 | 
			
		||||
         * Function invoked when the connections changes the ATT_MTU which controls
 | 
			
		||||
         * the maximum size of an attribute that can be read in a single L2CAP packet
 | 
			
		||||
         * which might be fragmented across multiple packets.
 | 
			
		||||
         *
 | 
			
		||||
         * @param connectionHandle The handle of the connection that changed the size.
 | 
			
		||||
         * @param attMtuSize
 | 
			
		||||
         */
 | 
			
		||||
        virtual void onAttMtuChange(
 | 
			
		||||
            ble::connection_handle_t connectionHandle,
 | 
			
		||||
            uint16_t attMtuSize
 | 
			
		||||
        )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Assign the event handler implementation that will be used by the
 | 
			
		||||
     * module to signal events back to the application.
 | 
			
		||||
     *
 | 
			
		||||
     * @param handler Application implementation of an EventHandler.
 | 
			
		||||
     */
 | 
			
		||||
    void setEventHandler(EventHandler *handler)
 | 
			
		||||
    {
 | 
			
		||||
        _eventHandler = handler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Event handler invoked when the server has sent data to a client.
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -778,6 +810,11 @@ public:
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    /**
 | 
			
		||||
     * Event handler provided by the application.
 | 
			
		||||
     */
 | 
			
		||||
    EventHandler *_eventHandler;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The total number of services added to the ATT table.
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -492,21 +492,6 @@ public:
 | 
			
		|||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Function invoked when the connections changes the ATT_MTU which controls
 | 
			
		||||
         * the maximum size of an attribute that can be read in a single L2CAP packet
 | 
			
		||||
         * which might be fragmented across multiple packets.
 | 
			
		||||
         *
 | 
			
		||||
         * @param connectionHandle The handle of the connection that changed the size.
 | 
			
		||||
         * @param attMtuSize
 | 
			
		||||
         */
 | 
			
		||||
        virtual void onAttMtuChange(
 | 
			
		||||
            connection_handle_t connectionHandle,
 | 
			
		||||
            uint16_t attMtuSize
 | 
			
		||||
        )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Function invoked when the connections changes the maximum number of octets
 | 
			
		||||
         * that can be sent or received by the controller in a single packet. A single
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -627,11 +627,6 @@ private:
 | 
			
		|||
        phy_t rx_phy
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    virtual void on_att_mtu_changed(
 | 
			
		||||
        connection_handle_t connection_handle,
 | 
			
		||||
        uint16_t att_mtu_size
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    virtual void on_data_length_change(
 | 
			
		||||
        connection_handle_t connection_handle,
 | 
			
		||||
        uint16_t tx_size,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,8 +33,20 @@ namespace generic {
 | 
			
		|||
 * @attention: Not part of the public interface of BLE API.
 | 
			
		||||
 */
 | 
			
		||||
class GenericGattClient : public GattClient,
 | 
			
		||||
                          public pal::SigningEventMonitor {
 | 
			
		||||
                          public pal::SigningEventMonitor,
 | 
			
		||||
                          public pal::GattClient::EventHandler {
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    virtual void on_att_mtu_change(
 | 
			
		||||
        ble::connection_handle_t connection_handle,
 | 
			
		||||
        uint16_t att_mtu_size
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        if (_eventHandler) {
 | 
			
		||||
            _eventHandler->onAttMtuChange(connection_handle, att_mtu_size);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a GenericGattClient from a pal::GattClient
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -128,6 +140,10 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    virtual void set_signing_event_handler(pal::SigningEventMonitor::EventHandler *signing_event_handler);
 | 
			
		||||
 | 
			
		||||
    ::GattClient::EventHandler* getEventHandler() {
 | 
			
		||||
        return _eventHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    struct ProcedureControlBlock;
 | 
			
		||||
    struct DiscoveryControlBlock;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,14 +44,6 @@ struct Gap {
 | 
			
		|||
            ble::phy_t rx_phy
 | 
			
		||||
        ) = 0;
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * @copydoc Gap::EventHandler::onAttMtuChange
 | 
			
		||||
         */
 | 
			
		||||
        virtual void on_att_mtu_changed(
 | 
			
		||||
            connection_handle_t connection_handle,
 | 
			
		||||
            uint16_t att_mtu_size
 | 
			
		||||
        ) = 0;
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * @copydoc Gap::EventHandler::onDataLengthChange
 | 
			
		||||
         */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,8 +55,27 @@ namespace pal {
 | 
			
		|||
 * the class AttClientToGattClientAdapter
 | 
			
		||||
 */
 | 
			
		||||
class GattClient {
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    /**
 | 
			
		||||
     * Definition of the general handler of GattClient related events.
 | 
			
		||||
     */
 | 
			
		||||
    struct EventHandler {
 | 
			
		||||
        /**
 | 
			
		||||
         * Function invoked when the connections changes the ATT_MTU which controls
 | 
			
		||||
         * the maximum size of an attribute that can be read in a single L2CAP packet
 | 
			
		||||
         * which might be fragmented across multiple packets.
 | 
			
		||||
         *
 | 
			
		||||
         * @param connectionHandle The handle of the connection that changed the size.
 | 
			
		||||
         * @param attMtuSize
 | 
			
		||||
         */
 | 
			
		||||
        virtual void on_att_mtu_change(
 | 
			
		||||
            ble::connection_handle_t connection_handle,
 | 
			
		||||
            uint16_t att_mtu_size
 | 
			
		||||
        )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialisation of the instance. An implementation can use this function
 | 
			
		||||
     * to initialise the subsystems needed to realize the operations of this
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -860,16 +860,6 @@ void GenericGap::on_read_phy(
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GenericGap::on_att_mtu_changed(
 | 
			
		||||
    Handle_t connection_handle,
 | 
			
		||||
    uint16_t att_mtu_size
 | 
			
		||||
)
 | 
			
		||||
{
 | 
			
		||||
    if (_eventHandler) {
 | 
			
		||||
        _eventHandler->onAttMtuChange(connection_handle, att_mtu_size);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GenericGap::on_data_length_change(
 | 
			
		||||
    Handle_t connection_handle,
 | 
			
		||||
    uint16_t tx_size,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1280,7 +1280,7 @@ ble_error_t GenericGattClient::reset(void) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void GenericGattClient::set_signing_event_handler(
 | 
			
		||||
    EventHandler *signing_event_handler
 | 
			
		||||
    pal::SigningEventMonitor::EventHandler *signing_event_handler
 | 
			
		||||
) {
 | 
			
		||||
    _signing_event_handler = signing_event_handler;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,6 +62,10 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    static GattServer &getInstance();
 | 
			
		||||
 | 
			
		||||
    ::GattServer::EventHandler* getEventHandler() {
 | 
			
		||||
        return _eventHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize the GattServer and add mandatory services (generic access and
 | 
			
		||||
     * generic attribute service).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,73 @@
 | 
			
		|||
/* mbed Microcontroller Library
 | 
			
		||||
 * Copyright (c) 2019 ARM Limited
 | 
			
		||||
 *
 | 
			
		||||
 * 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 "CordioPalAttClient.h"
 | 
			
		||||
#include "CordioBLE.h"
 | 
			
		||||
 | 
			
		||||
namespace ble {
 | 
			
		||||
namespace pal {
 | 
			
		||||
namespace vendor {
 | 
			
		||||
namespace cordio {
 | 
			
		||||
 | 
			
		||||
void CordioAttClient::att_client_handler(const attEvt_t* event)
 | 
			
		||||
{
 | 
			
		||||
    if (event->hdr.status == ATT_SUCCESS && event->hdr.event == ATT_MTU_UPDATE_IND) {
 | 
			
		||||
        ble::vendor::cordio::BLE& ble = ble::vendor::cordio::BLE::deviceInstance();
 | 
			
		||||
        ble::pal::GattClient::EventHandler &handler = ble.getGattClient();
 | 
			
		||||
        handler.on_att_mtu_change(event->hdr.param, event->mtu);
 | 
			
		||||
    } else {
 | 
			
		||||
        // all handlers are stored in a static array
 | 
			
		||||
        static const event_handler_t handlers[] = {
 | 
			
		||||
            &timeout_event_handler,
 | 
			
		||||
            &event_handler<ErrorResponseConverter>,
 | 
			
		||||
            //&event_handler<ExchangeMtuResponseConverter>,
 | 
			
		||||
            &event_handler<FindInformationResponseConverter>,
 | 
			
		||||
            &event_handler<FindByTypeValueResponseConverter>,
 | 
			
		||||
            &event_handler<ReadByTypeResponseConverter>,
 | 
			
		||||
            &event_handler<ReadResponseConverter>,
 | 
			
		||||
            &event_handler<ReadBlobResponseConverter>,
 | 
			
		||||
            &event_handler<ReadMultipleResponseConverter>,
 | 
			
		||||
            &event_handler<ReadBygroupTypeResponseConverter>,
 | 
			
		||||
            &event_handler<WriteResponseConverter>,
 | 
			
		||||
            &event_handler<PrepareWriteResponseConverter>,
 | 
			
		||||
            &event_handler<ExecuteWriteResponseConverter>,
 | 
			
		||||
            &event_handler<HandleValueIndicationConverter>,
 | 
			
		||||
            &event_handler<HandleValueNotificationConverter>
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // event->hdr.param: connection handle
 | 
			
		||||
        // event->header.event: opcode from the request
 | 
			
		||||
        // event->header.status: success or error code ...
 | 
			
		||||
        // event->pValue: starting after opcode for response; starting after opcode + handle for server initiated responses.
 | 
			
		||||
        // event->handle: handle for server initiated responses
 | 
			
		||||
 | 
			
		||||
        // traverse all handlers and execute them with the event in input.
 | 
			
		||||
        // exit if an handler has handled the event.
 | 
			
		||||
        for(size_t i = 0; i < (sizeof(handlers)/sizeof(handlers[0])); ++i) {
 | 
			
		||||
            if (handlers[i](event)) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // pass events not handled to the server side
 | 
			
		||||
    ble::vendor::cordio::GattServer::getInstance().att_cb(event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // cordio
 | 
			
		||||
} // vendor
 | 
			
		||||
} // pal
 | 
			
		||||
} // ble
 | 
			
		||||
| 
						 | 
				
			
			@ -24,6 +24,8 @@
 | 
			
		|||
#include "att_defs.h"
 | 
			
		||||
#include "ble/pal/PalGap.h"
 | 
			
		||||
#include "CordioPalGap.h"
 | 
			
		||||
#include "PalGattClient.h"
 | 
			
		||||
#include "CordioBLE.h"
 | 
			
		||||
 | 
			
		||||
namespace ble {
 | 
			
		||||
namespace pal {
 | 
			
		||||
| 
						 | 
				
			
			@ -318,53 +320,7 @@ public:
 | 
			
		|||
    /**
 | 
			
		||||
     * Callback which handle attEvt_t and forward them to on_server_event.
 | 
			
		||||
     */
 | 
			
		||||
    static void att_client_handler(const attEvt_t* event)
 | 
			
		||||
    {
 | 
			
		||||
        if (event->hdr.status == ATT_SUCCESS && event->hdr.event == ATT_MTU_UPDATE_IND) {
 | 
			
		||||
            ble::pal::Gap::EventHandler *handler;
 | 
			
		||||
            handler = ble::pal::vendor::cordio::Gap::get_gap().get_event_handler();
 | 
			
		||||
            if (handler) {
 | 
			
		||||
                handler->on_att_mtu_changed(event->hdr.param, event->mtu);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // all handlers are stored in a static array
 | 
			
		||||
        static const event_handler_t handlers[] = {
 | 
			
		||||
            &timeout_event_handler,
 | 
			
		||||
            &event_handler<ErrorResponseConverter>,
 | 
			
		||||
            //&event_handler<ExchangeMtuResponseConverter>,
 | 
			
		||||
            &event_handler<FindInformationResponseConverter>,
 | 
			
		||||
            &event_handler<FindByTypeValueResponseConverter>,
 | 
			
		||||
            &event_handler<ReadByTypeResponseConverter>,
 | 
			
		||||
            &event_handler<ReadResponseConverter>,
 | 
			
		||||
            &event_handler<ReadBlobResponseConverter>,
 | 
			
		||||
            &event_handler<ReadMultipleResponseConverter>,
 | 
			
		||||
            &event_handler<ReadBygroupTypeResponseConverter>,
 | 
			
		||||
            &event_handler<WriteResponseConverter>,
 | 
			
		||||
            &event_handler<PrepareWriteResponseConverter>,
 | 
			
		||||
            &event_handler<ExecuteWriteResponseConverter>,
 | 
			
		||||
            &event_handler<HandleValueIndicationConverter>,
 | 
			
		||||
            &event_handler<HandleValueNotificationConverter>
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // event->hdr.param: connection handle
 | 
			
		||||
        // event->header.event: opcode from the request
 | 
			
		||||
        // event->header.status: success or error code ...
 | 
			
		||||
        // event->pValue: starting after opcode for response; starting after opcode + handle for server initiated responses.
 | 
			
		||||
        // event->handle: handle for server initiated responses
 | 
			
		||||
 | 
			
		||||
        // traverse all handlers and execute them with the event in input.
 | 
			
		||||
        // exit if an handler has handled the event.
 | 
			
		||||
        for(size_t i = 0; i < (sizeof(handlers)/sizeof(handlers[0])); ++i) {
 | 
			
		||||
            if (handlers[i](event)) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // pass events not handled to the server side
 | 
			
		||||
        ble::vendor::cordio::GattServer::getInstance().att_cb(event);
 | 
			
		||||
    }
 | 
			
		||||
    static void att_client_handler(const attEvt_t* event);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -849,7 +849,12 @@ void GattServer::cccd_cb(attsCccEvt_t *evt)
 | 
			
		|||
 | 
			
		||||
void GattServer::att_cb(const attEvt_t *evt)
 | 
			
		||||
{
 | 
			
		||||
    if (evt->hdr.status == ATT_SUCCESS && evt->hdr.event == ATTS_HANDLE_VALUE_CNF) {
 | 
			
		||||
    if (evt->hdr.status == ATT_SUCCESS && evt->hdr.event == ATT_MTU_UPDATE_IND) {
 | 
			
		||||
        ::GattServer::EventHandler *handler = getInstance().getEventHandler();
 | 
			
		||||
        if (handler) {
 | 
			
		||||
            handler->onAttMtuChange(evt->hdr.param, evt->mtu);
 | 
			
		||||
        }
 | 
			
		||||
    } else if (evt->hdr.status == ATT_SUCCESS && evt->hdr.event == ATTS_HANDLE_VALUE_CNF) {
 | 
			
		||||
        getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_SENT, evt->handle);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,9 @@ public:
 | 
			
		|||
    void eventCallback(void);
 | 
			
		||||
    void hwCallback(ble_evt_t *p_ble_evt);
 | 
			
		||||
 | 
			
		||||
    EventHandler* getEventHandler() {
 | 
			
		||||
        return _eventHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    const static unsigned BLE_TOTAL_CHARACTERISTICS = 20;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,9 @@ public:
 | 
			
		|||
    void eventCallback(void);
 | 
			
		||||
    void hwCallback(const ble_evt_t *p_ble_evt);
 | 
			
		||||
 | 
			
		||||
    EventHandler* getEventHandler() {
 | 
			
		||||
        return _eventHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    const static unsigned BLE_TOTAL_CHARACTERISTICS = 20;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -399,7 +399,8 @@ void btle_handler(const ble_evt_t *p_ble_evt)
 | 
			
		|||
                const ble_gatts_evt_exchange_mtu_request_t &update =
 | 
			
		||||
                    p_ble_evt->evt.gatts_evt.params.exchange_mtu_request;
 | 
			
		||||
 | 
			
		||||
                gap._eventHandler->onAttMtuChange(
 | 
			
		||||
                nRF5xGattServer &gatt_server = (nRF5xGattServer&) ble.getGattServer();
 | 
			
		||||
                gatt_server.getEventHandler()->onAttMtuChange(
 | 
			
		||||
                    connection,
 | 
			
		||||
                    std::min(NRF_SDH_BLE_GATT_MAX_MTU_SIZE, (int)(update.client_rx_mtu))
 | 
			
		||||
                );
 | 
			
		||||
| 
						 | 
				
			
			@ -414,7 +415,8 @@ void btle_handler(const ble_evt_t *p_ble_evt)
 | 
			
		|||
                const ble_gattc_evt_exchange_mtu_rsp_t &update =
 | 
			
		||||
                    p_ble_evt->evt.gattc_evt.params.exchange_mtu_rsp;
 | 
			
		||||
 | 
			
		||||
                gap._eventHandler->onAttMtuChange(
 | 
			
		||||
                nRF5xGattServer &gatt_client = (nRF5xGattClient&) ble.getGattClient();
 | 
			
		||||
                gatt_client.getEventHandler()->onAttMtuChange(
 | 
			
		||||
                    connection,
 | 
			
		||||
                    std::min(NRF_SDH_BLE_GATT_MAX_MTU_SIZE, (int)(update.server_rx_mtu))
 | 
			
		||||
                );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,9 @@ public:
 | 
			
		|||
    void eventCallback(void);
 | 
			
		||||
    void hwCallback(const ble_evt_t *p_ble_evt);
 | 
			
		||||
 | 
			
		||||
    EventHandler* getEventHandler() {
 | 
			
		||||
        return _eventHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    const static unsigned BLE_TOTAL_CHARACTERISTICS = NRF_SDH_BLE_TOTAL_CHARACTERISTICS;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue