I’m using SAP: Watch as consumer, Phone as provider.
Usually communication in between them is perfect, but I have a bottleneck now: If I send a large data from phone to watch (with SASocket.secureSend
), I can’t interrupt it.
Consider this:
I’m sending a big transaction from phone to watch, and in the middle, I want to send a message back to phone from the watch: this is working , so watch’s message reaches my phone during this other huge transaction. Ie.: SAP seems to handle duplex communication
Problem:
My phone can’t reply to this watch message, it needs to wait first until the huge transfer finishes. I tried using different channels (one channel for commands, one channel for big data), but still big data has to finish sending first before command sending can take place (doesn’t matter it goes on different channel).
Can I somehow interrupt big data sending/start a parallel sending of the command?
Sending currently spawns a thread as it was recommended:
new Thread(new Runnable() {
public void run() {
Log.d(LOG_TAG, "run: SEND START!");
try {
mSASocket.secureSend(getServiceChannelId(0), data.getBytes());
} catch (IOException e) {
e.printStackTrace();
}
Log.d(LOG_TAG, "run: SEND END!");
}
}).start();
I’ve tried interrupting this thread, but it didn’t stopped the huge transaction, so it didn’t help.
How can I either interrupt the huge transaction, or send another message parallel (with higher priority) to the watch?