diff --git a/bluetooth_stack_features.slce b/bluetooth_stack_features.slce index 0e41b8d..417ca61 100644 --- a/bluetooth_stack_features.slce +++ b/bluetooth_stack_features.slce @@ -1,10 +1,10 @@ id: bluetooth_stack_features -label: Bluetooth Stack Features +label: Bluetooth Stack Features examples description: > Bluetooth Stack Features -version: 0.0.1 -sdk: - id: "gecko_sdk" - version: 4.1.2 -component_path: - - path: "component/connection_manager" +documentation: + - docset: unknown + version: 0.0.0 +version: 0.0.0 +supplier: Silicon Laboratories Inc. +vendor: silabs diff --git a/bluetooth_stack_features.slsdk b/bluetooth_stack_features.slsdk deleted file mode 100644 index 20e29e8..0000000 --- a/bluetooth_stack_features.slsdk +++ /dev/null @@ -1,10 +0,0 @@ -# Properties file for Simplicity Studio metadata -id=uc.extension.bluetooth_stack_features - -version=1.1.0 - -label=Bluetooth Stack Features -description=Bluetooth Stack Features - -prop.file.templatesFile=templates.xml -prop.subLabel=Bluetooth\\ Stack\\ Features\\ 1.1.0 diff --git a/bluetooth_stack_features_app.slsdk b/bluetooth_stack_features_app.slsdk new file mode 100644 index 0000000..071b8a0 --- /dev/null +++ b/bluetooth_stack_features_app.slsdk @@ -0,0 +1,5 @@ +id=com.silabs.sdk.bluetooth_stack_features_app +version=1.0.1 +label=Bluetooth Stack Features Example Applications +description=Bluetooth Stack Features Example Applications +prop.file.templatesFile=bluetooth_stack_features_app_templates.xml diff --git a/templates.xml b/bluetooth_stack_features_app_templates.xml similarity index 100% rename from templates.xml rename to bluetooth_stack_features_app_templates.xml diff --git a/component/connection_manager/README.md b/component/connection_manager/README.md deleted file mode 100644 index 006f6f3..0000000 --- a/component/connection_manager/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# Connection Manager SDK Extension # - -## Description ## - -This SDK Extension is aimed to simplify the managing of Bluetooth connections. - -The API provides the possibility to retrieve the handles of all the active Bluetooth connections, get all the connection details either by these handles or by a Bluetooth address, and query the leftover space in the connection pool. - -Please, see the connection_manager.h header file for the detail API explanation. - -## Gecko SDK version ## - -GSDK v4.2.0 - ---- - -## Important - -This project README assumes that the reader is familiar with the usage of SiliconLabs Simplicity Studio 5 and the provided example projects within it. - ---- - -## Requirements - - - Simplicity Studio 5 with the latest GSDK - -## Known limitations: - - - The repo has to be cloned, direct git url cannot be used as external SDK Extension source. - -## Instructions - - - Clone the repo first - - Add the repo as an SDK Extension source to the latest GSDK - - For this, click Manage SDKs - - - Select the SDK you wish to add the extension to, and click Add Extension... - - - Browse to the cloned repo, Simplicity will detect the SDK Extension in it - - - You may have to click Trust, as the Extension was fetched from an external source - - - - Create a new project, for example a ```Bluetooth - SoC Empty``` one - - Add the Connection Manager Component to the project from the Software Components - - For this, filter for SDK Extensions and enable the Bluetooth Stack Features SDK Extension (if not visible, you may have to alter the Quality filter) - - - After enabling the Extension, you have to install the Connection Manager Component, by selecting it and clicking Install - - - - If all this has been successfully done, the files will be visible in the source tree and the functionalities can be utilized by adding the header to the ```app.c``` - ```c - #include "connection_manager.h" - ``` - - ---- diff --git a/component/connection_manager/connection_manager.slcc b/component/connection_manager/connection_manager.slcc deleted file mode 100644 index d1fb0ec..0000000 --- a/component/connection_manager/connection_manager.slcc +++ /dev/null @@ -1,31 +0,0 @@ -id: connection_manager -label: Connection Manager -package: bluetooth -description: API for managing multiple connections at once -category: Connections -quality: alpha -root_path: connections/connection_manager/ -source: - - path: src/connection_manager.c -include: - - path: inc - file_list: - - path: connection_manager.h -provides: - - name: connection_manager -requires: - - name: bluetooth_stack - - name: gatt_configuration - - name: bluetooth_feature_connection - - name: bluetooth_feature_gatt_server - - name: bluetooth_feature_system -template_contribution: - - name: event_handler - value: - event: internal_app_init - include: connection_manager.h - handler: sli_bt_cm_init - - name: bluetooth_on_event - value: - include: connection_manager.h - function: sli_bt_cm_on_event diff --git a/component/connection_manager/images/add_extension.png b/component/connection_manager/images/add_extension.png deleted file mode 100644 index 8678fe7..0000000 Binary files a/component/connection_manager/images/add_extension.png and /dev/null differ diff --git a/component/connection_manager/images/browse_extension.png b/component/connection_manager/images/browse_extension.png deleted file mode 100644 index 25ca69a..0000000 Binary files a/component/connection_manager/images/browse_extension.png and /dev/null differ diff --git a/component/connection_manager/images/cm_installed.png b/component/connection_manager/images/cm_installed.png deleted file mode 100644 index 522d675..0000000 Binary files a/component/connection_manager/images/cm_installed.png and /dev/null differ diff --git a/component/connection_manager/images/enable_extension.png b/component/connection_manager/images/enable_extension.png deleted file mode 100644 index bff7144..0000000 Binary files a/component/connection_manager/images/enable_extension.png and /dev/null differ diff --git a/component/connection_manager/images/install_component.png b/component/connection_manager/images/install_component.png deleted file mode 100644 index 9cca7ed..0000000 Binary files a/component/connection_manager/images/install_component.png and /dev/null differ diff --git a/component/connection_manager/images/manage_sdks.png b/component/connection_manager/images/manage_sdks.png deleted file mode 100644 index 4c6a92d..0000000 Binary files a/component/connection_manager/images/manage_sdks.png and /dev/null differ diff --git a/component/connection_manager/images/trust_extension.png b/component/connection_manager/images/trust_extension.png deleted file mode 100644 index 3c3cbd1..0000000 Binary files a/component/connection_manager/images/trust_extension.png and /dev/null differ diff --git a/component/connection_manager/inc/connection_manager.h b/component/connection_manager/inc/connection_manager.h deleted file mode 100644 index 96f6eec..0000000 --- a/component/connection_manager/inc/connection_manager.h +++ /dev/null @@ -1,128 +0,0 @@ -/***************************************************************************//** - * @file - * @brief Connection Manager - ******************************************************************************* - * # License - * Copyright 2022 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * SPDX-License-Identifier: Zlib - * - * The licensor of this software is Silicon Laboratories Inc. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgement in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - ******************************************************************************/ -#include "sl_bluetooth.h" - -/***************************************************************************//** - * @brief Data structure of the connection pool - ******************************************************************************/ -typedef struct { - bd_addr address; - uint8_t address_type; - uint8_t master; - uint8_t bonding; - uint8_t advertiser; - uint16_t interval; - uint16_t latency; - uint16_t timeout; - uint16_t txsize; - uint8_t security_mode; - uint8_t handle; -} connection_t; - -void sli_bt_cm_init(void); -void sli_bt_cm_on_event(sl_bt_msg_t *evt); - -sl_status_t sli_bt_cm_add_connection(sl_bt_evt_connection_opened_t *evt_data); -sl_status_t sli_bt_cm_update_parameters(sl_bt_evt_connection_parameters_t *evt_data); -sl_status_t sli_bt_cm_update_bonding(sl_bt_evt_sm_bonded_t *evt_data); -sl_status_t sli_bt_cm_remove_connection(sl_bt_evt_connection_closed_t *evt_data); - -/***************************************************************************//** - * - * Retrieve all the connection handles from the connection pool - * - * In the first argument, provide the initial array to place the connection - * handles into. In the second, place the size of your initial array, after - * the function call this will change to the number of the valid handles - * in the array. - * - * SL_STATUS_WOULD_OVERFLOW will be returned, if the number of handles would - * exceed the size of the provided array, SL_STATUS_EMPTY if no valid handles - * to be found. - * - * @param[out] connection_handles Array to store the handles - * @param[in/out] size Length of data in @p connection_handles - * - * @return SL_STATUS_OK if successful. Error code otherwise. - * - ******************************************************************************/ -sl_status_t sl_bt_cm_get_connection_handles(uint8_t *connection_handles, uint8_t *size); - -/***************************************************************************//** - * - * Retrieve a connection by the provided handle - * - * In the first argument, provide the handle for the connection you are looking - * for, in the second one, provide a pointer for the connection itself. - * - * SL_STATUS_NOT_FOUND will be returned, if no connection to be found. - * - * @param[in] connection_handle Handle to look for - * @param[out] connection Pointer to the connection - * - * @return SL_STATUS_OK if successful. Error code otherwise. - * - ******************************************************************************/ -sl_status_t sl_bt_cm_get_connection_by_handle(uint8_t connection_handle, connection_t **connection); - -/***************************************************************************//** - * - * Retrieve a connection by the provided address - * - * In the first argument, provide the address pointer for the connection you are - * looking for, in the second one, provide a pointer for the connection itself. - * - * SL_STATUS_NOT_FOUND will be returned, if no connection to be found. - * - * @param[in] address Pointer to the address to look for - * @param[out] connection Pointer to the connection - * - * @return SL_STATUS_OK if successful. Error code otherwise. - * - ******************************************************************************/ -sl_status_t sl_bt_cm_get_connection_by_address(bd_addr *address, connection_t **connection); - -/***************************************************************************//** - * - * Retrieve the connection pool state - * - * @return true if the pool is full, false otherwise. - * - ******************************************************************************/ -bool sl_bt_cm_is_connection_list_full(void); - -/***************************************************************************//** - * - * Retrieve the leftover space in the connection pool - * - * @return The amount of places left in the pool - * - ******************************************************************************/ -uint8_t sl_bt_cm_get_leftover_space(void); diff --git a/component/connection_manager/src/connection_manager.c b/component/connection_manager/src/connection_manager.c deleted file mode 100644 index 8815572..0000000 --- a/component/connection_manager/src/connection_manager.c +++ /dev/null @@ -1,188 +0,0 @@ -/***************************************************************************//** - * @file - * @brief Connection Manager - ******************************************************************************* - * # License - * Copyright 2022 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * SPDX-License-Identifier: Zlib - * - * The licensor of this software is Silicon Laboratories Inc. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgement in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - ******************************************************************************/ -#include "sl_bluetooth.h" -#include "connection_manager.h" - -static connection_t connections[SL_BT_CONFIG_MAX_CONNECTIONS]; - -void sli_bt_cm_init(void) -{ - memset(&connections, 0x00, SL_BT_CONFIG_MAX_CONNECTIONS * sizeof(connection_t)); -} - -void sli_bt_cm_on_event(sl_bt_msg_t *evt) -{ - switch (SL_BT_MSG_ID(evt->header)) { - case sl_bt_evt_connection_opened_id: - sli_bt_cm_add_connection(&evt->data.evt_connection_opened); - break; - case sl_bt_evt_connection_parameters_id: - sli_bt_cm_update_parameters(&evt->data.evt_connection_parameters); - break; - case sl_bt_evt_sm_bonded_id: - sli_bt_cm_update_bonding(&evt->data.evt_sm_bonded); - break; - case sl_bt_evt_connection_closed_id: - sli_bt_cm_remove_connection(&evt->data.evt_connection_closed); - break; - } -} - -sl_status_t sli_bt_cm_add_connection(sl_bt_evt_connection_opened_t *evt_data) -{ - sl_status_t sc; - connection_t *connection; - sc = sl_bt_cm_get_connection_by_handle(0x00, &connection); - - if (sc != SL_STATUS_OK) { - return SL_STATUS_FULL; - } - - connection->address = evt_data->address; - connection->address_type = evt_data->address_type; - connection->master = evt_data->master; - connection->bonding = evt_data->bonding; - connection->advertiser = evt_data->advertiser; - connection->handle = evt_data->connection; - - return SL_STATUS_OK; -} - -sl_status_t sli_bt_cm_update_parameters(sl_bt_evt_connection_parameters_t *evt_data) -{ - sl_status_t sc; - connection_t *connection; - sc = sl_bt_cm_get_connection_by_handle(evt_data->connection, &connection); - - if (sc != SL_STATUS_OK) { - return sc; - } - - connection->interval = evt_data->interval; - connection->latency = evt_data->latency; - connection->timeout = evt_data->timeout; - connection->security_mode = evt_data->security_mode; - connection->txsize = evt_data->txsize; - - return SL_STATUS_OK; -} - -sl_status_t sli_bt_cm_update_bonding(sl_bt_evt_sm_bonded_t *evt_data) -{ - sl_status_t sc; - connection_t *connection; - sc = sl_bt_cm_get_connection_by_handle(evt_data->connection, &connection); - - if (sc != SL_STATUS_OK) { - return sc; - } - - connection->bonding = evt_data->bonding; - connection->security_mode = evt_data->security_mode; - - return SL_STATUS_OK; -} - -sl_status_t sli_bt_cm_remove_connection(sl_bt_evt_connection_closed_t *evt_data) -{ - sl_status_t sc; - connection_t *connection; - sc = sl_bt_cm_get_connection_by_handle(evt_data->connection, &connection); - - if (sc != SL_STATUS_OK) { - return sc; - } - - connection->handle = 0x00; - - return SL_STATUS_OK; -} - -sl_status_t sl_bt_cm_get_connection_handles(uint8_t *connection_handles, uint8_t *size) -{ - uint8_t handle_index = 0; - for (uint8_t connection_index = 0; connection_index < SL_BT_CONFIG_MAX_CONNECTIONS; connection_index++) { - if (connections[connection_index].handle != 0x00) { - if (handle_index == *size) { - return SL_STATUS_WOULD_OVERFLOW; - } - connection_handles[handle_index] = connections[connection_index].handle; - handle_index++; - } - } - - (*size) = handle_index; - return (*size == 0) ? SL_STATUS_EMPTY : SL_STATUS_OK; -} - -sl_status_t sl_bt_cm_get_connection_by_handle(uint8_t connection_handle, connection_t **connection) -{ - for (uint8_t connection_index = 0; connection_index < SL_BT_CONFIG_MAX_CONNECTIONS; connection_index++) { - if (connections[connection_index].handle == connection_handle) { - *connection = &connections[connection_index]; - return SL_STATUS_OK; - } - } - - return SL_STATUS_NOT_FOUND; -} - -sl_status_t sl_bt_cm_get_connection_by_address(bd_addr *address, connection_t **connection) -{ - for (uint8_t connection_index = 0; connection_index < SL_BT_CONFIG_MAX_CONNECTIONS; connection_index++) { - if (0 == memcmp(address, &(connections[connection_index].address), sizeof(bd_addr))) { - *connection = &connections[connection_index]; - return SL_STATUS_OK; - } - } - - return SL_STATUS_NOT_FOUND; -} - -bool sl_bt_cm_is_connection_list_full(void) -{ - sl_status_t sc; - connection_t *connection; - sc = sl_bt_cm_get_connection_by_handle(0x00, &connection); - - return sc == SL_STATUS_NOT_FOUND; -} - -uint8_t sl_bt_cm_get_leftover_space(void) -{ - uint8_t leftover = 0; - for (uint8_t connection_index = 0; connection_index < SL_BT_CONFIG_MAX_CONNECTIONS; connection_index++) { - if (connections[connection_index].handle == 0x00) { - leftover++; - } - } - - return leftover; -}