Search in sources :

Example 1 with VibrationProfile

use of nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile in project Gadgetbridge by Freeyourgadget.

the class MiBandSupport method performPreferredNotification.

private void performPreferredNotification(String task, @Nullable SimpleNotification simpleNotification, String notificationOrigin, BtLEAction extraAction) {
    try {
        TransactionBuilder builder = performInitialized(task);
        Prefs prefs = GBApplication.getPrefs();
        int vibrateDuration = getPreferredVibrateDuration(notificationOrigin, prefs);
        int vibratePause = getPreferredVibratePause(notificationOrigin, prefs);
        short vibrateTimes = getPreferredVibrateCount(notificationOrigin, prefs);
        VibrationProfile profile = getPreferredVibrateProfile(notificationOrigin, prefs, vibrateTimes);
        int flashTimes = getPreferredFlashCount(notificationOrigin, prefs);
        int flashColour = getPreferredFlashColour(notificationOrigin, prefs);
        int originalColour = getPreferredOriginalColour(notificationOrigin, prefs);
        int flashDuration = getPreferredFlashDuration(notificationOrigin, prefs);
        //            setLowLatency(builder);
        sendCustomNotification(profile, simpleNotification, flashTimes, flashColour, originalColour, flashDuration, extraAction, builder);
        //            setHighLatency(builder);
        //            sendCustomNotification(vibrateDuration, vibrateTimes, vibratePause, flashTimes, flashColour, originalColour, flashDuration, builder);
        builder.queue(getQueue());
    } catch (IOException ex) {
        LOG.error("Unable to send notification to MI device", ex);
    }
}
Also used : VibrationProfile(nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile) TransactionBuilder(nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder) IOException(java.io.IOException) Prefs(nodomain.freeyourgadget.gadgetbridge.util.Prefs)

Example 2 with VibrationProfile

use of nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile in project Gadgetbridge by Freeyourgadget.

the class V2NotificationStrategy method sendDefaultNotification.

@Override
public void sendDefaultNotification(TransactionBuilder builder, SimpleNotification simpleNotification, BtLEAction extraAction) {
    VibrationProfile profile = VibrationProfile.getProfile(VibrationProfile.ID_MEDIUM, (short) 3);
    sendCustomNotification(profile, simpleNotification, extraAction, builder);
}
Also used : VibrationProfile(nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile)

Example 3 with VibrationProfile

use of nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile in project Gadgetbridge by Freeyourgadget.

the class MiBand2Support method performPreferredNotification.

private void performPreferredNotification(String task, String notificationOrigin, SimpleNotification simpleNotification, int alertLevel, BtLEAction extraAction) {
    try {
        TransactionBuilder builder = performInitialized(task);
        Prefs prefs = GBApplication.getPrefs();
        int vibrateDuration = getPreferredVibrateDuration(notificationOrigin, prefs);
        int vibratePause = getPreferredVibratePause(notificationOrigin, prefs);
        short vibrateTimes = getPreferredVibrateCount(notificationOrigin, prefs);
        VibrationProfile profile = getPreferredVibrateProfile(notificationOrigin, prefs, vibrateTimes);
        profile.setAlertLevel(alertLevel);
        int flashTimes = getPreferredFlashCount(notificationOrigin, prefs);
        int flashColour = getPreferredFlashColour(notificationOrigin, prefs);
        int originalColour = getPreferredOriginalColour(notificationOrigin, prefs);
        int flashDuration = getPreferredFlashDuration(notificationOrigin, prefs);
        sendCustomNotification(profile, simpleNotification, flashTimes, flashColour, originalColour, flashDuration, extraAction, builder);
        //            sendCustomNotification(vibrateDuration, vibrateTimes, vibratePause, flashTimes, flashColour, originalColour, flashDuration, builder);
        builder.queue(getQueue());
    } catch (IOException ex) {
        LOG.error("Unable to send notification to MI device", ex);
    }
}
Also used : VibrationProfile(nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile) TransactionBuilder(nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder) IOException(java.io.IOException) Prefs(nodomain.freeyourgadget.gadgetbridge.util.Prefs)

Aggregations

VibrationProfile (nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile)3 IOException (java.io.IOException)2 TransactionBuilder (nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder)2 Prefs (nodomain.freeyourgadget.gadgetbridge.util.Prefs)2