bleak compatible pythonista.cb backend
Project description
Bleak compatible backend for Pythonista iOS app
This module uses bleak backend API to implement a compatible solution for Pythonista iOS app.
It uses Pythonista built-in _cb module, that is wrapper to iOS CoreBluetooth.
[!CAUTION] This project is in
beta, use it with caution
- This backend refers to Pythonista.cb docs
- This backend refers to existing
macOS CoreBluetooth bleak backendwas used as a reference - It also provides stub files for pythonista built-in modules as
_cbandpythonista.cb, and fake_cb.pyimplementation for testing on unsupported platforms - Use
Bleakdocs to explore how to useBleak
Table of Contents
Installation
pip install bleak-pythonista
Usage
Direct import
import asyncio
from bleak_pythonista import BleakScanner, BleakClient
async def main():
devices = await BleakScanner.discover(
service_uuids=["<some-service-uuid>"] # optional
)
for d in devices:
print(d)
client = BleakClient(d)
await client.connect()
print(client.services)
asyncio.run(main())
With bleak itself
import asyncio
from bleak import BleakScanner, BleakClient
from bleak_pythonista import BleakScannerPythonistaCB, BleakClientPythonistaCB
async def main():
devices = await BleakScanner.discover(
service_uuids=["<some-service-uuid>"], # optional
backend=BleakScannerPythonistaCB,
)
for d in devices:
print(d)
client = BleakClient(d, backend=BleakClientPythonistaCB)
await client.connect()
print(client.services)
asyncio.run(main())
[!WARNING] DO NOT NAME YOUR SCRIPT
bleak.pyorbleak_pythonista! It will cause a circular import error.
What's done?
- CentralManagerDelegate (for now for scanning purpose only)
- client.BleakClientPythonistaCB
- scanner.BleakScannerPythonistaCB
_cbandpythonista.cbstubs- fake
cb.pyfor testing with backend simulation on unsupported platforms
[!TIP] THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bleak_pythonista-0.1.2.tar.gz.
File metadata
- Download URL: bleak_pythonista-0.1.2.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08f140a0e64ca6d23a7fb604c9e54d7e54245575f8ede93493e251298f3be1c1
|
|
| MD5 |
c51a4b06428c3100a16c232d992b6a46
|
|
| BLAKE2b-256 |
e1712f78f72a255474443f720114e39c0b5059aef86dcf8730b93e6a6cbc7c88
|
File details
Details for the file bleak_pythonista-0.1.2-py3-none-any.whl.
File metadata
- Download URL: bleak_pythonista-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03c1d86338b908b67d638b4c265b06eca918d4b17a5954c46312c6e82af8cb49
|
|
| MD5 |
8dff4e65b470d0f5d0b160eda38bad28
|
|
| BLAKE2b-256 |
eaa0031cc1101db3bb84b5452001cbfd3a77ae05b27635c17b4dd85474c8d6f5
|