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

Commit 7a08ea3a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Pandora: Add device name as parameter in SendFile" am: 0dbed3c0

parents 6f402554 0dbed3c0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ class OPPProxy(ProfileProxy):
        Take action to create an rfcomm channel for an OBEX connection.
        """

        self._android.SendFile()
        self._android.SendFile('PTS')

        return "OK"

@@ -132,7 +132,7 @@ class OPPProxy(ProfileProxy):
        Take action to create an l2cap channel for an OBEX connection.
        """

        self._android.SendFile()
        self._android.SendFile('PTS')

        return "OK"

+5 −10
Original line number Diff line number Diff line
@@ -144,18 +144,15 @@ class AndroidInternal(val context: Context) : AndroidImplBase(), Closeable {
    }
  }

  override fun sendFile(request: Empty, responseObserver: StreamObserver<Empty>) {
  override fun sendFile(request: SendFileRequest, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
      initiateSendFile(getImageId(IMAGE_FILE_NAME), "image/bmp")
      waitAndSelectBluetoothDevice()
      waitAndSelectBluetoothDevice(request.name)
      Empty.getDefaultInstance()
    }
  }

  override fun sendPing(
    request: SendPingRequest,
    responseObserver: StreamObserver<Empty>
  ) {
  override fun sendPing(request: SendPingRequest, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
      val pingStatus =
        Runtime.getRuntime().exec("ping -I bt-pan -c 1 ${request.ipAddress}").waitFor()
@@ -163,12 +160,10 @@ class AndroidInternal(val context: Context) : AndroidImplBase(), Closeable {
    }
  }

  suspend private fun waitAndSelectBluetoothDevice() {
  suspend private fun waitAndSelectBluetoothDevice(name: String) {
    var selectJob =
      scope.async {
        device
          .wait(Until.findObject(By.textContains("PTS")), BT_DEVICE_SELECT_WAIT_TIMEOUT)
          .click()
        device.wait(Until.findObject(By.textContains(name)), BT_DEVICE_SELECT_WAIT_TIMEOUT).click()
      }
    selectJob.await()
  }
+8 −2
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ service Android {
  // Accept incoming file
  rpc AcceptIncomingFile(google.protobuf.Empty) returns (google.protobuf.Empty);
  // Send file
  rpc SendFile(google.protobuf.Empty) returns (google.protobuf.Empty);
  rpc SendFile(SendFileRequest) returns (google.protobuf.Empty);

  // Send ping
  rpc SendPing(SendPingRequest) returns (google.protobuf.Empty);
}
@@ -45,6 +46,11 @@ message SetAccessPermissionRequest {
  AccessType access_type = 2;
}

message SendFileRequest {
  // Peer Bluetooth Device name.
  string name = 1;
}

// Internal representation of a Connection - not exposed to clients, included here
// just for code-generation convenience. This is what we put in the Connection.cookie.
message InternalConnectionRef {