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

Commit 520daca6 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "[PANDORA_TEST] pts-bot HFP Coverage: HFI & SLC"

parents 1b21e291 74bb6827
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ class HFPProxy(ProfileProxy):
        self.hfp = HFP(channel)
        self.host = Host(channel)

        self.connection = None

    @assert_description
    def TSC_delete_pairing_iut(self, pts_addr: bytes, **kwargs):
        """
@@ -40,6 +42,18 @@ class HFPProxy(ProfileProxy):
        self.host.DeletePairing(address=pts_addr)
        return "OK"

    @assert_description
    def TSC_iut_enable_slc(self, pts_addr: bytes, **kwargs):
        """
        Click Ok, then initiate a service level connection from the
        Implementation Under Test (IUT) to the PTS.
        """

        if not self.connection:
            self.connection = self.host.Connect(address=pts_addr).connection
        self.hfp.EnableSlc(connection=self.connection)
        return "OK"

    @assert_description
    def TSC_iut_search(self, **kwargs):
        """
@@ -66,5 +80,5 @@ class HFPProxy(ProfileProxy):
        Implementation Under Test (IUT).
        """

        self.hfp.DisableSlc(address=pts_addr)
        self.hfp.DisableSlc(connection=self.connection)
        return "OK"
+2 −0
Original line number Diff line number Diff line
@@ -23,5 +23,7 @@
        <option name="profile" value="A2DP/SRC" />
        <option name="profile" value="AVDTP/SRC" />
        <option name="profile" value="HFP/AG/DIS" />
        <option name="profile" value="HFP/AG/HFI" />
        <option name="profile" value="HFP/AG/SLC" />
    </test>
</configuration>
+14 −2
Original line number Diff line number Diff line
@@ -40,7 +40,12 @@
    "AVDTP/SRC/INT/SIG/SMG/BV-28-C",
    "AVDTP/SRC/INT/SIG/SMG/BV-31-C",
    "AVDTP/SRC/INT/SIG/SYN/BV-05-C",
    "AVDTP/SRC/INT/TRA/BTR/BV-01-C"
    "AVDTP/SRC/INT/TRA/BTR/BV-01-C",
    "HFP/AG/DIS/BV-01-I",
    "HFP/AG/HFI/BI-03-I",
    "HFP/AG/HFI/BV-02-I",
    "HFP/AG/SLC/BV-09-I",
    "HFP/AG/SLC/BV-10-I"
  ],
  "skip": [
    "A2DP/SRC/AS/BV-01-I",
@@ -61,7 +66,14 @@
    "AVDTP/SRC/INT/SIG/SMG/BV-11-C",
    "AVDTP/SRC/INT/SIG/SMG/BV-13-C",
    "AVDTP/SRC/INT/SIG/SMG/BV-23-C",
    "AVDTP/SRC/INT/SIG/SMG/ESR05/BV-13-C"
    "AVDTP/SRC/INT/SIG/SMG/ESR05/BV-13-C",
    "HFP/AG/SLC/BV-01-C",
    "HFP/AG/SLC/BV-02-C",
    "HFP/AG/SLC/BV-03-C",
    "HFP/AG/SLC/BV-04-C",
    "HFP/AG/SLC/BV-05-I",
    "HFP/AG/SLC/BV-06-I",
    "HFP/AG/SLC/BV-07-I"
  ],
  "ics": {
    "TSPC_4.0HCI_1a_2": true,
+12 −7
Original line number Diff line number Diff line
@@ -5,19 +5,24 @@ option java_outer_classname = "HfpProto";
package pandora;

import "pandora/host.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";

// Service to trigger HFP (Hands Free Profile) procedures.
service HFP {
  // Enable Service level connection
  rpc EnableSlc(EnableSlcRequest) returns (google.protobuf.Empty);
  // Disable Service level connection
  rpc DisableSlc(DisableSlcRequest) returns (DisableSlcResponse);
  rpc DisableSlc(DisableSlcRequest) returns (google.protobuf.Empty);
}

// Request of the `EnableSlc` method.
message EnableSlcRequest {
  // Connection crafted by grpc server
  Connection connection = 1;
}

// Request of the `DisableSlc` method.
message DisableSlcRequest {
  // Local Bluetooth Device Address as array of 6 bytes.
  bytes address = 1;
  // Connection crafted by grpc server
  Connection connection = 1;
}

// Response of the `DisableSlc` method.
message DisableSlcResponse {}
+15 −7
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothProfile
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import com.google.protobuf.Empty
import io.grpc.stub.StreamObserver
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -56,16 +57,23 @@ class Hfp(val context: Context) : HFPImplBase() {
    scope.cancel()
  }

  override fun disableSlc(
    request: DisableSlcRequest,
    responseObserver: StreamObserver<DisableSlcResponse>
  ) {
    grpcUnary<DisableSlcResponse>(scope, responseObserver) {
      val device = request.address.toBluetoothDevice(bluetoothAdapter)
  override fun enableSlc(request: EnableSlcRequest, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
      val device = request.connection.toBluetoothDevice(bluetoothAdapter)

      bluetoothHfp.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED)

      Empty.getDefaultInstance()
    }
  }

  override fun disableSlc(request: DisableSlcRequest, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
      val device = request.connection.toBluetoothDevice(bluetoothAdapter)

      bluetoothHfp.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN)

      DisableSlcResponse.getDefaultInstance()
      Empty.getDefaultInstance()
    }
  }
}
Loading