2019-02-13 20:43:30 +01:00
|
|
|
/* Copyright (C) 2015-2019 Andreas Shimokawa, Carsten Pfeiffer, Christian
|
2017-09-12 12:39:15 +02:00
|
|
|
Fischer, Daniele Gobbetti, José Rebelo, Michal Novotny, Szymon Tomasz Stefanek
|
2017-03-10 14:53:19 +01:00
|
|
|
|
|
|
|
This file is part of Gadgetbridge.
|
|
|
|
|
|
|
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Gadgetbridge is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2015-08-03 23:09:49 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices.miband;
|
2015-05-07 01:30:40 +02:00
|
|
|
|
2015-05-17 22:57:37 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2016-04-25 23:39:03 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
2017-03-15 00:26:39 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.util.Version;
|
2016-04-25 23:39:03 +02:00
|
|
|
|
2015-05-17 22:57:37 +02:00
|
|
|
public final class MiBandConst {
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(MiBandConst.class);
|
|
|
|
|
|
|
|
public static final String PREF_USER_ALIAS = "mi_user_alias";
|
2015-06-20 23:22:22 +02:00
|
|
|
public static final String PREF_MIBAND_WEARSIDE = "mi_wearside";
|
2015-05-17 22:57:37 +02:00
|
|
|
public static final String PREF_MIBAND_ADDRESS = "development_miaddr"; // FIXME: should be prefixed mi_
|
2015-06-26 17:22:42 +02:00
|
|
|
public static final String PREF_MIBAND_ALARMS = "mi_alarms";
|
2015-09-07 12:06:56 +02:00
|
|
|
public static final String PREF_MIBAND_DONT_ACK_TRANSFER = "mi_dont_ack_transfer";
|
2015-12-17 16:11:35 +01:00
|
|
|
public static final String PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR = "mi_reserve_alarm_calendar";
|
2017-09-05 22:37:41 +02:00
|
|
|
public static final String PREF_MIBAND_BUTTON_ACTION_ENABLE = "mi2_enable_button_action";
|
|
|
|
public static final String PREF_MIBAND_BUTTON_ACTION_VIBRATE = "mi2_button_action_vibrate";
|
|
|
|
public static final String PREF_MIBAND_BUTTON_PRESS_COUNT = "mi_button_press_count";
|
|
|
|
public static final String PREF_MIBAND_BUTTON_PRESS_MAX_DELAY = "mi_button_press_count_max_delay";
|
2017-09-10 21:11:50 +02:00
|
|
|
public static final String PREF_MIBAND_BUTTON_ACTION_DELAY = "mi_button_press_count_match_delay";
|
2017-09-05 22:37:41 +02:00
|
|
|
public static final String PREF_MIBAND_BUTTON_PRESS_BROADCAST = "mi_button_press_broadcast";
|
2016-04-02 16:09:30 +02:00
|
|
|
public static final String PREF_MIBAND_USE_HR_FOR_SLEEP_DETECTION = "mi_hr_sleep_detection";
|
2019-06-05 14:11:44 +02:00
|
|
|
public static final String PREF_MIBAND_DEVICE_TIME_OFFSET_HOURS = "device_time_offset_hours";
|
2016-11-13 20:47:24 +01:00
|
|
|
public static final String PREF_MI2_DATEFORMAT = "mi2_dateformat";
|
2017-07-15 00:40:58 +02:00
|
|
|
public static final String PREF_MI2_GOAL_NOTIFICATION = "mi2_goal_notification";
|
2017-07-09 16:17:13 +02:00
|
|
|
public static final String PREF_MI2_DISPLAY_ITEM_CLOCK = "clock";
|
|
|
|
public static final String PREF_MI2_DISPLAY_ITEM_STEPS = "steps";
|
|
|
|
public static final String PREF_MI2_DISPLAY_ITEM_DISTANCE = "distance";
|
|
|
|
public static final String PREF_MI2_DISPLAY_ITEM_CALORIES = "calories";
|
|
|
|
public static final String PREF_MI2_DISPLAY_ITEM_HEART_RATE = "heart_rate";
|
|
|
|
public static final String PREF_MI2_DISPLAY_ITEM_BATTERY = "battery";
|
2017-07-09 14:30:03 +02:00
|
|
|
public static final String PREF_MI2_ROTATE_WRIST_TO_SWITCH_INFO = "mi2_rotate_wrist_to_switch_info";
|
2017-03-15 00:26:39 +01:00
|
|
|
public static final String PREF_MI2_ENABLE_TEXT_NOTIFICATIONS = "mi2_enable_text_notifications";
|
2019-05-24 23:46:20 +02:00
|
|
|
public static final String PREF_DO_NOT_DISTURB = "do_not_disturb";
|
|
|
|
public static final String PREF_DO_NOT_DISTURB_OFF = "off";
|
|
|
|
public static final String PREF_DO_NOT_DISTURB_AUTOMATIC = "automatic";
|
|
|
|
public static final String PREF_DO_NOT_DISTURB_SCHEDULED = "scheduled";
|
|
|
|
public static final String PREF_DO_NOT_DISTURB_START = "do_not_disturb_start";
|
|
|
|
public static final String PREF_DO_NOT_DISTURB_END = "do_not_disturb_end";
|
2017-07-15 22:48:26 +02:00
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS = "mi2_inactivity_warnings";
|
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD = "mi2_inactivity_warnings_threshold";
|
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS_START = "mi2_inactivity_warnings_start";
|
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS_END = "mi2_inactivity_warnings_end";
|
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS_DND = "mi2_inactivity_warnings_dnd";
|
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS_DND_START = "mi2_inactivity_warnings_dnd_start";
|
|
|
|
public static final String PREF_MI2_INACTIVITY_WARNINGS_DND_END = "mi2_inactivity_warnings_dnd_end";
|
2017-01-25 22:59:32 +01:00
|
|
|
public static final String PREF_MIBAND_SETUP_BT_PAIRING = "mi_setup_bt_pairing";
|
2016-10-09 00:10:53 +02:00
|
|
|
|
2019-05-22 00:42:22 +02:00
|
|
|
public static final String PREF_SWIPE_UNLOCK = "swipe_unlock";
|
2019-05-22 10:49:59 +02:00
|
|
|
public static final String PREF_NIGHT_MODE = "night_mode";
|
|
|
|
public static final String PREF_NIGHT_MODE_START = "night_mode_start";
|
|
|
|
public static final String PREF_NIGHT_MODE_END = "night_mode_end";
|
|
|
|
public static final String PREF_NIGHT_MODE_OFF = "off";
|
|
|
|
public static final String PREF_NIGHT_MODE_SUNSET = "sunset";
|
|
|
|
public static final String PREF_NIGHT_MODE_SCHEDULED = "scheduled";
|
2015-09-07 12:06:56 +02:00
|
|
|
|
2015-06-20 23:22:22 +02:00
|
|
|
public static final String ORIGIN_INCOMING_CALL = "incoming_call";
|
2017-02-07 23:49:10 +01:00
|
|
|
public static final String ORIGIN_ALARM_CLOCK = "alarm_clock";
|
2016-06-28 00:35:50 +02:00
|
|
|
public static final String MI_GENERAL_NAME_PREFIX = "MI";
|
2015-12-07 01:11:07 +01:00
|
|
|
public static final String MI_1 = "1";
|
|
|
|
public static final String MI_1A = "1A";
|
|
|
|
public static final String MI_1S = "1S";
|
2016-05-15 00:15:31 +02:00
|
|
|
public static final String MI_AMAZFIT = "Amazfit";
|
2016-06-05 22:27:02 +02:00
|
|
|
public static final String MI_PRO = "2";
|
2015-05-17 22:57:37 +02:00
|
|
|
|
2017-03-15 00:26:39 +01:00
|
|
|
public static final Version MI2_FW_VERSION_MIN_TEXT_NOTIFICATIONS = new Version("1.0.1.28");
|
|
|
|
public static final Version MI2_FW_VERSION_INTERMEDIATE_UPGRADE_53 = new Version("1.0.0.53");
|
|
|
|
|
2017-10-02 22:23:17 +02:00
|
|
|
public enum DistanceUnit {
|
|
|
|
METRIC,
|
|
|
|
IMPERIAL
|
|
|
|
}
|
|
|
|
|
2016-04-25 23:39:03 +02:00
|
|
|
public static int getNotificationPrefIntValue(String pref, String origin, Prefs prefs, int defaultValue) {
|
2015-05-17 22:57:37 +02:00
|
|
|
String key = getNotificationPrefKey(pref, origin);
|
2016-04-25 23:39:03 +02:00
|
|
|
return prefs.getInt(key, defaultValue);
|
2015-05-17 22:57:37 +02:00
|
|
|
}
|
|
|
|
|
2016-04-25 23:39:03 +02:00
|
|
|
public static String getNotificationPrefStringValue(String pref, String origin, Prefs prefs, String defaultValue) {
|
2015-06-20 23:22:22 +02:00
|
|
|
String key = getNotificationPrefKey(pref, origin);
|
|
|
|
return prefs.getString(key, defaultValue);
|
|
|
|
}
|
|
|
|
|
2015-10-21 23:29:37 +02:00
|
|
|
public static String getNotificationPrefKey(String pref, String origin) {
|
|
|
|
return pref + '_' + origin;
|
2015-05-17 22:57:37 +02:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:22:22 +02:00
|
|
|
public static final String VIBRATION_PROFILE = "mi_vibration_profile";
|
2015-05-17 22:57:37 +02:00
|
|
|
public static final String VIBRATION_COUNT = "mi_vibration_count";
|
|
|
|
public static final String VIBRATION_DURATION = "mi_vibration_duration";
|
|
|
|
public static final String VIBRATION_PAUSE = "mi_vibration_pause";
|
|
|
|
public static final String FLASH_COUNT = "mi_flash_count";
|
|
|
|
public static final String FLASH_DURATION = "mi_flash_duration";
|
|
|
|
public static final String FLASH_PAUSE = "mi_flash_pause";
|
|
|
|
public static final String FLASH_COLOUR = "mi_flash_colour";
|
|
|
|
public static final String FLASH_ORIGINAL_COLOUR = "mi_flash_original_colour";
|
|
|
|
|
2015-06-20 23:22:22 +02:00
|
|
|
public static final String DEFAULT_VALUE_VIBRATION_PROFILE = "short";
|
|
|
|
public static final int DEFAULT_VALUE_VIBRATION_COUNT = 3;
|
2015-05-17 22:57:37 +02:00
|
|
|
public static final int DEFAULT_VALUE_VIBRATION_DURATION = 500; // ms
|
|
|
|
public static final int DEFAULT_VALUE_VIBRATION_PAUSE = 500; // ms
|
|
|
|
public static final int DEFAULT_VALUE_FLASH_COUNT = 10; // ms
|
|
|
|
public static final int DEFAULT_VALUE_FLASH_DURATION = 500; // ms
|
|
|
|
public static final int DEFAULT_VALUE_FLASH_PAUSE = 500; // ms
|
|
|
|
public static final int DEFAULT_VALUE_FLASH_COLOUR = 1; // TODO: colour!
|
|
|
|
public static final int DEFAULT_VALUE_FLASH_ORIGINAL_COLOUR = 1; // TODO: colour!
|
2015-05-07 01:30:40 +02:00
|
|
|
}
|