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

Commit c57d96e5 authored by Rahul Arya's avatar Rahul Arya Committed by Automerger Merge Worker
Browse files

[Pandora] Add logging to mmi2grpc am: 1f20a2ca

parents bca18e94 1f20a2ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ def format_proxy(profile, mmi_name, mmi_description):
            f'class {profile}Proxy(ProfileProxy):\n'
            f'\n'
            f'    def __init__(self, channel):\n'
            f'        super().__init__()\n'
            f'        super().__init__(channel)\n'
            f'        self.{profile.lower()} = {profile}(channel)\n'
            f'\n'
            f'{wrapped_function}')
+12 −3
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@
from mmi2grpc._helpers import format_function
from mmi2grpc._helpers import assert_description

import sys
from pandora_experimental._android_grpc import Android


class ProfileProxy:
    """Profile proxy base class."""

    def __init__(self, channel) -> None:
        self._android = Android(channel)

    def interact(self, test: str, mmi_name: str, mmi_description: str, pts_addr: bytes):
        """Translate a MMI call to its corresponding implementation.

@@ -37,10 +40,16 @@ class ProfileProxy:
        try:
            if not mmi_name.isidentifier():
                mmi_name = "_mmi_" + mmi_name
            return getattr(self, mmi_name)(test=test, description=mmi_description, pts_addr=pts_addr)
            self.log(f"starting MMI {mmi_name}")
            out = getattr(self, mmi_name)(test=test, description=mmi_description, pts_addr=pts_addr)
            self.log(f"finishing MMI {mmi_name}")
            return out
        except AttributeError:
            code = format_function(mmi_name, mmi_description)
            assert False, f'Unhandled mmi {id}\n{code}'
            assert False, f'Unhandled mmi {mmi_name}\n{code}'

    def log(self, text=""):
        self._android.Log(text=text)

    def test_started(self, test: str, description: str, pts_addr: bytes):
        return "OK"
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class A2DPProxy(ProfileProxy):
    source: Optional[Source] = None

    def __init__(self, channel):
        super().__init__()
        super().__init__(channel)

        self.host = Host(channel)
        self.a2dp = A2DP(channel)
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class AVRCPProxy(ProfileProxy):
    source: Optional[Source] = None

    def __init__(self, channel):
        super().__init__()
        super().__init__(channel)

        self.host = Host(channel)
        self.a2dp = A2DP(channel)
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ CUSTOM_CHARACTERISTIC_UUID = "0000fffe-0000-1000-8000-00805f9b34fb"
class GATTProxy(ProfileProxy):

    def __init__(self, channel):
        super().__init__()
        super().__init__(channel)
        self.gatt = GATT(channel)
        self.host = Host(channel)
        self.connection = None
Loading