kevincar / bless

Cross-platform Bluetooth Low Energy Server Python Library
MIT License
86 stars 28 forks source link

Do you have the "client.py" to send 0xF to "server.py" #66

Closed WouterJD closed 2 years ago

WouterJD commented 2 years ago

Describe the solution you'd like Server.py awaits a client to write 0xF to the advertised characteristic.

Describe alternatives you've considered It would be nice to have the client.py.

Additional context server.pyis running and discovered by bleak/discover.py; but when further exploring using service-explorer.py a timeout occurs. Having both ends of the communication would be nice to understand whether the setup is OK or something else is wrong.

server.py

DEBUG:asyncio:Using proactor: IocpProactor
DEBUG:bless.backends.winrt.server:Creating a new service with uuid: A07498CA-AD5B-474E-940D-16F1FBE7E8CD
DEBUG:bless.backends.winrt.server:Adding service to server with uuid A07498CA-AD5B-474E-940D-16F1FBE7E8CD
DEBUG:__main__:51ff12bb-3ed8-46e5-b4f9-d64e2fec021b:
DEBUG:__main__:Start
DEBUG:__main__:Advertising
INFO:__main__:Write '0xF' to the advertised characteristic: 51FF12BB-3ED8-46E5-B4F9-D64E2FEC021B

service_explorer.py ADDRESS=4C:E9:D8:75:87:28 (which is dynamically found using the discovery-algorithm of discover.py)

Timeout occurs at: async with BleakClient(address) as client:

Traceback (most recent call last):
  File "Z:\Github\hbldh\bleak\examples\service_explorer.py", line 94, in <module>
    asyncio.run(main(ADDRESS))
  File "C:\Users\Wouter Dubbeldam\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Users\Wouter Dubbeldam\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 612, in run_until_complete
    return future.result()
  File "Z:\Github\hbldh\bleak\examples\service_explorer.py", line 48, in main
    async with BleakClient(address) as client:
  File "C:\Users\Wouter Dubbeldam\AppData\Local\Programs\Python\Python38\lib\site-packages\bleak\backends\client.py", line 61, in __aenter__
    await self.connect()
  File "C:\Users\Wouter Dubbeldam\AppData\Local\Programs\Python\Python38\lib\site-packages\bleak\backends\winrt\client.py", line 267, in connect
    await asyncio.wait_for(event.wait(), timeout=timeout)
  File "C:\Users\Wouter Dubbeldam\AppData\Local\Programs\Python\Python38\lib\asyncio\tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
WouterJD commented 2 years ago

If #72 is solved, this issue is obsolete.