Skip to content

Commit

Permalink
[bbtc] Initial commit of bluetooth based commissioning.
Browse files Browse the repository at this point in the history
This commit introduces first implementation of Bluetooth based
comissioning for thread devices.

Co-authored-by: Przemyslaw Bida <[email protected]>
  • Loading branch information
arnulfrupp and canisLupus1313 committed Jun 27, 2023
1 parent 3901e29 commit 4638ddb
Show file tree
Hide file tree
Showing 30 changed files with 3,031 additions and 47 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ permissions:

jobs:

ble_sim:
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@6b3083af2869dc3314a0257a42f4af696cc79ba3 # v2.3.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Compile
run: |
./script/cmake-build simulation -DOT_BBTC=ON
expects-linux:
runs-on: ubuntu-20.04
env:
Expand Down
1 change: 1 addition & 0 deletions etc/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ot_option(OT_ASSERT OPENTHREAD_CONFIG_ASSERT_ENABLE "assert function OT_ASSERT()
ot_option(OT_BACKBONE_ROUTER OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE "backbone router functionality")
ot_option(OT_BACKBONE_ROUTER_DUA_NDPROXYING OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE "BBR DUA ND Proxy")
ot_option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE "BBR MR")
ot_option(OT_BBTC OPENTHREAD_CONFIG_BLE_SECURE_ENABLE "Ble based thread commissioning")
ot_option(OT_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent")
ot_option(OT_BORDER_AGENT_ID OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE "create and save border agent ID")
ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router")
Expand Down
3 changes: 3 additions & 0 deletions etc/gn/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ if (openthread_enable_core_config_args) {
# Enable backbone router functionality
openthread_config_backbone_router_enable = false

# Enable BLE based commissioning functionality
openthread_config_ble_secure_enable = false

# Enable border agent support
openthread_config_border_agent_enable = false

Expand Down
5 changes: 5 additions & 0 deletions examples/common-switches.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

ANYCAST_LOCATOR ?= 0
BACKBONE_ROUTER ?= 0
BBTC ?= 0
BIG_ENDIAN ?= 0
BORDER_AGENT ?= 0
BORDER_ROUTER ?= 0
Expand Down Expand Up @@ -104,6 +105,10 @@ ifeq ($(BACKBONE_ROUTER),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1
endif

ifeq ($(BBTC),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BLE_SECURE_ENABLE=1
endif

ifeq ($(BIG_ENDIAN),1)
COMMONCFLAGS += -DBYTE_ORDER_BIG_ENDIAN=1
endif
Expand Down
1 change: 1 addition & 0 deletions examples/platforms/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)

add_library(openthread-simulation
alarm.c
ble.c
crypto.c
diag.c
dso_transport.c
Expand Down
76 changes: 76 additions & 0 deletions examples/platforms/simulation/ble.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2023, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <openthread/platform/ble.h>

otError otPlatBleEnable(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NOT_IMPLEMENTED;
}

otError otPlatBleDisable(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NOT_IMPLEMENTED;
}

otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval, uint8_t aType)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aInterval);
OT_UNUSED_VARIABLE(aType);
return OT_ERROR_NOT_IMPLEMENTED;
}

otError otPlatBleGapAdvStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NOT_IMPLEMENTED;
}

otError otPlatBleGapDisconnect(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NOT_IMPLEMENTED;
}

otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aMtu);
return OT_ERROR_NOT_IMPLEMENTED;
}

otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, otBleRadioPacket *aPacket)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aHandle);
OT_UNUSED_VARIABLE(aPacket);
return OT_ERROR_NOT_IMPLEMENTED;
}
2 changes: 2 additions & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ EXTRA_DIST = \
openthread_headers = \
openthread/backbone_router.h \
openthread/backbone_router_ftd.h \
openthread/ble_secure.h \
openthread/border_agent.h \
openthread/border_router.h \
openthread/border_routing.h \
Expand Down Expand Up @@ -101,6 +102,7 @@ dist_openthread_HEADERS = $(openthread_headers)
ot_platform_headers = \
openthread/platform/alarm-micro.h \
openthread/platform/alarm-milli.h \
openthread/platform/ble.h \
openthread/platform/border_routing.h \
openthread/platform/crypto.h \
openthread/platform/debug_uart.h \
Expand Down
2 changes: 2 additions & 0 deletions include/openthread/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ source_set("openthread") {
public = [
"backbone_router.h",
"backbone_router_ftd.h",
"ble_secure.h",
"border_agent.h",
"border_router.h",
"border_routing.h",
Expand Down Expand Up @@ -84,6 +85,7 @@ source_set("openthread") {
"ping_sender.h",
"platform/alarm-micro.h",
"platform/alarm-milli.h",
"platform/ble.h",
"platform/border_routing.h",
"platform/crypto.h",
"platform/debug_uart.h",
Expand Down
Loading

0 comments on commit 4638ddb

Please sign in to comment.