1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-02-17 21:06:48 +01:00

Pebble: manage the dictation session initialization.

Currently we inform the watch that GadgetBridge doesn't support voice input.
This commit is contained in:
Daniele Gobbetti 2017-04-24 21:32:51 +02:00
parent fae116d1bd
commit 534eb385f7

View File

@ -2373,13 +2373,30 @@ public class PebbleProtocol extends GBDeviceProtocol {
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes(); GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
if (command == 0x01) { //session setup if (command == 0x01) { //session setup
sendBytes.encodedBytes = null; int replLenght = 7;
} else if (command == 0x02) { //dictation result byte replStatus = 5; // 5 = disabled, change to 0 to send success
ByteBuffer repl = ByteBuffer.allocate(LENGTH_PREFIX + replLenght);
repl.order(ByteOrder.BIG_ENDIAN);
repl.putShort((short) replLenght);
repl.putShort(ENDPOINT_VOICECONTROL);
repl.put(command);
repl.putInt(flags);
repl.put(session_type);
repl.put(replStatus);
sendBytes.encodedBytes = repl.array();
} else if (command == 0x02) { //dictation result (possibly it is something we send, not something we receive)
sendBytes.encodedBytes = null; sendBytes.encodedBytes = null;
} }
return sendBytes; return sendBytes;
} }
private GBDeviceEvent decodeAudioStream(ByteBuffer buf) {
return null;
}
@Override @Override
public GBDeviceEvent[] decodeResponse(byte[] responseData) { public GBDeviceEvent[] decodeResponse(byte[] responseData) {
ByteBuffer buf = ByteBuffer.wrap(responseData); ByteBuffer buf = ByteBuffer.wrap(responseData);
@ -2639,11 +2656,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
case ENDPOINT_APPLOGS: case ENDPOINT_APPLOGS:
decodeAppLogs(buf); decodeAppLogs(buf);
break; break;
// case ENDPOINT_VOICECONTROL: case ENDPOINT_VOICECONTROL:
// devEvts = new GBDeviceEvent[]{decodeVoiceControl(buf)}; devEvts = new GBDeviceEvent[]{decodeVoiceControl(buf)};
// case ENDPOINT_AUDIOSTREAM: break;
// LOG.debug(GB.hexdump(responseData, 0, responseData.length)); case ENDPOINT_AUDIOSTREAM:
// break; devEvts = new GBDeviceEvent[]{decodeAudioStream(buf)};
// LOG.debug("AUDIOSTREAM DATA: " + GB.hexdump(responseData, 4, length));
break;
default: default:
break; break;
} }