-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/sx126x-select-pins
- Loading branch information
Showing
383 changed files
with
17,558 additions
and
7,940 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
path_classifiers: | ||
docs: | ||
- docs | ||
test: | ||
- "**/TESTS" | ||
- "**/UNITTESTS" | ||
tools: | ||
- tools | ||
|
||
extraction: | ||
cpp: | ||
prepare: | ||
packages: | ||
- ninja-build | ||
- python-pip | ||
after_prepare: | ||
- pip install --user cmake | ||
- ls ~/.local/bin | ||
- export PATH=~/.local/bin:$PATH | ||
- cmake --version | ||
configure: | ||
command: | ||
- cmake -S . -B __build -GNinja -DBUILD_TESTING=ON -DCOVERAGE=OFF -DCMAKE_BUILD_TYPE=Debug | ||
index: | ||
build_command: | ||
- cmake --build __build | ||
- cmake --build __build --target test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"macros": [ | ||
"MBEDTLS_SELF_TEST", | ||
"MBEDTLS_TIMING_C", | ||
"MBEDTLS_TIMING_ALT" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2020 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_subdirectory(events) | ||
add_subdirectory(ble) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
/* mbed Microcontroller Library | ||
* Copyright (c) 2020 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/BLE.h" | ||
#include "GattServerImpl_mock.h" | ||
#include "GattClientImpl_mock.h" | ||
#include "GapImpl_mock.h" | ||
#include "SecurityManagerImpl_mock.h" | ||
#include "ble/GattClient.h" | ||
#include "ble/GattServer.h" | ||
#include "ble/SecurityManager.h" | ||
#include "ble/Gap.h" | ||
#include "ble_mocks.h" | ||
|
||
namespace ble { | ||
|
||
static GapMock *gap_impl = nullptr; | ||
static GattServerMock *gatt_server_impl = nullptr; | ||
static GattClientMock *gatt_client_impl = nullptr; | ||
static SecurityManagerMock *security_manager_impl = nullptr; | ||
|
||
static Gap *gap = nullptr; | ||
static GattServer *gatt_server = nullptr; | ||
static GattClient *gatt_client = nullptr; | ||
static SecurityManager *security_manager = nullptr; | ||
|
||
GapMock& gap_mock() { | ||
return *ble::gap_impl; | ||
} | ||
|
||
GattServerMock& gatt_server_mock() { | ||
return *ble::gatt_server_impl; | ||
} | ||
|
||
GattClientMock& gatt_client_mock() { | ||
return *ble::gatt_client_impl; | ||
} | ||
|
||
SecurityManagerMock& security_manager_mock() { | ||
return *ble::security_manager_impl; | ||
} | ||
|
||
void init_mocks() { | ||
if (gap_impl) { | ||
/* we are already initialised */ | ||
return; | ||
} | ||
|
||
/* mocks */ | ||
gap_impl = new GapMock(); | ||
gatt_server_impl = new GattServerMock(); | ||
gatt_client_impl = new GattClientMock(); | ||
security_manager_impl = new SecurityManagerMock(); | ||
/* user APIS */ | ||
gap = new Gap(gap_impl); | ||
gatt_server = new GattServer(gatt_server_impl); | ||
gatt_client = new GattClient(gatt_client_impl); | ||
security_manager = new SecurityManager(security_manager_impl); | ||
} | ||
|
||
void delete_mocks() { | ||
delete gap; | ||
delete gap_impl; | ||
delete gatt_server; | ||
delete gatt_server_impl; | ||
delete gatt_client; | ||
delete gatt_client_impl; | ||
delete security_manager; | ||
delete security_manager_impl; | ||
|
||
gap = nullptr; | ||
gap_impl = nullptr; | ||
gatt_server = nullptr; | ||
gatt_server_impl = nullptr; | ||
gatt_client = nullptr; | ||
gatt_client_impl = nullptr; | ||
security_manager = nullptr; | ||
security_manager_impl = nullptr; | ||
} | ||
|
||
class BLEInstanceBase { | ||
}; | ||
|
||
BLE::BLE(ble::BLEInstanceBase &transport) : transport(transport) | ||
{ | ||
} | ||
|
||
BLE& BLE::Instance() | ||
{ | ||
static ble::BLEInstanceBase transport; | ||
static BLE instance(transport); | ||
init_mocks(); | ||
return instance; | ||
} | ||
|
||
ble::Gap &BLE::gap() | ||
{ | ||
init_mocks(); | ||
return *ble::gap; | ||
} | ||
|
||
ble::GattServer &BLE::gattServer() | ||
{ | ||
init_mocks(); | ||
return *ble::gatt_server; | ||
} | ||
|
||
ble::GattClient &BLE::gattClient() | ||
{ | ||
init_mocks(); | ||
return *ble::gatt_client; | ||
} | ||
|
||
ble::SecurityManager &BLE::securityManager() | ||
{ | ||
init_mocks(); | ||
return *ble::security_manager; | ||
} | ||
|
||
const ble::Gap &BLE::gap() const | ||
{ | ||
auto &self = const_cast<BLE &>(*this); | ||
return const_cast<const ble::Gap &>(self.gap()); | ||
} | ||
|
||
const ble::GattServer &BLE::gattServer() const | ||
{ | ||
auto &self = const_cast<BLE &>(*this); | ||
return const_cast<const ble::GattServer &>(self.gattServer()); | ||
} | ||
|
||
const ble::GattClient &BLE::gattClient() const | ||
{ | ||
auto &self = const_cast<BLE &>(*this); | ||
return const_cast<const ble::GattClient &>(self.gattClient()); | ||
} | ||
|
||
const ble::SecurityManager &BLE::securityManager() const | ||
{ | ||
auto &self = const_cast<BLE &>(*this); | ||
return const_cast<const ble::SecurityManager &>(self.securityManager()); | ||
} | ||
|
||
void BLE::processEvents() | ||
{ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2020 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_library(mbed-fakes-ble) | ||
|
||
target_include_directories(mbed-fakes-ble | ||
PUBLIC | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/ | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/include | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/include/ble | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source | ||
PRIVATE | ||
${gtest_SOURCE_DIR}/include | ||
${gmock_SOURCE_DIR}/include | ||
) | ||
|
||
target_sources(mbed-fakes-ble | ||
PRIVATE | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/gap/AdvertisingDataBuilder.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/gap/AdvertisingParameters.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/gap/ConnectionParameters.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/gatt/DiscoveredCharacteristic.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/Gap.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/GattClient.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/GattServer.cpp | ||
${mbed-os_SOURCE_DIR}/connectivity/FEATURE_BLE/source/SecurityManager.cpp | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/BLE.cpp | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/source/GattServerImpl_mock.cpp | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/ble_mocks.h | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/GapImpl_mock.h | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/GattClientImpl_mock.h | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/GattServerImpl_mock.h | ||
${mbed-os_SOURCE_DIR}/UNITTESTS/fakes/ble/SecurityManagerImpl_mock.h | ||
) | ||
|
||
target_link_libraries(mbed-fakes-ble | ||
PRIVATE | ||
mbed-headers | ||
mbed-stubs-headers | ||
gcov | ||
) |
Oops, something went wrong.