Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ce654c3 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge changes I36965d42,I9d905b8b into main

* changes:
  Floss: Implement Pandora GATT profile (part2).
  Floss: Fork Floss D-Bus gatt_server from autotest_lib
parents 4188d8be 1f3db500
Loading
Loading
Loading
Loading
+967 −0

File added.

Preview size limit exceeded, changes collapsed.

+17 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ from floss.pandora.floss import manager_client
from floss.pandora.floss import qa_client
from floss.pandora.floss import scanner_client
from floss.pandora.floss import gatt_client
from floss.pandora.floss import gatt_server
from floss.pandora.floss import floss_enums
from floss.pandora.floss import utils
from gi.repository import GLib
@@ -65,6 +66,7 @@ class Bluetooth(object):
        self.scanner_client = scanner_client.FlossScannerClient(self.bus, self.DEFAULT_ADAPTER)
        self.qa_client = qa_client.FlossQAClient(self.bus, self.DEFAULT_ADAPTER)
        self.gatt_client = gatt_client.FlossGattClient(self.bus, self.DEFAULT_ADAPTER)
        self.gatt_server = gatt_server.FlossGattServer(self.bus, self.DEFAULT_ADAPTER)

    def __del__(self):
        if not self.is_clean:
@@ -132,6 +134,9 @@ class Bluetooth(object):
        if not self.gatt_client.register_client(self.FAKE_GATT_APP_ID, False):
            logging.error('gatt_client: Failed to register callbacks')
            return False
        if not self.gatt_server.register_server(self.FAKE_GATT_APP_ID, False):
            logging.error('gatt_server: Failed to register callbacks')
            return False
        return True

    def is_bluetoothd_proxy_valid(self):
@@ -144,6 +149,7 @@ class Bluetooth(object):
            self.scanner_client.has_proxy(),
            self.qa_client.has_proxy(),
            self.gatt_client.has_proxy(),
            self.gatt_server.has_proxy(),
        ])

        if not proxy_ready:
@@ -178,6 +184,7 @@ class Bluetooth(object):
            self.scanner_client = scanner_client.FlossScannerClient(self.bus, default_adapter)
            self.qa_client = qa_client.FlossQAClient(self.bus, default_adapter)
            self.gatt_client = gatt_client.FlossGattClient(self.bus, default_adapter)
            self.gatt_server = gatt_server.FlossGattServer(self.bus, default_adapter)

            try:
                utils.poll_for_condition(
@@ -337,6 +344,16 @@ class Bluetooth(object):
    def set_connectable(self, mode):
        return self.qa_client.set_connectable(mode)

    def read_using_characteristic_uuid(self, address, uuid, start_handle, end_handle, auth_req):
        return self.gatt_client.read_using_characteristic_uuid(address, uuid, start_handle, end_handle, auth_req)

    def register_for_notification(self, address, handle, enable):
        return self.gatt_client.register_for_notification(address, handle, enable)

    def add_service(self, service):
        service = self.gatt_server.make_dbus_service(service)
        return self.gatt_server.add_service(service)

    def is_encrypted(self, address):
        connection_state = self.adapter_client.get_connection_state(address)
        if connection_state is None:
+460 −0

File changed.

Preview size limit exceeded, changes collapsed.