Add bumble-console --device-config support for gatt services

This PR adds support for bumble-console to be preloaded with gatt services via `--device-config`.
This PR also adds some type annotations
This commit is contained in:
Alan Rosenthal
2022-11-28 14:11:27 -05:00
parent b437bd8619
commit f56ac14f2c
8 changed files with 118 additions and 17 deletions

View File

@@ -15,8 +15,7 @@
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
from bumble.core import AdvertisingData
from bumble.core import AdvertisingData, get_dict_key_by_value
# -----------------------------------------------------------------------------
def test_ad_data():
@@ -39,6 +38,16 @@ def test_ad_data():
assert(ad.get(AdvertisingData.TX_POWER_LEVEL, return_all=True, raw=True) == [bytes([123]), bytes([234])])
# -----------------------------------------------------------------------------
def test_get_dict_key_by_value():
dictionary = {
"A": 1,
"B": 2
}
assert get_dict_key_by_value(dictionary, 1) == "A"
assert get_dict_key_by_value(dictionary, 2) == "B"
assert get_dict_key_by_value(dictionary, 3) is None
# -----------------------------------------------------------------------------
if __name__ == '__main__':
test_ad_data()