Skip to content

Commit

Permalink
Merge pull request hbldh#880 from hbldh/small-fixes
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
dlech authored Jul 13, 2022
2 parents b637f64 + ebe6fff commit 90a80fe
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Changed

* Add `py.typed` file so mypy discovers Bleak's type annotations
* UUID descriptions updated to 2022-03-16 assigned numbers document
* Replace use of deprecated ``asyncio.get_event_loop()`` in Android backend.


`0.14.3`_ (2022-04-29)
Expand Down
2 changes: 0 additions & 2 deletions bleak/backends/corebluetooth/scanner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import pathlib
from typing import Any, Dict, List, Optional

import objc
Expand All @@ -12,7 +11,6 @@
from bleak.backends.scanner import BaseBleakScanner, AdvertisementData

logger = logging.getLogger(__name__)
_here = pathlib.Path(__file__).parent


class BleakScannerCoreBluetooth(BaseBleakScanner):
Expand Down
4 changes: 2 additions & 2 deletions bleak/backends/p4android/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def connect(self, **kwargs) -> bool:
Boolean representing connection status.
"""
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()

self.__adapter = defs.BluetoothAdapter.getDefaultAdapter()
if self.__adapter is None:
Expand Down Expand Up @@ -167,7 +167,7 @@ async def pair(self, *args, **kwargs) -> bool:
Boolean regarding success of pairing.
"""
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()

bondedFuture = loop.create_future()

Expand Down
2 changes: 1 addition & 1 deletion bleak/backends/p4android/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def start(self):

logger.debug("Starting BTLE scan")

loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()

if self.__javascanner is None:
if self.__callback is None:
Expand Down
2 changes: 0 additions & 2 deletions bleak/backends/winrt/scanner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import asyncio
import logging
import pathlib
from typing import Dict, List, NamedTuple, Optional
from uuid import UUID

Expand All @@ -16,7 +15,6 @@


logger = logging.getLogger(__name__)
_here = pathlib.Path(__file__).parent


def _format_bdaddr(a):
Expand Down
3 changes: 1 addition & 2 deletions bleak/backends/winrt/service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from uuid import UUID
from typing import List, Union
from typing import List

from bleak_winrt.windows.devices.bluetooth.genericattributeprofile import (
GattDeviceService,
Expand Down
1 change: 1 addition & 0 deletions examples/detection_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async def main(service_uuids):
scanner.register_detection_callback(simple_callback)

while True:
print("(re)starting scanner")
await scanner.start()
await asyncio.sleep(5.0)
await scanner.stop()
Expand Down

0 comments on commit 90a80fe

Please sign in to comment.