Search in sources :

Example 1 with DisplayControllMessageMiBand2

use of com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiBand2 in project xDrip by NightscoutFoundation.

the class MiBandService method sendSettings.

private void sendSettings() {
    List<Pair<Integer, Boolean>> features = PrefBindingFactory.getInstance(getPrefBinder()).getStates("miband_feature_");
    FeaturesControllMessage featureMessage = new FeaturesControllMessage();
    for (Pair<Integer, Boolean> item : features) {
        byte[] message = featureMessage.getMessage(item);
        if (message.length != 0) {
            new QueueMe().setBytes(message).setQueueWriteCharacterstic(featureMessage.getCharacteristicUUID()).setDescription("Set feature:" + item.first + ":" + item.second).expireInSeconds(QUEUE_EXPIRED_TIME).setDelayMs(QUEUE_DELAY).queue();
        }
    }
    List<Integer> screenOpt = PrefBindingFactory.getInstance(getPrefBinder()).getEnabled("miband_screen");
    DisplayControllMessage dispMessage;
    MiBand.MiBandType type = MiBand.getMibandType();
    if (type == MI_BAND2)
        dispMessage = new DisplayControllMessageMiBand2();
    else
        dispMessage = new DisplayControllMessageMiband3_4();
    new QueueMe().setBytes(dispMessage.getDisplayItemsCmd(screenOpt)).setQueueWriteCharacterstic(dispMessage.getCharacteristicUUID()).setDescription("Set screens").expireInSeconds(QUEUE_EXPIRED_TIME).setDelayMs(QUEUE_DELAY).queue();
    setNightMode();
}
Also used : DisplayControllMessageMiband3_4(com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiband3_4) FeaturesControllMessage(com.eveningoutpost.dexdrip.watch.miband.message.FeaturesControllMessage) DisplayControllMessageMiBand2(com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiBand2) DisplayControllMessage(com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessage) Pair(android.util.Pair)

Example 2 with DisplayControllMessageMiBand2

use of com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiBand2 in project xDrip-plus by jamorham.

the class MiBandService method sendSettings.

private void sendSettings() {
    List<Pair<Integer, Boolean>> features = PrefBindingFactory.getInstance(getPrefBinder()).getStates("miband_feature_");
    FeaturesControllMessage featureMessage = new FeaturesControllMessage();
    for (Pair<Integer, Boolean> item : features) {
        byte[] message = featureMessage.getMessage(item);
        if (message.length != 0) {
            new QueueMe().setBytes(message).setQueueWriteCharacterstic(featureMessage.getCharacteristicUUID()).setDescription("Set feature:" + item.first + ":" + item.second).expireInSeconds(QUEUE_EXPIRED_TIME).setDelayMs(QUEUE_DELAY).queue();
        }
    }
    List<Integer> screenOpt = PrefBindingFactory.getInstance(getPrefBinder()).getEnabled("miband_screen");
    DisplayControllMessage dispMessage;
    MiBand.MiBandType type = MiBand.getMibandType();
    if (type == MI_BAND2)
        dispMessage = new DisplayControllMessageMiBand2();
    else
        dispMessage = new DisplayControllMessageMiband3_4();
    new QueueMe().setBytes(dispMessage.getDisplayItemsCmd(screenOpt)).setQueueWriteCharacterstic(dispMessage.getCharacteristicUUID()).setDescription("Set screens").expireInSeconds(QUEUE_EXPIRED_TIME).setDelayMs(QUEUE_DELAY).queue();
    setNightMode();
}
Also used : DisplayControllMessageMiband3_4(com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiband3_4) FeaturesControllMessage(com.eveningoutpost.dexdrip.watch.miband.message.FeaturesControllMessage) DisplayControllMessageMiBand2(com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiBand2) DisplayControllMessage(com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessage) Pair(android.util.Pair)

Aggregations

Pair (android.util.Pair)2 DisplayControllMessage (com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessage)2 DisplayControllMessageMiBand2 (com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiBand2)2 DisplayControllMessageMiband3_4 (com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiband3_4)2 FeaturesControllMessage (com.eveningoutpost.dexdrip.watch.miband.message.FeaturesControllMessage)2