-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Labels
backend: CoreBluetoothProblem specific to CoreBluetoothProblem specific to CoreBluetoothbackend: WinRTProblem specific to WinRTProblem specific to WinRTbugSomething isn't workingSomething isn't working
Description
The problem
self = <bleak.backends.corebluetooth.service.BleakGATTServiceCoreBluetooth object at 0x7fade9a57460>
obj = <CBMutableService: 0x7fade91507c0 Primary = YES, UUID = A438A1A6-47C0-4FD1-88BE-4531A1BAB891, Included Services = (null), Characteristics = (null)>
def __init__(self, obj: CBService):
super().__init__(obj)
self.__characteristics = []
# N.B. the `startHandle` method of the CBService is an undocumented Core Bluetooth feature,
# which Bleak takes advantage of in order to have a service handle to use.
> self.__handle = int(self.obj.startHandle())
E TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
/usr/local/anaconda3/envs/bless_test/lib/python3.8/site-packages/bleak/backends/corebluetooth/service.py:20: TypeError
This behavior is a result of this recent bleak pull request. It seems that when a new CBService is initialized before setting the server in motion that the service does not yet own a handle
Reproduction
TEST_HARDWARE=True python -m pytest -s -k server
Desktop
- OS: macOS
Proposed Solution
Create a BlessGATTServiceCoreBluetooth rather than bleak. This will allow us to get the service created, and potentially handle "handles" later.
Metadata
Metadata
Assignees
Labels
backend: CoreBluetoothProblem specific to CoreBluetoothProblem specific to CoreBluetoothbackend: WinRTProblem specific to WinRTProblem specific to WinRTbugSomething isn't workingSomething isn't working