2017-03-10 14:53:19 +01:00
|
|
|
/* Copyright (C) 2015-2017 Andreas Shimokawa, Carsten Pfeiffer, Christian
|
|
|
|
Fischer, Daniele Gobbetti, Szymon Tomasz Stefanek
|
|
|
|
|
|
|
|
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";
|
2016-04-02 16:09:30 +02:00
|
|
|
public static final String PREF_MIBAND_USE_HR_FOR_SLEEP_DETECTION = "mi_hr_sleep_detection";
|
2016-06-03 04:43:12 +02:00
|
|
|
public static final String PREF_MIBAND_DEVICE_TIME_OFFSET_HOURS = "mi_device_time_offset_hours";
|
2016-11-13 20:47:24 +01:00
|
|
|
public static final String PREF_MI2_DATEFORMAT = "mi2_dateformat";
|
2017-07-09 16:17:13 +02:00
|
|
|
public static final String PREF_MI2_DISPLAY_ITEMS = "mi2_display_items";
|
|
|
|
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";
|
2016-11-13 21:33:43 +01:00
|
|
|
public static final String PREF_MI2_ACTIVATE_DISPLAY_ON_LIFT = "mi2_activate_display_on_lift_wrist";
|
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";
|
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
|
|
|
|
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";
|
2016-08-17 00:53:16 +02:00
|
|
|
public static final String MI_BAND2_NAME = "MI Band 2";
|
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");
|
|
|
|
|
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
|
|
|
}
|