Loading android/pandora/mmi2grpc/mmi2grpc/opp.py +1 −3 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ from mmi2grpc._proxy import ProfileProxy from pandora.host_grpc import Host from pandora.host_grpc import Host from pandora.host_pb2 import Connection from pandora.host_pb2 import Connection from pandora_experimental._android_grpc import Android from pandora_experimental.opp_grpc import Opp from pandora_experimental.opp_grpc import Opp Loading @@ -35,7 +34,6 @@ class OPPProxy(ProfileProxy): super().__init__(channel) super().__init__(channel) self.host = Host(channel) self.host = Host(channel) self._android = Android(channel) self.opp = Opp(channel) self.opp = Opp(channel) self.connection = None self.connection = None Loading Loading @@ -67,7 +65,7 @@ class OPPProxy(ProfileProxy): """ """ Please accept the PUT REQUEST. Please accept the PUT REQUEST. """ """ self._android.AcceptIncomingFile() self.opp.AcceptPutOperation() return "OK" return "OK" Loading android/pandora/server/src/AndroidInternal.kt +0 −30 Original line number Original line Diff line number Diff line Loading @@ -24,10 +24,6 @@ import android.telephony.SmsManager import android.telephony.SubscriptionManager import android.telephony.SubscriptionManager import android.telephony.TelephonyManager import android.telephony.TelephonyManager import android.util.Log import android.util.Log import androidx.test.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.google.protobuf.Empty import com.google.protobuf.Empty import io.grpc.stub.StreamObserver import io.grpc.stub.StreamObserver import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope Loading @@ -41,22 +37,11 @@ private const val TAG = "PandoraAndroidInternal" class AndroidInternal(val context: Context) : AndroidImplBase() { class AndroidInternal(val context: Context) : AndroidImplBase() { private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val INCOMING_FILE_ACCEPT_BTN = "ACCEPT" private val INCOMING_FILE_TITLE = "Incoming file" private val INCOMING_FILE_WAIT_TIMEOUT = 2000L // PTS does not configure the Extended Inquiry Response with the // device name; the device will be found after the Inquiry Timeout // (40 secondes) has elapsed. private val BT_DEVICE_SELECT_WAIT_TIMEOUT = 40000L private val IMAGE_FILE_NAME = "OPP_TEST_IMAGE.bmp" private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothAdapter = bluetoothManager.adapter private val bluetoothAdapter = bluetoothManager.adapter private var telephonyManager = context.getSystemService(TelephonyManager::class.java)!! private var telephonyManager = context.getSystemService(TelephonyManager::class.java)!! private val DEFAULT_MESSAGE_LEN = 130 private val DEFAULT_MESSAGE_LEN = 130 private var device: UiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) override fun log(request: LogRequest, responseObserver: StreamObserver<LogResponse>) { override fun log(request: LogRequest, responseObserver: StreamObserver<LogResponse>) { grpcUnary(scope, responseObserver) { grpcUnary(scope, responseObserver) { Loading Loading @@ -102,21 +87,6 @@ class AndroidInternal(val context: Context) : AndroidImplBase() { } } } } override fun acceptIncomingFile(request: Empty, responseObserver: StreamObserver<Empty>) { grpcUnary<Empty>(scope, responseObserver) { device .wait(Until.findObject(By.text(INCOMING_FILE_TITLE)), INCOMING_FILE_WAIT_TIMEOUT) .click() device .wait( Until.findObject(By.text(INCOMING_FILE_ACCEPT_BTN)), INCOMING_FILE_WAIT_TIMEOUT ) .click() Empty.getDefaultInstance() } } override fun sendPing(request: SendPingRequest, responseObserver: StreamObserver<Empty>) { override fun sendPing(request: SendPingRequest, responseObserver: StreamObserver<Empty>) { grpcUnary<Empty>(scope, responseObserver) { grpcUnary<Empty>(scope, responseObserver) { val pingStatus = val pingStatus = Loading android/pandora/server/src/Opp.kt +28 −1 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,10 @@ import android.graphics.Bitmap import android.os.Environment import android.os.Environment import android.provider.MediaStore.Images.Media import android.provider.MediaStore.Images.Media import android.provider.MediaStore.MediaColumns import android.provider.MediaStore.MediaColumns import androidx.test.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.google.protobuf.Empty import com.google.protobuf.Empty import io.grpc.stub.StreamObserver import io.grpc.stub.StreamObserver import java.io.Closeable import java.io.Closeable Loading @@ -49,11 +53,15 @@ private const val TAG = "PandoraOpp" @kotlinx.coroutines.ExperimentalCoroutinesApi @kotlinx.coroutines.ExperimentalCoroutinesApi class Opp(val context: Context) : OppImplBase(), Closeable { class Opp(val context: Context) : OppImplBase(), Closeable { private val IMAGE_FILE_NAME = "OPP_TEST_IMAGE.bmp" private val IMAGE_FILE_NAME = "OPP_TEST_IMAGE.bmp" private val INCOMING_FILE_TITLE = "Incoming file" private val INCOMING_FILE_ACCEPT_BTN = "ACCEPT" private val INCOMING_FILE_WAIT_TIMEOUT = 2000L private val flow: Flow<Intent> private val flow: Flow<Intent> private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothAdapter = bluetoothManager.adapter private val bluetoothAdapter = bluetoothManager.adapter private var uiDevice: UiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) init { init { createImageFile() createImageFile() Loading Loading @@ -96,6 +104,25 @@ class Opp(val context: Context) : OppImplBase(), Closeable { } } } } override fun acceptPutOperation( request: Empty, responseObserver: StreamObserver<AcceptPutOperationResponse> ) { grpcUnary<AcceptPutOperationResponse>(scope, responseObserver) { acceptIncomingFile() AcceptPutOperationResponse.newBuilder().setStatus(PutStatus.ACCEPTED).build() } } fun acceptIncomingFile() { uiDevice .wait(Until.findObject(By.text(INCOMING_FILE_TITLE)), INCOMING_FILE_WAIT_TIMEOUT) .click() uiDevice .wait(Until.findObject(By.text(INCOMING_FILE_ACCEPT_BTN)), INCOMING_FILE_WAIT_TIMEOUT) .click() } private suspend fun sendFile(bluetoothDevice: BluetoothDevice) { private suspend fun sendFile(bluetoothDevice: BluetoothDevice) { initiateSendFile(getImageId(IMAGE_FILE_NAME), "image/bmp") initiateSendFile(getImageId(IMAGE_FILE_NAME), "image/bmp") waitBluetoothDevice(bluetoothDevice) waitBluetoothDevice(bluetoothDevice) Loading pandora/interfaces/pandora_experimental/_android.proto +0 −2 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,6 @@ service Android { rpc SetAccessPermission(SetAccessPermissionRequest) returns (google.protobuf.Empty); rpc SetAccessPermission(SetAccessPermissionRequest) returns (google.protobuf.Empty); // Send SMS // Send SMS rpc SendSMS(google.protobuf.Empty) returns (google.protobuf.Empty); rpc SendSMS(google.protobuf.Empty) returns (google.protobuf.Empty); // Accept incoming file rpc AcceptIncomingFile(google.protobuf.Empty) returns (google.protobuf.Empty); // Send ping // Send ping rpc SendPing(SendPingRequest) returns (google.protobuf.Empty); rpc SendPing(SendPingRequest) returns (google.protobuf.Empty); Loading pandora/interfaces/pandora_experimental/opp.proto +13 −2 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,8 @@ service Opp { rpc OpenRfcommChannel(OpenRfcommChannelRequest) returns (google.protobuf.Empty); rpc OpenRfcommChannel(OpenRfcommChannelRequest) returns (google.protobuf.Empty); // Open an l2cap channel for an OBEX connection. // Open an l2cap channel for an OBEX connection. rpc OpenL2capChannel(OpenL2capChannelRequest) returns (google.protobuf.Empty); rpc OpenL2capChannel(OpenL2capChannelRequest) returns (google.protobuf.Empty); // Accept Put request by the Push Client to the Push Server within an OBEX connection. rpc AcceptPutOperation(google.protobuf.Empty) returns (AcceptPutOperationResponse); } } message OpenRfcommChannelRequest { message OpenRfcommChannelRequest { Loading @@ -34,3 +36,12 @@ message OpenRfcommChannelRequest { message OpenL2capChannelRequest { message OpenL2capChannelRequest { bytes address = 1; bytes address = 1; } } enum PutStatus { ACCEPTED = 0; DECLINED = 1; } message AcceptPutOperationResponse { PutStatus status = 1; } No newline at end of file Loading
android/pandora/mmi2grpc/mmi2grpc/opp.py +1 −3 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ from mmi2grpc._proxy import ProfileProxy from pandora.host_grpc import Host from pandora.host_grpc import Host from pandora.host_pb2 import Connection from pandora.host_pb2 import Connection from pandora_experimental._android_grpc import Android from pandora_experimental.opp_grpc import Opp from pandora_experimental.opp_grpc import Opp Loading @@ -35,7 +34,6 @@ class OPPProxy(ProfileProxy): super().__init__(channel) super().__init__(channel) self.host = Host(channel) self.host = Host(channel) self._android = Android(channel) self.opp = Opp(channel) self.opp = Opp(channel) self.connection = None self.connection = None Loading Loading @@ -67,7 +65,7 @@ class OPPProxy(ProfileProxy): """ """ Please accept the PUT REQUEST. Please accept the PUT REQUEST. """ """ self._android.AcceptIncomingFile() self.opp.AcceptPutOperation() return "OK" return "OK" Loading
android/pandora/server/src/AndroidInternal.kt +0 −30 Original line number Original line Diff line number Diff line Loading @@ -24,10 +24,6 @@ import android.telephony.SmsManager import android.telephony.SubscriptionManager import android.telephony.SubscriptionManager import android.telephony.TelephonyManager import android.telephony.TelephonyManager import android.util.Log import android.util.Log import androidx.test.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.google.protobuf.Empty import com.google.protobuf.Empty import io.grpc.stub.StreamObserver import io.grpc.stub.StreamObserver import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope Loading @@ -41,22 +37,11 @@ private const val TAG = "PandoraAndroidInternal" class AndroidInternal(val context: Context) : AndroidImplBase() { class AndroidInternal(val context: Context) : AndroidImplBase() { private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val INCOMING_FILE_ACCEPT_BTN = "ACCEPT" private val INCOMING_FILE_TITLE = "Incoming file" private val INCOMING_FILE_WAIT_TIMEOUT = 2000L // PTS does not configure the Extended Inquiry Response with the // device name; the device will be found after the Inquiry Timeout // (40 secondes) has elapsed. private val BT_DEVICE_SELECT_WAIT_TIMEOUT = 40000L private val IMAGE_FILE_NAME = "OPP_TEST_IMAGE.bmp" private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothAdapter = bluetoothManager.adapter private val bluetoothAdapter = bluetoothManager.adapter private var telephonyManager = context.getSystemService(TelephonyManager::class.java)!! private var telephonyManager = context.getSystemService(TelephonyManager::class.java)!! private val DEFAULT_MESSAGE_LEN = 130 private val DEFAULT_MESSAGE_LEN = 130 private var device: UiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) override fun log(request: LogRequest, responseObserver: StreamObserver<LogResponse>) { override fun log(request: LogRequest, responseObserver: StreamObserver<LogResponse>) { grpcUnary(scope, responseObserver) { grpcUnary(scope, responseObserver) { Loading Loading @@ -102,21 +87,6 @@ class AndroidInternal(val context: Context) : AndroidImplBase() { } } } } override fun acceptIncomingFile(request: Empty, responseObserver: StreamObserver<Empty>) { grpcUnary<Empty>(scope, responseObserver) { device .wait(Until.findObject(By.text(INCOMING_FILE_TITLE)), INCOMING_FILE_WAIT_TIMEOUT) .click() device .wait( Until.findObject(By.text(INCOMING_FILE_ACCEPT_BTN)), INCOMING_FILE_WAIT_TIMEOUT ) .click() Empty.getDefaultInstance() } } override fun sendPing(request: SendPingRequest, responseObserver: StreamObserver<Empty>) { override fun sendPing(request: SendPingRequest, responseObserver: StreamObserver<Empty>) { grpcUnary<Empty>(scope, responseObserver) { grpcUnary<Empty>(scope, responseObserver) { val pingStatus = val pingStatus = Loading
android/pandora/server/src/Opp.kt +28 −1 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,10 @@ import android.graphics.Bitmap import android.os.Environment import android.os.Environment import android.provider.MediaStore.Images.Media import android.provider.MediaStore.Images.Media import android.provider.MediaStore.MediaColumns import android.provider.MediaStore.MediaColumns import androidx.test.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.Until import com.google.protobuf.Empty import com.google.protobuf.Empty import io.grpc.stub.StreamObserver import io.grpc.stub.StreamObserver import java.io.Closeable import java.io.Closeable Loading @@ -49,11 +53,15 @@ private const val TAG = "PandoraOpp" @kotlinx.coroutines.ExperimentalCoroutinesApi @kotlinx.coroutines.ExperimentalCoroutinesApi class Opp(val context: Context) : OppImplBase(), Closeable { class Opp(val context: Context) : OppImplBase(), Closeable { private val IMAGE_FILE_NAME = "OPP_TEST_IMAGE.bmp" private val IMAGE_FILE_NAME = "OPP_TEST_IMAGE.bmp" private val INCOMING_FILE_TITLE = "Incoming file" private val INCOMING_FILE_ACCEPT_BTN = "ACCEPT" private val INCOMING_FILE_WAIT_TIMEOUT = 2000L private val flow: Flow<Intent> private val flow: Flow<Intent> private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default.limitedParallelism(1)) private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!! private val bluetoothAdapter = bluetoothManager.adapter private val bluetoothAdapter = bluetoothManager.adapter private var uiDevice: UiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) init { init { createImageFile() createImageFile() Loading Loading @@ -96,6 +104,25 @@ class Opp(val context: Context) : OppImplBase(), Closeable { } } } } override fun acceptPutOperation( request: Empty, responseObserver: StreamObserver<AcceptPutOperationResponse> ) { grpcUnary<AcceptPutOperationResponse>(scope, responseObserver) { acceptIncomingFile() AcceptPutOperationResponse.newBuilder().setStatus(PutStatus.ACCEPTED).build() } } fun acceptIncomingFile() { uiDevice .wait(Until.findObject(By.text(INCOMING_FILE_TITLE)), INCOMING_FILE_WAIT_TIMEOUT) .click() uiDevice .wait(Until.findObject(By.text(INCOMING_FILE_ACCEPT_BTN)), INCOMING_FILE_WAIT_TIMEOUT) .click() } private suspend fun sendFile(bluetoothDevice: BluetoothDevice) { private suspend fun sendFile(bluetoothDevice: BluetoothDevice) { initiateSendFile(getImageId(IMAGE_FILE_NAME), "image/bmp") initiateSendFile(getImageId(IMAGE_FILE_NAME), "image/bmp") waitBluetoothDevice(bluetoothDevice) waitBluetoothDevice(bluetoothDevice) Loading
pandora/interfaces/pandora_experimental/_android.proto +0 −2 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,6 @@ service Android { rpc SetAccessPermission(SetAccessPermissionRequest) returns (google.protobuf.Empty); rpc SetAccessPermission(SetAccessPermissionRequest) returns (google.protobuf.Empty); // Send SMS // Send SMS rpc SendSMS(google.protobuf.Empty) returns (google.protobuf.Empty); rpc SendSMS(google.protobuf.Empty) returns (google.protobuf.Empty); // Accept incoming file rpc AcceptIncomingFile(google.protobuf.Empty) returns (google.protobuf.Empty); // Send ping // Send ping rpc SendPing(SendPingRequest) returns (google.protobuf.Empty); rpc SendPing(SendPingRequest) returns (google.protobuf.Empty); Loading
pandora/interfaces/pandora_experimental/opp.proto +13 −2 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,8 @@ service Opp { rpc OpenRfcommChannel(OpenRfcommChannelRequest) returns (google.protobuf.Empty); rpc OpenRfcommChannel(OpenRfcommChannelRequest) returns (google.protobuf.Empty); // Open an l2cap channel for an OBEX connection. // Open an l2cap channel for an OBEX connection. rpc OpenL2capChannel(OpenL2capChannelRequest) returns (google.protobuf.Empty); rpc OpenL2capChannel(OpenL2capChannelRequest) returns (google.protobuf.Empty); // Accept Put request by the Push Client to the Push Server within an OBEX connection. rpc AcceptPutOperation(google.protobuf.Empty) returns (AcceptPutOperationResponse); } } message OpenRfcommChannelRequest { message OpenRfcommChannelRequest { Loading @@ -34,3 +36,12 @@ message OpenRfcommChannelRequest { message OpenL2capChannelRequest { message OpenL2capChannelRequest { bytes address = 1; bytes address = 1; } } enum PutStatus { ACCEPTED = 0; DECLINED = 1; } message AcceptPutOperationResponse { PutStatus status = 1; } No newline at end of file