mirror of
https://github.com/undera/pylgbst.git
synced 2020-11-18 19:37:26 -08:00
Fixups after testing
This commit is contained in:
parent
7bfe700a75
commit
c676d09ba2
@ -81,7 +81,10 @@ class GattConnection(Connection):
|
||||
self._iface = bt_iface_name
|
||||
|
||||
def connect(self, hub_mac=None):
|
||||
dev_manager = gatt.DeviceManager(adapter_name=self._iface)
|
||||
try:
|
||||
dev_manager = gatt.DeviceManager(adapter_name=self._iface)
|
||||
except TypeError:
|
||||
raise NotImplementedError("Gatt is not implemented for this platform")
|
||||
dman_thread = threading.Thread(target=dev_manager.run)
|
||||
dman_thread.setDaemon(True)
|
||||
log.debug('Starting DeviceManager...')
|
||||
|
@ -58,4 +58,4 @@ class GattoolConnection(Connection):
|
||||
class BlueGigaConnection(GattoolConnection):
|
||||
def __init__(self):
|
||||
super(BlueGigaConnection, self).__init__()
|
||||
self.backend = lambda: pygatt.GATTToolBackend()
|
||||
self.backend = lambda: pygatt.BGAPIBackend()
|
||||
|
@ -4,7 +4,7 @@ import unittest
|
||||
import dbus
|
||||
from gatt import DeviceManager
|
||||
|
||||
from pylgbst.comms_gatt import CustomDevice
|
||||
from pylgbst.comms_gatt import CustomDevice, GattConnection
|
||||
from tests import log, str2hex
|
||||
|
||||
|
||||
@ -41,3 +41,7 @@ class TestGatt(unittest.TestCase):
|
||||
"dbus.Byte(0), dbus.Byte(0), dbus.Byte(0), dbus.Byte(0), dbus.Byte(16), dbus.Byte(0), dbus.Byte(0), " \
|
||||
"dbus.Byte(0), dbus.Byte(16)], signature=dbus.Signature('y'), variant_level=1)"
|
||||
obj.characteristic_value_updated(None, arr if sys.version_info[0] == 2 else bytes(arr, 'ascii'))
|
||||
|
||||
def test_conn(self):
|
||||
obj = GattConnection()
|
||||
obj.connect()
|
||||
|
Loading…
x
Reference in New Issue
Block a user