Add extra handler for generic notifications
(instead of misusing onSMS handler). Pebble still does that, but not everybody has to. Small step for #53
This commit is contained in:
parent
c81e28c030
commit
27d725853f
|
@ -63,6 +63,12 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
|||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGenericNotification(String title, String details) {
|
||||
byte[] bytes = gbDeviceProtocol.encodeGenericNotification(title, details);
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetTime(long ts) {
|
||||
byte[] bytes = gbDeviceProtocol.encodeSetTime(ts);
|
||||
|
|
|
@ -5,6 +5,8 @@ public interface EventHandler {
|
|||
|
||||
void onEmail(String from, String subject, String body);
|
||||
|
||||
void onGenericNotification(String title, String details);
|
||||
|
||||
void onSetTime(long ts);
|
||||
|
||||
void onSetCallState(String number, String name, GBCommand command);
|
||||
|
|
|
@ -126,6 +126,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||
performDefaultNotification("email received");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGenericNotification(String title, String details) {
|
||||
performDefaultNotification("generic notification received");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetTime(long ts) {
|
||||
try {
|
||||
|
|
|
@ -224,6 +224,11 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_EMAIL, 0, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeGenericNotification(String title, String details) {
|
||||
return encodeSMS(title, details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeSetTime(long ts) {
|
||||
if (ts == -1) {
|
||||
|
|
|
@ -12,6 +12,10 @@ public abstract class GBDeviceProtocol {
|
|||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodeGenericNotification(String title, String details) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodeSetTime(long ts) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue