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

Commit 25c5457d authored by Charlie Boutier's avatar Charlie Boutier
Browse files

PandoraServer: Rename android.proto to os.proto

Rename android.proto to os.proto to be more
specific accross the different OS implementing
the bt-test-interfaces.
This interface is gathering every OS specific action
such as logging and permissions.

Test: atest pts-bot
Bug: 291995194
Change-Id: I5d44b4e511f00a7c827ba3d6d5f920138f030760
parent 18ee4a42
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -16,14 +16,14 @@
from mmi2grpc._helpers import format_function
from mmi2grpc._helpers import assert_description

from pandora_experimental._android_grpc import Android
from pandora_experimental.os_grpc import Os


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

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

    def interact(self, test: str, mmi_name: str, mmi_description: str, pts_addr: bytes):
        """Translate a MMI call to its corresponding implementation.
@@ -49,7 +49,7 @@ class ProfileProxy:
            assert False, f'Unhandled mmi {mmi_name}\n{code}'

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

    def test_started(self, test: str, description: str, pts_addr: bytes):
        return "OK"
+5 −5
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ from mmi2grpc._proxy import ProfileProxy
from pandora.host_grpc import Host
from pandora.host_pb2 import Connection
from pandora_experimental.map_grpc import Map as MapProfile
from pandora_experimental._android_grpc import Android
from pandora_experimental._android_pb2 import ACCESS_MESSAGE
from pandora_experimental.os_grpc import Os
from pandora_experimental.os_pb2 import ACCESS_MESSAGE


class MAPProxy(ProfileProxy):
@@ -37,7 +37,7 @@ class MAPProxy(ProfileProxy):
        super().__init__(channel)

        self.host = Host(channel)
        self._android = Android(channel)
        self.os = Os(channel)
        self.map_profile = MapProfile(channel)

        self.connection = None
@@ -57,7 +57,7 @@ class MAPProxy(ProfileProxy):
        Please accept the l2cap channel connection for an OBEX connection.
        """

        self._android.SetAccessPermission(address=pts_addr, access_type=ACCESS_MESSAGE)
        self.os.SetAccessPermission(address=pts_addr, access_type=ACCESS_MESSAGE)
        self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"
@@ -70,7 +70,7 @@ class MAPProxy(ProfileProxy):

        if test in {"MAP/MSE/GOEP/BC/BV-01-I", "MAP/MSE/GOEP/BC/BV-03-I", "MAP/MSE/MMN/BV-02-I"}:
            if self.connection is None:
                self._android.SetAccessPermission(address=pts_addr, access_type=ACCESS_MESSAGE)
                self.os.SetAccessPermission(address=pts_addr, access_type=ACCESS_MESSAGE)
                self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"
+3 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ from mmi2grpc._proxy import ProfileProxy

from pandora.host_grpc import Host
from pandora_experimental.pan_grpc import PAN
from pandora_experimental._android_grpc import Android
from pandora_experimental.os_grpc import Os

# IP address of PTS
TSPX_PTS_IP_ADDRESS = "192.168.168.100"
@@ -32,7 +32,7 @@ class PANProxy(ProfileProxy):
        super().__init__(channel)
        self.host = Host(channel)
        self.pan = PAN(channel)
        self._android = Android(channel)
        self.os = Os(channel)

    def TSC_BNEP_mmi_iut_accept_transport(self, pts_addr: bytes, **kwargs):
        """
@@ -238,7 +238,7 @@ class PANProxy(ProfileProxy):
        Take action to send ICMP echo request
        """

        self._android.SendPing(ip_address=TSPX_PTS_IP_ADDRESS)
        self.os.SendPing(ip_address=TSPX_PTS_IP_ADDRESS)

        return "OK"

+5 −5
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ from mmi2grpc._helpers import assert_description, match_description
from mmi2grpc._proxy import ProfileProxy
from pandora.host_grpc import Host
from pandora.host_pb2 import Connection
from pandora_experimental._android_grpc import Android
from pandora_experimental._android_pb2 import ACCESS_PHONEBOOK
from pandora_experimental.os_grpc import Os
from pandora_experimental.os_pb2 import ACCESS_PHONEBOOK
from pandora_experimental.pbap_grpc import PBAP


@@ -39,7 +39,7 @@ class PBAPProxy(ProfileProxy):

        self.host = Host(channel)
        self.pbap = PBAP(channel)
        self._android = Android(channel)
        self.os = Os(channel)

        self.connection = None

@@ -56,7 +56,7 @@ class PBAPProxy(ProfileProxy):
        """
        Please accept the l2cap channel connection for an OBEX connection.
        """
        self._android.SetAccessPermission(address=pts_addr, access_type=ACCESS_PHONEBOOK)
        self.os.SetAccessPermission(address=pts_addr, access_type=ACCESS_PHONEBOOK)
        self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"
@@ -68,7 +68,7 @@ class PBAPProxy(ProfileProxy):
        """
        if ("PBAP/PSE/GOEP/BC/BV-03-I" in test):
            if self.connection is None:
                self._android.SetAccessPermission(address=pts_addr, access_type=ACCESS_PHONEBOOK)
                self.os.SetAccessPermission(address=pts_addr, access_type=ACCESS_PHONEBOOK)
                self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"
+4 −4
Original line number Diff line number Diff line
@@ -26,13 +26,13 @@ import com.google.protobuf.Empty
import io.grpc.stub.StreamObserver
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import pandora.AndroidGrpc.AndroidImplBase
import pandora.AndroidProto.*
import pandora.OsGrpc.OsImplBase
import pandora.OsProto.*

private const val TAG = "PandoraAndroidInternal"
private const val TAG = "PandoraOs"

@kotlinx.coroutines.ExperimentalCoroutinesApi
class AndroidInternal(val context: Context) : AndroidImplBase() {
class Os(val context: Context) : OsImplBase() {

    private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1))

Loading