HomeiOS Developmentpython - Find out how to join and ship a message to...

python – Find out how to join and ship a message to iOS gadget by bluetooth from a MacBook


How do you join and ship a message from a MacBook to an iOS gadget? Firstly, I arrange a scanner utilizing bleak. Motive for utilizing bleak is that PyBluez and sockets did not work as I didn’t have Python constructed with bluetooth. That is the scan code:

import asyncio
from bleak import BleakScanner


async def scan():
    gadgets = await BleakScanner.uncover()
    for d in gadgets:
        print(f"Machine identify: {d.identify},n",
              f"MAC handle: {d.handle},n",
              f"Particulars: {d.particulars}n")

I get a bunch of gadgets which might be near me, their names(that are normally None), identifier, CBPeripheral handle, and standing.

I’ve tried simply merely connecting to it and sending a message, however to no avail.

handle = "my_device_address"


async def primary(handle):
    async with BleakClient(handle) as shopper:
        await shopper.join()
        await shopper.write_gatt_char(0x000e, b'x01x00')

asyncio.run(primary(handle))

Any assist is far appreciated: code, documentation, books, and so on.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments