|
| 1 | +/* mbed Microcontroller Library |
| 2 | + * Copyright (c) 2020 ARM Limited |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +#ifndef BLE_GAPMOCK_H |
| 19 | +#define BLE_GAPMOCK_H |
| 20 | + |
| 21 | +#include "gmock/gmock.h" |
| 22 | +#include "source/generic/GapImpl.h" |
| 23 | + |
| 24 | +namespace ble { |
| 25 | + |
| 26 | +class GapMock : public ble::impl::Gap { |
| 27 | +public: |
| 28 | + GapMock() {}; |
| 29 | + GapMock(const GapMock&) = delete; |
| 30 | + GapMock& operator=(const GapMock&) = delete; |
| 31 | + virtual ~GapMock() {}; |
| 32 | + |
| 33 | + MOCK_METHOD((ble_error_t), reset, (), (override)); |
| 34 | + MOCK_METHOD(void, setEventHandler, (EventHandler *handler), (override)); |
| 35 | + MOCK_METHOD(bool, isFeatureSupported, (controller_supported_features_t feature), (override)); |
| 36 | + MOCK_METHOD(uint8_t, getMaxAdvertisingSetNumber, (), (override)); |
| 37 | + MOCK_METHOD(uint16_t, getMaxAdvertisingDataLength, (), (override)); |
| 38 | + MOCK_METHOD(uint16_t, getMaxConnectableAdvertisingDataLength, (), (override)); |
| 39 | + MOCK_METHOD(uint16_t, getMaxActiveSetAdvertisingDataLength, (), (override)); |
| 40 | + MOCK_METHOD(ble_error_t, createAdvertisingSet, (advertising_handle_t *handle, const AdvertisingParameters ¶meters), (override)); |
| 41 | + MOCK_METHOD(ble_error_t, destroyAdvertisingSet, (advertising_handle_t handle), (override)); |
| 42 | + MOCK_METHOD(ble_error_t, setAdvertisingParameters, (advertising_handle_t handle, const AdvertisingParameters ¶ms), (override)); |
| 43 | + MOCK_METHOD(ble_error_t, setAdvertisingPayload, (advertising_handle_t handle, mbed::Span<const uint8_t> payload), (override)); |
| 44 | + MOCK_METHOD(ble_error_t, setAdvertisingScanResponse, (advertising_handle_t handle, mbed::Span<const uint8_t> response), (override)); |
| 45 | + MOCK_METHOD(ble_error_t, startAdvertising, (advertising_handle_t handle, adv_duration_t maxDuration, uint8_t maxEvents), (override)); |
| 46 | + MOCK_METHOD(ble_error_t, stopAdvertising, (advertising_handle_t handle), (override)); |
| 47 | + MOCK_METHOD(bool, isAdvertisingActive, (advertising_handle_t handle), (override)); |
| 48 | + MOCK_METHOD(ble_error_t, setPeriodicAdvertisingParameters, (advertising_handle_t handle, periodic_interval_t periodicAdvertisingIntervalMin, periodic_interval_t periodicAdvertisingIntervalMax, bool advertiseTxPower), (override)); |
| 49 | + MOCK_METHOD(ble_error_t, setPeriodicAdvertisingPayload, (advertising_handle_t handle, mbed::Span<const uint8_t> payload), (override)); |
| 50 | + MOCK_METHOD(ble_error_t, startPeriodicAdvertising, (advertising_handle_t handle), (override)); |
| 51 | + MOCK_METHOD(ble_error_t, stopPeriodicAdvertising, (advertising_handle_t handle), (override)); |
| 52 | + MOCK_METHOD(bool, isPeriodicAdvertisingActive, (advertising_handle_t handle), (override)); |
| 53 | + MOCK_METHOD(ble_error_t, setScanParameters, (const ScanParameters ¶ms), (override)); |
| 54 | + MOCK_METHOD(ble_error_t, startScan, (scan_duration_t duration, duplicates_filter_t filtering, scan_period_t period), (override)); |
| 55 | + MOCK_METHOD(ble_error_t, initiate_scan, (), (override)); |
| 56 | + MOCK_METHOD(ble_error_t, stopScan, (), (override)); |
| 57 | + MOCK_METHOD(ble_error_t, createSync, (peer_address_type_t peerAddressType, const address_t &peerAddress, uint8_t sid, slave_latency_t maxPacketSkip, sync_timeout_t timeout), (override)); |
| 58 | + MOCK_METHOD(ble_error_t, createSync, (slave_latency_t maxPacketSkip, sync_timeout_t timeout), (override)); |
| 59 | + MOCK_METHOD(ble_error_t, cancelCreateSync, (), (override)); |
| 60 | + MOCK_METHOD(ble_error_t, terminateSync, (periodic_sync_handle_t handle), (override)); |
| 61 | + MOCK_METHOD(ble_error_t, addDeviceToPeriodicAdvertiserList, (peer_address_type_t peerAddressType, const address_t &peerAddress, advertising_sid_t sid), (override)); |
| 62 | + MOCK_METHOD(ble_error_t, removeDeviceFromPeriodicAdvertiserList, (peer_address_type_t peerAddressType, const address_t &peerAddress, advertising_sid_t sid), (override)); |
| 63 | + MOCK_METHOD(ble_error_t, clearPeriodicAdvertiserList, (), (override)); |
| 64 | + MOCK_METHOD(ble_error_t, connect, (peer_address_type_t peerAddressType, const address_t &peerAddress, const ConnectionParameters &connectionParams), (override)); |
| 65 | + MOCK_METHOD(ble_error_t, cancelConnect, (), (override)); |
| 66 | + MOCK_METHOD(ble_error_t, updateConnectionParameters, (connection_handle_t connectionHandle, conn_interval_t minConnectionInterval, conn_interval_t maxConnectionInterval, slave_latency_t slaveLatency, supervision_timeout_t supervision_timeout, conn_event_length_t minConnectionEventLength, conn_event_length_t maxConnectionEventLength), (override)); |
| 67 | + MOCK_METHOD(ble_error_t, manageConnectionParametersUpdateRequest, (bool userManageConnectionUpdateRequest), (override)); |
| 68 | + MOCK_METHOD(ble_error_t, acceptConnectionParametersUpdate, (connection_handle_t connectionHandle, conn_interval_t minConnectionInterval, conn_interval_t maxConnectionInterval, slave_latency_t slaveLatency, supervision_timeout_t supervision_timeout, conn_event_length_t minConnectionEventLength, conn_event_length_t maxConnectionEventLength), (override)); |
| 69 | + MOCK_METHOD(ble_error_t, rejectConnectionParametersUpdate, (connection_handle_t connectionHandle), (override)); |
| 70 | + MOCK_METHOD(ble_error_t, disconnect, (connection_handle_t connectionHandle, local_disconnection_reason_t reason), (override)); |
| 71 | + MOCK_METHOD(ble_error_t, readPhy, (connection_handle_t connection), (override)); |
| 72 | + MOCK_METHOD(ble_error_t, setPreferredPhys, (const phy_set_t *txPhys, const phy_set_t *rxPhys), (override)); |
| 73 | + MOCK_METHOD(ble_error_t, setPhy, (connection_handle_t connection, const phy_set_t *txPhys, const phy_set_t *rxPhys, coded_symbol_per_bit_t codedSymbol), (override)); |
| 74 | + MOCK_METHOD(ble_error_t, enablePrivacy, (bool enable), (override)); |
| 75 | + MOCK_METHOD(ble_error_t, setPeripheralPrivacyConfiguration, (const peripheral_privacy_configuration_t *configuration), (override)); |
| 76 | + MOCK_METHOD(ble_error_t, getPeripheralPrivacyConfiguration, (peripheral_privacy_configuration_t *configuration), (override)); |
| 77 | + MOCK_METHOD(ble_error_t, setCentralPrivacyConfiguration, (const central_privacy_configuration_t *configuration), (override)); |
| 78 | + MOCK_METHOD(ble_error_t, getCentralPrivacyConfiguration, (central_privacy_configuration_t *configuration), (override)); |
| 79 | + MOCK_METHOD(uint8_t, getMaxWhitelistSize, (), (const, override)); |
| 80 | + MOCK_METHOD(ble_error_t, getWhitelist, (whitelist_t &whitelist), (const, override)); |
| 81 | + MOCK_METHOD(ble_error_t, setWhitelist, (const whitelist_t &whitelist), (override)); |
| 82 | + MOCK_METHOD(ble_error_t, getAddress, (own_address_type_t &typeP, address_t &address), (override)); |
| 83 | + MOCK_METHOD(void, onShutdown, (const GapShutdownCallback_t &callback), (override)); |
| 84 | + MOCK_METHOD(GapShutdownCallbackChain_t&, onShutdown, (), (override)); |
| 85 | + MOCK_METHOD(ble_error_t, setRandomStaticAddress, (const ble::address_t &address), (override)); |
| 86 | + MOCK_METHOD(ble::address_t, getRandomStaticAddress, (), (override)); |
| 87 | +}; |
| 88 | + |
| 89 | +} |
| 90 | + |
| 91 | +#endif //BLE_GAPMOCK_H |
0 commit comments