2015-10-04 15:53:11 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.service.devices.pebble;
|
|
|
|
|
|
|
|
|
|
|
|
import android.util.Pair;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
2017-01-08 17:17:29 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
|
2016-05-16 23:00:04 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
2016-12-31 18:56:24 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
2015-10-04 15:53:11 +02:00
|
|
|
|
2017-01-01 16:24:46 +01:00
|
|
|
class AppMessageHandler {
|
2016-12-31 18:56:24 +01:00
|
|
|
final PebbleProtocol mPebbleProtocol;
|
|
|
|
final UUID mUUID;
|
2015-10-04 15:53:11 +02:00
|
|
|
|
|
|
|
AppMessageHandler(UUID uuid, PebbleProtocol pebbleProtocol) {
|
|
|
|
mUUID = uuid;
|
|
|
|
mPebbleProtocol = pebbleProtocol;
|
|
|
|
}
|
|
|
|
|
2016-06-04 21:50:26 +02:00
|
|
|
public boolean isEnabled() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-10-04 15:53:11 +02:00
|
|
|
public UUID getUUID() {
|
|
|
|
return mUUID;
|
|
|
|
}
|
|
|
|
|
|
|
|
public GBDeviceEvent[] handleMessage(ArrayList<Pair<Integer, Object>> pairs) {
|
2017-01-08 17:17:29 +01:00
|
|
|
// Just ACK
|
|
|
|
GBDeviceEventSendBytes sendBytesAck = new GBDeviceEventSendBytes();
|
|
|
|
sendBytesAck.encodedBytes = mPebbleProtocol.encodeApplicationMessageAck(mUUID, mPebbleProtocol.last_id);
|
|
|
|
return new GBDeviceEvent[]{sendBytesAck};
|
2015-10-04 15:53:11 +02:00
|
|
|
}
|
|
|
|
|
2016-12-31 19:04:05 +01:00
|
|
|
public GBDeviceEvent[] onAppStart() {
|
2015-12-23 14:22:28 +01:00
|
|
|
return null;
|
|
|
|
}
|
2016-05-13 23:47:47 +02:00
|
|
|
|
2016-12-31 18:56:24 +01:00
|
|
|
public byte[] encodeUpdateWeather(WeatherSpec weatherSpec) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-05-16 23:00:04 +02:00
|
|
|
protected GBDevice getDevice() {
|
|
|
|
return mPebbleProtocol.getDevice();
|
2016-05-13 23:47:47 +02:00
|
|
|
}
|
2015-10-04 15:53:11 +02:00
|
|
|
}
|