Mi Band 2/Bip: set user info from user attributes
parent
2be84435ce
commit
46b50515f3
|
@ -377,14 +377,21 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
String alias = prefs.getString(MiBandConst.PREF_USER_ALIAS, null);
|
String alias = prefs.getString(MiBandConst.PREF_USER_ALIAS, null);
|
||||||
LOG.info("Attempting to set user info...");
|
LOG.info("Attempting to set user info...");
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_8_USER_SETTINGS);
|
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_8_USER_SETTINGS);
|
||||||
if (characteristic != null || alias == null) {
|
if (characteristic != null && alias != null) {
|
||||||
// TODO: get all from userattributes
|
ActivityUser activityUser = new ActivityUser();
|
||||||
short birth_year = 1980;
|
int birth_year = activityUser.getYearOfBirth();
|
||||||
byte birth_month = 12;
|
byte birth_month = 7; // not in user attributes
|
||||||
byte birth_day = 24;
|
byte birth_day = 1; // not in user attributes
|
||||||
byte sex = 0; // male 0. female 1, other 2
|
byte sex = 2; // other
|
||||||
short height = 175;
|
switch (activityUser.getGender()) {
|
||||||
short weight = 70;
|
case ActivityUser.GENDER_MALE:
|
||||||
|
sex = 0;
|
||||||
|
break;
|
||||||
|
case ActivityUser.GENDER_FEMALE:
|
||||||
|
sex = 1;
|
||||||
|
}
|
||||||
|
int height = activityUser.getHeightCm();
|
||||||
|
int weight = activityUser.getWeightKg();
|
||||||
int userid = alias.hashCode(); // hash from alias like mi1
|
int userid = alias.hashCode(); // hash from alias like mi1
|
||||||
|
|
||||||
// FIXME: Do encoding like in PebbleProtocol, this is ugly
|
// FIXME: Do encoding like in PebbleProtocol, this is ugly
|
||||||
|
@ -1444,7 +1451,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
LOG.info("phase3Initialize...");
|
LOG.info("phase3Initialize...");
|
||||||
setDateDisplay(builder);
|
setDateDisplay(builder);
|
||||||
setTimeFormat(builder);
|
setTimeFormat(builder);
|
||||||
///setUserInfo(builder);
|
setUserInfo(builder);
|
||||||
setWearLocation(builder);
|
setWearLocation(builder);
|
||||||
setFitnessGoal(builder);
|
setFitnessGoal(builder);
|
||||||
setDisplayItems(builder);
|
setDisplayItems(builder);
|
||||||
|
|
Loading…
Reference in New Issue