diff --git a/ch-13/ble-tests/computer/poetry.lock b/ch-13/ble-tests/computer/poetry.lock new file mode 100644 index 0000000..d6d68bb --- /dev/null +++ b/ch-13/ble-tests/computer/poetry.lock @@ -0,0 +1,314 @@ +[[package]] +name = "async-timeout" +version = "4.0.2" +description = "Timeout context manager for asyncio programs" +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "black" +version = "22.10.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} +typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "bleak" +version = "0.19.0" +description = "Bluetooth Low Energy platform Agnostic Klient" +category = "main" +optional = false +python-versions = ">=3.7,<4.0" + +[package.dependencies] +async-timeout = ">=3.0.0,<5" +bleak-winrt = {version = ">=1.2.0,<2.0.0", markers = "platform_system == \"Windows\""} +dbus-fast = {version = ">=1.22.0,<2.0.0", markers = "platform_system == \"Linux\""} +pyobjc-core = {version = ">=8.5.1,<9.0.0", markers = "platform_system == \"Darwin\""} +pyobjc-framework-CoreBluetooth = {version = ">=8.5.1,<9.0.0", markers = "platform_system == \"Darwin\""} +pyobjc-framework-libdispatch = {version = ">=8.5.1,<9.0.0", markers = "platform_system == \"Darwin\""} + +[[package]] +name = "bleak-winrt" +version = "1.2.0" +description = "Python WinRT bindings for Bleak" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" + +[[package]] +name = "dbus-fast" +version = "1.75.0" +description = "A faster version of dbus-next" +category = "main" +optional = false +python-versions = ">=3.7,<4.0" + +[package.dependencies] +async-timeout = {version = ">=3.0.0", markers = "python_version < \"3.11\""} + +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "pathspec" +version = "0.10.2" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "platformdirs" +version = "2.5.4" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2022.9.29)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.4)"] +test = ["appdirs (==1.4.4)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "pyobjc-core" +version = "8.5.1" +description = "Python<->ObjC Interoperability Module" +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "pyobjc-framework-Cocoa" +version = "8.5.1" +description = "Wrappers for the Cocoa frameworks on macOS" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyobjc-core = ">=8.5.1" + +[[package]] +name = "pyobjc-framework-CoreBluetooth" +version = "8.5.1" +description = "Wrappers for the framework CoreBluetooth on macOS" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyobjc-core = ">=8.5.1" +pyobjc-framework-Cocoa = ">=8.5.1" + +[[package]] +name = "pyobjc-framework-libdispatch" +version = "8.5.1" +description = "Wrappers for libdispatch on macOS" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyobjc-core = ">=8.5.1" + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "typing-extensions" +version = "4.4.0" +description = "Backported and Experimental Type Hints for Python 3.7+" +category = "dev" +optional = false +python-versions = ">=3.7" + +[metadata] +lock-version = "1.1" +python-versions = "^3.9" +content-hash = "4ff9097130bf3c55c4ee87470b74c4e1c2f5fc736a0c95be9332f8c4f7d7bf5e" + +[metadata.files] +async-timeout = [ + {file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"}, + {file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"}, +] +black = [ + {file = "black-22.10.0-1fixedarch-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:5cc42ca67989e9c3cf859e84c2bf014f6633db63d1cbdf8fdb666dcd9e77e3fa"}, + {file = "black-22.10.0-1fixedarch-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:5d8f74030e67087b219b032aa33a919fae8806d49c867846bfacde57f43972ef"}, + {file = "black-22.10.0-1fixedarch-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:197df8509263b0b8614e1df1756b1dd41be6738eed2ba9e9769f3880c2b9d7b6"}, + {file = "black-22.10.0-1fixedarch-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:2644b5d63633702bc2c5f3754b1b475378fbbfb481f62319388235d0cd104c2d"}, + {file = "black-22.10.0-1fixedarch-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:e41a86c6c650bcecc6633ee3180d80a025db041a8e2398dcc059b3afa8382cd4"}, + {file = "black-22.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2039230db3c6c639bd84efe3292ec7b06e9214a2992cd9beb293d639c6402edb"}, + {file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"}, + {file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"}, + {file = "black-22.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b9b29da4f564ba8787c119f37d174f2b69cdfdf9015b7d8c5c16121ddc054ae"}, + {file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"}, + {file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"}, + {file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"}, + {file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"}, + {file = "black-22.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fba8a281e570adafb79f7755ac8721b6cf1bbf691186a287e990c7929c7692ff"}, + {file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"}, + {file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"}, + {file = "black-22.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:974308c58d057a651d182208a484ce80a26dac0caef2895836a92dd6ebd725e0"}, + {file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"}, + {file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"}, + {file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"}, + {file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"}, +] +bleak = [ + {file = "bleak-0.19.0-py3-none-any.whl", hash = "sha256:ccdba0d17dcceb1326e4e46600b37e9019cd52ce01948e2a3dbd6c94d1e4de01"}, + {file = "bleak-0.19.0.tar.gz", hash = "sha256:cce5200ca9bac7daaa74dd009c867c8c2b161a124e234c74307462e86caf50e6"}, +] +bleak-winrt = [ + {file = "bleak-winrt-1.2.0.tar.gz", hash = "sha256:0577d070251b9354fc6c45ffac57e39341ebb08ead014b1bdbd43e211d2ce1d6"}, + {file = "bleak_winrt-1.2.0-cp310-cp310-win32.whl", hash = "sha256:a2ae3054d6843ae0cfd3b94c83293a1dfd5804393977dd69bde91cb5099fc47c"}, + {file = "bleak_winrt-1.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:677df51dc825c6657b3ae94f00bd09b8ab88422b40d6a7bdbf7972a63bc44e9a"}, + {file = "bleak_winrt-1.2.0-cp311-cp311-win32.whl", hash = "sha256:9449cdb942f22c9892bc1ada99e2ccce9bea8a8af1493e81fefb6de2cb3a7b80"}, + {file = "bleak_winrt-1.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:98c1b5a6a6c431ac7f76aa4285b752fe14a1c626bd8a1dfa56f66173ff120bee"}, + {file = "bleak_winrt-1.2.0-cp37-cp37m-win32.whl", hash = "sha256:623ac511696e1f58d83cb9c431e32f613395f2199b3db7f125a3d872cab968a4"}, + {file = "bleak_winrt-1.2.0-cp37-cp37m-win_amd64.whl", hash = "sha256:13ab06dec55469cf51a2c187be7b630a7a2922e1ea9ac1998135974a7239b1e3"}, + {file = "bleak_winrt-1.2.0-cp38-cp38-win32.whl", hash = "sha256:5a36ff8cd53068c01a795a75d2c13054ddc5f99ce6de62c1a97cd343fc4d0727"}, + {file = "bleak_winrt-1.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:810c00726653a962256b7acd8edf81ab9e4a3c66e936a342ce4aec7dbd3a7263"}, + {file = "bleak_winrt-1.2.0-cp39-cp39-win32.whl", hash = "sha256:dd740047a08925bde54bec357391fcee595d7b8ca0c74c87170a5cbc3f97aa0a"}, + {file = "bleak_winrt-1.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:63130c11acfe75c504a79c01f9919e87f009f5e742bfc7b7a5c2a9c72bf591a7"}, +] +click = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] +colorama = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] +dbus-fast = [ + {file = "dbus_fast-1.75.0-cp310-cp310-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:93cfff95d80af2d606503fe3d0bdfda322c4624a24190e4751c408b4e1bba488"}, + {file = "dbus_fast-1.75.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6fd873fbc8ec057727e0abfef6f75d3c4cc6300f292b8a4d861eddc21a84e4e"}, + {file = "dbus_fast-1.75.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:87e6caf531462f6f2b32c3d67f3e8ae19756e684ea464e9d7cc91dafcb3f3df6"}, + {file = "dbus_fast-1.75.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:9343a845594662df9f9585bf1ff1c24388b512ebfa045739536678589783ec75"}, + {file = "dbus_fast-1.75.0-cp311-cp311-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:37f77e60b76e90806e63c975b2540a19c544ad45f1a71ce6393f34049b834c73"}, + {file = "dbus_fast-1.75.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a49ba968cea28c9fb95b745823d10d8324f36c11ddf7d516412584b9a560374e"}, + {file = "dbus_fast-1.75.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:0a68fbc1b07aa027d24ce225aa2696005035dd6341975c921cd93bf1ac04c943"}, + {file = "dbus_fast-1.75.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7992130ab48b5bf93c310c62b7e325242becee52755090418d9e1377d5cfed81"}, + {file = "dbus_fast-1.75.0-cp37-cp37m-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:69615e0bd3b519f583e6866255c4bdc0a70a7a5d7acaace603175a4b46fdf971"}, + {file = "dbus_fast-1.75.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d93a86a15bc6f227eb3eda4098fa9572e583bb81e2223012a2ca4130023960fc"}, + {file = "dbus_fast-1.75.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:373276149810364db2536615a0d9f589a226092867762ad10d54a5b8b81d3a53"}, + {file = "dbus_fast-1.75.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:b1df5b53ecdfc93b0e8b8da4b9081755b02548654f674bedf3c48eb8eee8978c"}, + {file = "dbus_fast-1.75.0-cp38-cp38-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:b7da81a7274325a003caa8d835e65b5e404ccb12d9fc5a9c30e1569bf0fd830a"}, + {file = "dbus_fast-1.75.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d7af2934c781045b705c68de66ea81dfced5faa88e8762d9187136adc4e671e"}, + {file = "dbus_fast-1.75.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:5b1355f9d5cd48d7c1f242be7180059cea1d336c96340ab359d991c08f48d873"}, + {file = "dbus_fast-1.75.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:343e7cf78a0960dcd6161a1cc4618f8353c36d15843e149e27817efe45869b25"}, + {file = "dbus_fast-1.75.0-cp39-cp39-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:c322b52ea4a35d2f5221831a8fc95c56e1813fe0fd30cbdd883f32a3db3f86d7"}, + {file = "dbus_fast-1.75.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a8c37ba6c63f906cde3c54a4675a3b8ae9466eac704c450e942e58afe7e85af"}, + {file = "dbus_fast-1.75.0-cp39-cp39-manylinux_2_31_x86_64.whl", hash = "sha256:41a6cbae35160545a78c47a3081615c2c062efde8c984659ec75c2d5ccb50ad3"}, + {file = "dbus_fast-1.75.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:98cc58063fa6553870ca590c908f074a4f45b0300b0eb31ba6e5c781935a0ce2"}, + {file = "dbus_fast-1.75.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f58d50203633c06cebb6fdda0d3d6807ca1e3bd012e6670b01af30c0a088033c"}, + {file = "dbus_fast-1.75.0-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:413d7989519d9280653c690fdc17517667dd8a5307ce067fa835371dc3c7259b"}, + {file = "dbus_fast-1.75.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:337ba4c0b3b8346dd08dcba7fe026f0dd897c0ed85c01b8d1b2580769bd51ccd"}, + {file = "dbus_fast-1.75.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:80b058910f4160bcbdc1e088ae2dd0b874795e7017ac371fbbe6586ccb228bc0"}, + {file = "dbus_fast-1.75.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51c7df44f761909c189509e0fdcc415f615d943fb6c93d3181135fe72c771d3e"}, + {file = "dbus_fast-1.75.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:abbb69aa500949450e4edea1427876d0acec3b181b83ae505c16be975b148fb6"}, + {file = "dbus_fast-1.75.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40ff98d606490cbda4df77a9484730d5465be58a53e0285897182af2539873c9"}, + {file = "dbus_fast-1.75.0.tar.gz", hash = "sha256:1023171d2f07181ea5457a2727ee5e8bec3650ceb5410c91d8915ff44520bf13"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +pathspec = [ + {file = "pathspec-0.10.2-py3-none-any.whl", hash = "sha256:88c2606f2c1e818b978540f73ecc908e13999c6c3a383daf3705652ae79807a5"}, + {file = "pathspec-0.10.2.tar.gz", hash = "sha256:8f6bf73e5758fd365ef5d58ce09ac7c27d2833a8d7da51712eac6e27e35141b0"}, +] +platformdirs = [ + {file = "platformdirs-2.5.4-py3-none-any.whl", hash = "sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10"}, + {file = "platformdirs-2.5.4.tar.gz", hash = "sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7"}, +] +pyobjc-core = [ + {file = "pyobjc-core-8.5.1.tar.gz", hash = "sha256:f8592a12de076c27006700c4a46164478564fa33d7da41e7cbdd0a3bf9ddbccf"}, + {file = "pyobjc_core-8.5.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b62dcf987cc511188fc2aa5b4d3b9fd895361ea4984380463497ce4b0752ddf4"}, + {file = "pyobjc_core-8.5.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0accc653501a655f66c13f149a1d3d30e6cb65824edf852f7960a00c4f930d5b"}, + {file = "pyobjc_core-8.5.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f82b32affc898e9e5af041c1cecde2c99f2ce160b87df77f678c99f1550a4655"}, + {file = "pyobjc_core-8.5.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:f7b2f6b6f3caeb882c658fe0c7098be2e8b79893d84daa8e636cb3e58a07df00"}, + {file = "pyobjc_core-8.5.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:872c0202c911a5a2f1269261c168e36569f6ddac17e5d854ac19e581726570cc"}, + {file = "pyobjc_core-8.5.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:21f92e231a4bae7f2d160d065f5afbf5e859a1e37f29d34ac12592205fc8c108"}, + {file = "pyobjc_core-8.5.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:315334dd09781129af6a39641248891c4caa57043901750b0139c6614ce84ec0"}, +] +pyobjc-framework-Cocoa = [ + {file = "pyobjc-framework-Cocoa-8.5.1.tar.gz", hash = "sha256:9a3de5cdb4644e85daf53f2ed912ef6c16ea5804a9e65552eafe62c2e139eb8c"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:aa572acc2628488a47be8d19f4701fc96fce7377cc4da18316e1e08c3918521a"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:cb3ae21c8d81b7f02a891088c623cef61bca89bd671eff58c632d2f926b649f3"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:88f08f5bd94c66d373d8413c1d08218aff4cff0b586e0cc4249b2284023e7577"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:063683b57e4bd88cb0f9631ae65d25ec4eecf427d2fe8d0c578f88da9c896f3f"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8f8806ddfac40620fb27f185d0f8937e69e330617319ecc2eccf6b9c8451bdd1"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:7733a9a201df9e0cc2a0cf7bf54d76bd7981cba9b599353b243e3e0c9eefec10"}, + {file = "pyobjc_framework_Cocoa-8.5.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:f0ab227f99d3e25dd3db73f8cde0999914a5f0dd6a08600349d25f95eaa0da63"}, +] +pyobjc-framework-CoreBluetooth = [ + {file = "pyobjc-framework-CoreBluetooth-8.5.1.tar.gz", hash = "sha256:b4f621fc3b5bf289db58e64fd746773b18297f87a0ffc5502de74f69133301c1"}, + {file = "pyobjc_framework_CoreBluetooth-8.5.1-cp36-abi3-macosx_10_9_universal2.whl", hash = "sha256:bc720f2987a4d28dc73b13146e7c104d717100deb75c244da68f1d0849096661"}, + {file = "pyobjc_framework_CoreBluetooth-8.5.1-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2167f22886beb5b3ae69e475e055403f28eab065c49a25e2b98b050b483be799"}, + {file = "pyobjc_framework_CoreBluetooth-8.5.1-cp36-abi3-macosx_11_0_universal2.whl", hash = "sha256:aa9587a36eca143701731e8bb6c369148f8cc48c28168d41e7323828e5117f2d"}, +] +pyobjc-framework-libdispatch = [ + {file = "pyobjc-framework-libdispatch-8.5.1.tar.gz", hash = "sha256:066fb34fceb326307559104d45532ec2c7b55426f9910b70dbefd5d1b8fd530f"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a316646ab30ba2a97bc828f8e27e7bb79efdf993d218a9c5118396b4f81dc762"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7730a29e4d9c7d8c2e8d9ffb60af0ab6699b2186296d2bff0a2dd54527578bc3"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:76208d9d2b0071df2950800495ac0300360bb5f25cbe9ab880b65cb809764979"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:1ad9aa4773ff1d89bf4385c081824c4f8708b50e3ac2fe0a9d590153242c0f67"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:81e1833bd26f15930faba678f9efdffafc79ec04e2ea8b6d1b88cafc0883af97"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:73226e224436eb6383e7a8a811c90ed597995adb155b4f46d727881a383ac550"}, + {file = "pyobjc_framework_libdispatch-8.5.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:d115355ce446fc073c75cedfd7ab0a13958adda8e3a3b1e421e1f1e5f65640da"}, +] +tomli = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] +typing-extensions = [ + {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, + {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, +] diff --git a/ch-13/ble-tests/computer/pyproject.toml b/ch-13/ble-tests/computer/pyproject.toml new file mode 100644 index 0000000..3e56777 --- /dev/null +++ b/ch-13/ble-tests/computer/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "ble-test" +version = "0.1.0" +description = "" +authors = ["Danny Staple "] +readme = "README.md" +packages = [{include = "ble_test"}] + +[tool.poetry.dependencies] +python = "^3.9" +bleak = "0.19.0" + +[tool.poetry.group.dev.dependencies] +black = "^22.10.0" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/ch-13/ble-tests/computer/robot_ble_connection.py b/ch-13/ble-tests/computer/robot_ble_connection.py new file mode 100644 index 0000000..66dd100 --- /dev/null +++ b/ch-13/ble-tests/computer/robot_ble_connection.py @@ -0,0 +1,38 @@ +import asyncio + +import bleak + + +class BleConnection: + # See https://learn.adafruit.com/introducing-adafruit-ble-bluetooth-low-energy-friend/uart-service + ble_uuid = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" + rx_gatt = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E" + tx_gatt = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E" + ble_name = "Adafruit Bluefruit LE" + + def __init__(self, receive_handler): + self.ble_client = None + self.receive_handler = receive_handler + + def _uart_handler(self, _, data: bytes): + self.receive_handler(data) + + async def connect(self): + print("Scanning for devices...") + devices = await bleak.BleakScanner.discover(service_uuids=[self.ble_uuid]) + print(f"Found {len(devices)} devices") + print([device.name for device in devices]) + ble_device_info = [device for device in devices if device.name==self.ble_name][0] + print(f"Connecting to {ble_device_info.name}...") + self.ble_client = bleak.BleakClient(ble_device_info.address) + await self.ble_client.connect() + print("Connected to {}".format(ble_device_info.name)) + self.notify_task = asyncio.create_task( + self.ble_client.start_notify(self.rx_gatt, self._uart_handler) + ) + + async def close(self): + await self.ble_client.disconnect() + + async def send_uart_data(self, data): + await self.ble_client.write_gatt_char(self.tx_gatt, data) diff --git a/ch-13/ble-tests/computer/test_ble.py b/ch-13/ble-tests/computer/test_ble.py new file mode 100644 index 0000000..2a988bb --- /dev/null +++ b/ch-13/ble-tests/computer/test_ble.py @@ -0,0 +1,22 @@ +import asyncio +from robot_ble_connection import BleConnection + +def handle_data(data): + print(f"Response: {data}") + +async def main(): + ble_connection = BleConnection(handle_data) + await ble_connection.connect() + try: + while True: + await asyncio.sleep(0.5) + await ble_connection.send_uart_data(bytes([65, 66, 13]))# "Hello World".encode()) + await asyncio.sleep(3) + await ble_connection.send_uart_data("Hello\nwith newline in middle".encode()) + await asyncio.sleep(3) + await ble_connection.send_uart_data("Hello with newline as end\n".encode()) + await asyncio.sleep(2.5) + finally: + await ble_connection.close() + +asyncio.run(main()) diff --git a/ch-13/ble-tests/robot/code.py b/ch-13/ble-tests/robot/code.py new file mode 100644 index 0000000..0e915a0 --- /dev/null +++ b/ch-13/ble-tests/robot/code.py @@ -0,0 +1,13 @@ +import board +import busio +import time +uart = busio.UART(board.GP12, board.GP13, baudrate=9600) + + +while True: + while uart.in_waiting: + print("Receiving data...") + data = uart.readline() + print(f"Received {data.decode()}") + uart.write(f"Received {len(data)} bytes\n".encode()) + time.sleep(0.1)