From b4a8229db66e1ddb551d588f723ae2e2efc6ced5 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 4 Sep 2020 10:18:09 +0200 Subject: [PATCH] Bluetooth: Remove _gatt_ infix for Battery Service (BAS) The _gatt_ infix was determined to be unnecessary as GATT is implied by it being a Bluetooth service. Signed-off-by: Emil Gydesen --- include/bluetooth/services/bas.h | 6 +++--- samples/bluetooth/peripheral/prj.conf | 2 +- samples/bluetooth/peripheral/src/main.c | 4 ++-- samples/bluetooth/peripheral_csc/prj.conf | 2 +- samples/bluetooth/peripheral_csc/src/main.c | 4 ++-- samples/bluetooth/peripheral_esp/prj.conf | 2 +- samples/bluetooth/peripheral_esp/src/main.c | 4 ++-- samples/bluetooth/peripheral_hids/prj.conf | 2 +- samples/bluetooth/peripheral_hr/prj.conf | 2 +- samples/bluetooth/peripheral_hr/src/main.c | 4 ++-- samples/bluetooth/peripheral_ht/prj.conf | 2 +- samples/bluetooth/peripheral_ht/src/main.c | 4 ++-- subsys/bluetooth/services/CMakeLists.txt | 2 +- subsys/bluetooth/services/Kconfig.bas | 6 +++--- subsys/bluetooth/services/bas.c | 6 +++--- tests/bluetooth/bsim_bt/bsim_test_app/prj_split.conf | 2 +- .../bluetooth/bsim_bt/bsim_test_app/prj_split_privacy.conf | 2 +- tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c | 4 ++-- 18 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/bluetooth/services/bas.h b/include/bluetooth/services/bas.h index 54711aed44c..06a3b295bab 100644 --- a/include/bluetooth/services/bas.h +++ b/include/bluetooth/services/bas.h @@ -10,7 +10,7 @@ /** * @brief Battery Service (BAS) - * @defgroup bt_gatt_bas Battery Service (BAS) + * @defgroup bt_bas Battery Service (BAS) * @ingroup bluetooth * @{ * @@ -30,7 +30,7 @@ extern "C" { * * @return The battery level in percent. */ -uint8_t bt_gatt_bas_get_battery_level(void); +uint8_t bt_bas_get_battery_level(void); /** @brief Update battery level value. * @@ -41,7 +41,7 @@ uint8_t bt_gatt_bas_get_battery_level(void); * * @return Zero in case of success and error code in case of error. */ -int bt_gatt_bas_set_battery_level(uint8_t level); +int bt_bas_set_battery_level(uint8_t level); #ifdef __cplusplus diff --git a/samples/bluetooth/peripheral/prj.conf b/samples/bluetooth/peripheral/prj.conf index d31cf9e3029..56029252b66 100644 --- a/samples/bluetooth/peripheral/prj.conf +++ b/samples/bluetooth/peripheral/prj.conf @@ -8,7 +8,7 @@ CONFIG_BT_SIGNING=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_GATT_DIS=y CONFIG_BT_ATT_PREPARE_COUNT=5 -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_GATT_HRS=y CONFIG_BT_PRIVACY=y CONFIG_BT_DEVICE_NAME="Zephyr Peripheral Sample Long Name" diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index bf27d7ad1c0..ee1b6b5d6c5 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -294,7 +294,7 @@ static struct bt_conn_auth_cb auth_cb_display = { static void bas_notify(void) { - uint8_t battery_level = bt_gatt_bas_get_battery_level(); + uint8_t battery_level = bt_bas_get_battery_level(); battery_level--; @@ -302,7 +302,7 @@ static void bas_notify(void) battery_level = 100U; } - bt_gatt_bas_set_battery_level(battery_level); + bt_bas_set_battery_level(battery_level); } static void hrs_notify(void) diff --git a/samples/bluetooth/peripheral_csc/prj.conf b/samples/bluetooth/peripheral_csc/prj.conf index aa6ca4a3af5..73d86ca1469 100644 --- a/samples/bluetooth/peripheral_csc/prj.conf +++ b/samples/bluetooth/peripheral_csc/prj.conf @@ -4,6 +4,6 @@ CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_GATT_DIS=y CONFIG_BT_GATT_DIS_PNP=n -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_DEVICE_NAME="CSC peripheral" CONFIG_BT_DEVICE_APPEARANCE=1157 diff --git a/samples/bluetooth/peripheral_csc/src/main.c b/samples/bluetooth/peripheral_csc/src/main.c index 95affdf2a75..40fcbc063bd 100644 --- a/samples/bluetooth/peripheral_csc/src/main.c +++ b/samples/bluetooth/peripheral_csc/src/main.c @@ -385,7 +385,7 @@ static void bt_ready(void) static void bas_notify(void) { - uint8_t battery_level = bt_gatt_bas_get_battery_level(); + uint8_t battery_level = bt_bas_get_battery_level(); battery_level--; @@ -393,7 +393,7 @@ static void bas_notify(void) battery_level = 100U; } - bt_gatt_bas_set_battery_level(battery_level); + bt_bas_set_battery_level(battery_level); } void main(void) diff --git a/samples/bluetooth/peripheral_esp/prj.conf b/samples/bluetooth/peripheral_esp/prj.conf index 4c0306c3d2e..fde02fa69da 100644 --- a/samples/bluetooth/peripheral_esp/prj.conf +++ b/samples/bluetooth/peripheral_esp/prj.conf @@ -5,5 +5,5 @@ CONFIG_TINYCRYPT=y CONFIG_BT_DEVICE_NAME="ESP peripheral" CONFIG_BT_GATT_DIS=y CONFIG_BT_GATT_DIS_PNP=n -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_DEVICE_APPEARANCE=768 diff --git a/samples/bluetooth/peripheral_esp/src/main.c b/samples/bluetooth/peripheral_esp/src/main.c index 1345d41ac67..0618da1fff3 100644 --- a/samples/bluetooth/peripheral_esp/src/main.c +++ b/samples/bluetooth/peripheral_esp/src/main.c @@ -406,7 +406,7 @@ static struct bt_conn_auth_cb auth_cb_display = { static void bas_notify(void) { - uint8_t battery_level = bt_gatt_bas_get_battery_level(); + uint8_t battery_level = bt_bas_get_battery_level(); battery_level--; @@ -414,7 +414,7 @@ static void bas_notify(void) battery_level = 100U; } - bt_gatt_bas_set_battery_level(battery_level); + bt_bas_set_battery_level(battery_level); } void main(void) diff --git a/samples/bluetooth/peripheral_hids/prj.conf b/samples/bluetooth/peripheral_hids/prj.conf index 5ee5c91e1af..e2751b599dc 100644 --- a/samples/bluetooth/peripheral_hids/prj.conf +++ b/samples/bluetooth/peripheral_hids/prj.conf @@ -6,7 +6,7 @@ CONFIG_BT_DEBUG_LOG=y CONFIG_BT_SMP=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_GATT_DIS=y -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_DEVICE_NAME="Test HoG mouse" CONFIG_BT_DEVICE_APPEARANCE=962 diff --git a/samples/bluetooth/peripheral_hr/prj.conf b/samples/bluetooth/peripheral_hr/prj.conf index 3dfa8796b8c..f9d2c8dcb9b 100644 --- a/samples/bluetooth/peripheral_hr/prj.conf +++ b/samples/bluetooth/peripheral_hr/prj.conf @@ -4,7 +4,7 @@ CONFIG_BT_SMP=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_GATT_DIS=y CONFIG_BT_GATT_DIS_PNP=n -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_GATT_HRS=y CONFIG_BT_DEVICE_NAME="Zephyr Heartrate Sensor" CONFIG_BT_DEVICE_APPEARANCE=833 diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 42ec6071338..d3560f6709f 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -87,7 +87,7 @@ static struct bt_conn_auth_cb auth_cb_display = { static void bas_notify(void) { - uint8_t battery_level = bt_gatt_bas_get_battery_level(); + uint8_t battery_level = bt_bas_get_battery_level(); battery_level--; @@ -95,7 +95,7 @@ static void bas_notify(void) battery_level = 100U; } - bt_gatt_bas_set_battery_level(battery_level); + bt_bas_set_battery_level(battery_level); } static void hrs_notify(void) diff --git a/samples/bluetooth/peripheral_ht/prj.conf b/samples/bluetooth/peripheral_ht/prj.conf index 3e6cdfeafad..253ca946fcb 100644 --- a/samples/bluetooth/peripheral_ht/prj.conf +++ b/samples/bluetooth/peripheral_ht/prj.conf @@ -4,7 +4,7 @@ CONFIG_BT_SMP=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_GATT_DIS=y CONFIG_BT_GATT_DIS_PNP=n -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_DEVICE_NAME="Zephyr Health Thermometer" CONFIG_BT_DEVICE_APPEARANCE=768 CONFIG_BT_ATT_ENFORCE_FLOW=n diff --git a/samples/bluetooth/peripheral_ht/src/main.c b/samples/bluetooth/peripheral_ht/src/main.c index 4af12342219..acccec6728a 100644 --- a/samples/bluetooth/peripheral_ht/src/main.c +++ b/samples/bluetooth/peripheral_ht/src/main.c @@ -90,7 +90,7 @@ static struct bt_conn_auth_cb auth_cb_display = { static void bas_notify(void) { - uint8_t battery_level = bt_gatt_bas_get_battery_level(); + uint8_t battery_level = bt_bas_get_battery_level(); battery_level--; @@ -98,7 +98,7 @@ static void bas_notify(void) battery_level = 100U; } - bt_gatt_bas_set_battery_level(battery_level); + bt_bas_set_battery_level(battery_level); } void main(void) diff --git a/subsys/bluetooth/services/CMakeLists.txt b/subsys/bluetooth/services/CMakeLists.txt index a321120997c..58cf59612b7 100644 --- a/subsys/bluetooth/services/CMakeLists.txt +++ b/subsys/bluetooth/services/CMakeLists.txt @@ -3,6 +3,6 @@ zephyr_sources_ifdef(CONFIG_BT_GATT_DIS dis.c) -zephyr_sources_ifdef(CONFIG_BT_GATT_BAS bas.c) +zephyr_sources_ifdef(CONFIG_BT_BAS bas.c) zephyr_sources_ifdef(CONFIG_BT_GATT_HRS hrs.c) diff --git a/subsys/bluetooth/services/Kconfig.bas b/subsys/bluetooth/services/Kconfig.bas index 88d22bd8c02..199336e7c9d 100644 --- a/subsys/bluetooth/services/Kconfig.bas +++ b/subsys/bluetooth/services/Kconfig.bas @@ -3,16 +3,16 @@ # Copyright (c) 2018 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -menuconfig BT_GATT_BAS +menuconfig BT_BAS bool "Enable GATT Battery service" select SENSOR -config BT_GATT_BAS_LOG_LEVEL +config BT_BAS_LOG_LEVEL int "Battery service log level" depends on LOG range 0 4 default 0 - depends on BT_GATT_BAS + depends on BT_BAS help Sets log level for the Battery service. Levels are: diff --git a/subsys/bluetooth/services/bas.c b/subsys/bluetooth/services/bas.c index e1a5422fd44..17a90320d34 100644 --- a/subsys/bluetooth/services/bas.c +++ b/subsys/bluetooth/services/bas.c @@ -21,7 +21,7 @@ #include #include -#define LOG_LEVEL CONFIG_BT_GATT_BAS_LOG_LEVEL +#define LOG_LEVEL CONFIG_BT_BAS_LOG_LEVEL #include LOG_MODULE_REGISTER(bas); @@ -64,12 +64,12 @@ static int bas_init(const struct device *dev) return 0; } -uint8_t bt_gatt_bas_get_battery_level(void) +uint8_t bt_bas_get_battery_level(void) { return battery_level; } -int bt_gatt_bas_set_battery_level(uint8_t level) +int bt_bas_set_battery_level(uint8_t level) { int rc; diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/prj_split.conf b/tests/bluetooth/bsim_bt/bsim_test_app/prj_split.conf index 70031a196c2..205d1b32559 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/prj_split.conf +++ b/tests/bluetooth/bsim_bt/bsim_test_app/prj_split.conf @@ -5,7 +5,7 @@ CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y CONFIG_BT_SMP=y CONFIG_BT_SIGNING=y -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_GATT_HRS=y CONFIG_BT_ATT_PREPARE_COUNT=2 CONFIG_BT_GATT_CLIENT=y diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/prj_split_privacy.conf b/tests/bluetooth/bsim_bt/bsim_test_app/prj_split_privacy.conf index 927796b2289..f0c3c05e01b 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/prj_split_privacy.conf +++ b/tests/bluetooth/bsim_bt/bsim_test_app/prj_split_privacy.conf @@ -5,7 +5,7 @@ CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y CONFIG_BT_SMP=y CONFIG_BT_SIGNING=y -CONFIG_BT_GATT_BAS=y +CONFIG_BT_BAS=y CONFIG_BT_GATT_HRS=y CONFIG_BT_ATT_PREPARE_COUNT=2 CONFIG_BT_GATT_CLIENT=y diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c index d8b0d6f6a28..71d89a256bf 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c +++ b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c @@ -119,7 +119,7 @@ static void bt_ready(void) static void bas_notify(void) { - uint8_t battery_level = bt_gatt_bas_get_battery_level(); + uint8_t battery_level = bt_bas_get_battery_level(); battery_level--; @@ -127,7 +127,7 @@ static void bas_notify(void) battery_level = 100U; } - bt_gatt_bas_set_battery_level(battery_level); + bt_bas_set_battery_level(battery_level); } static void hrs_notify(void)