diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce800820d..dece0ab41 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,7 @@
### Changelog
#### Next
-* Haumi: Support flashing newer GPS firmware and GPS ALM
+* Huami: Support flashing newer GPS firmware and GPS ALM
* Amazfit Bip S: Support music control
* Amazfit Bip S: Support flashing firmware, res, gps firmware, watchfaces, fonts and GPS CEP
* Amazfit Bip S: Allow setting high MTU (much faster firmware installation, default off since it does not work for some)
diff --git a/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java b/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java
index 62b0c704a..1ad1c75a4 100644
--- a/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java
+++ b/GBDaoGenerator/src/nodomain/freeyourgadget/gadgetbridge/daogen/GBDaoGenerator.java
@@ -43,7 +43,7 @@ public class GBDaoGenerator {
public static void main(String[] args) throws Exception {
- Schema schema = new Schema(26, MAIN_PACKAGE + ".entities");
+ Schema schema = new Schema(27, MAIN_PACKAGE + ".entities");
Entity userAttributes = addUserAttributes(schema);
Entity user = addUserInfo(schema, userAttributes);
@@ -171,6 +171,7 @@ public class GBDaoGenerator {
device.addStringProperty("identifier").notNull().unique().javaDocGetterAndSetter("The fixed identifier, i.e. MAC address of the device.");
device.addIntProperty("type").notNull().javaDocGetterAndSetter("The DeviceType key, i.e. the GBDevice's type.");
device.addStringProperty("model").javaDocGetterAndSetter("An optional model, further specifying the kind of device-");
+ device.addStringProperty("alias");
Property deviceId = deviceAttributes.addLongProperty("deviceId").notNull().getProperty();
// sorted by the from-date, newest first
Property deviceAttributesSortProperty = getPropertyByName(deviceAttributes, VALID_FROM_UTC);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java
index 994632b13..84e2ace51 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAdapterv2.java
@@ -564,7 +564,10 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter. */
+package nodomain.freeyourgadget.gadgetbridge.database.schema;
+
+import android.database.sqlite.SQLiteDatabase;
+
+import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
+import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
+import nodomain.freeyourgadget.gadgetbridge.entities.DeviceDao;
+
+public class GadgetbridgeUpdate_27 implements DBUpdateScript {
+ @Override
+ public void upgradeSchema(SQLiteDatabase db) {
+ if (!DBHelper.existsColumn(DeviceDao.TABLENAME, DeviceDao.Properties.Alias.columnName, db)) {
+ String ADD_COLUMN_ALIAS = "ALTER TABLE " + DeviceDao.TABLENAME + " ADD COLUMN "
+ + DeviceDao.Properties.Alias.columnName + " TEXT";
+ db.execSQL(ADD_COLUMN_ALIAS);
+ }
+ }
+
+ @Override
+ public void downgradeSchema(SQLiteDatabase db) {
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java
index ca8108c5c..8d8e96b4f 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/AbstractDeviceCoordinator.java
@@ -68,7 +68,7 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
@Override
public GBDevice createDevice(GBDeviceCandidate candidate) {
- return new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), getDeviceType());
+ return new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), null, getDeviceType());
}
@Override
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebblePairingActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebblePairingActivity.java
index ff178edb2..cb6da21e0 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebblePairingActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebblePairingActivity.java
@@ -219,7 +219,7 @@ public class PebblePairingActivity extends AbstractGBActivity {
private void performConnect(GBDevice gbDevice) {
if (gbDevice == null) {
- gbDevice = new GBDevice(mBtDevice.getAddress(), mBtDevice.getName(), DeviceType.PEBBLE);
+ gbDevice = new GBDevice(mBtDevice.getAddress(), mBtDevice.getName(), null, DeviceType.PEBBLE);
}
GBApplication.deviceService().connect(gbDevice);
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java
index cc2724b51..8a39242d4 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java
@@ -66,6 +66,7 @@ public class GBDevice implements Parcelable {
private static final String DEVINFO_ADDR = "ADDR: ";
private static final String DEVINFO_ADDR2 = "ADDR2: ";
private String mName;
+ private String mAlias;
private final String mAddress;
private String mVolatileAddress;
private final DeviceType mDeviceType;
@@ -86,20 +87,22 @@ public class GBDevice implements Parcelable {
private int mNotificationIconDisconnected = R.drawable.ic_notification_disconnected;
private int mNotificationIconLowBattery = R.drawable.ic_notification_low_battery;
- public GBDevice(String address, String name, DeviceType deviceType) {
- this(address, null, name, deviceType);
+ public GBDevice(String address, String name, String alias, DeviceType deviceType) {
+ this(address, null, name, alias, deviceType);
}
- public GBDevice(String address, String address2, String name, DeviceType deviceType) {
+ public GBDevice(String address, String address2, String name, String alias, DeviceType deviceType) {
mAddress = address;
mVolatileAddress = address2;
mName = (name != null) ? name : mAddress;
+ mAlias = alias;
mDeviceType = deviceType;
validate();
}
private GBDevice(Parcel in) {
mName = in.readString();
+ mAlias = in.readString();
mAddress = in.readString();
mVolatileAddress = in.readString();
mDeviceType = DeviceType.values()[in.readInt()];
@@ -124,6 +127,7 @@ public class GBDevice implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mName);
+ dest.writeString(mAlias);
dest.writeString(mAddress);
dest.writeString(mVolatileAddress);
dest.writeInt(mDeviceType.ordinal());
@@ -153,6 +157,10 @@ public class GBDevice implements Parcelable {
return mName;
}
+ public String getAlias() {
+ return mAlias;
+ }
+
public void setName(String name) {
if (name == null) {
LOG.warn("Ignoring setting of GBDevice name to null for " + this);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java
index f6ef5d942..c6640ca45 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java
@@ -154,14 +154,14 @@ public class DeviceHelper {
Prefs prefs = GBApplication.getPrefs();
String miAddr = prefs.getString(MiBandConst.PREF_MIBAND_ADDRESS, "");
if (miAddr.length() > 0) {
- GBDevice miDevice = new GBDevice(miAddr, "MI", DeviceType.MIBAND);
+ GBDevice miDevice = new GBDevice(miAddr, "MI", null, DeviceType.MIBAND);
availableDevices.add(miDevice);
}
String pebbleEmuAddr = prefs.getString("pebble_emu_addr", "");
String pebbleEmuPort = prefs.getString("pebble_emu_port", "");
if (pebbleEmuAddr.length() >= 7 && pebbleEmuPort.length() > 0) {
- GBDevice pebbleEmuDevice = new GBDevice(pebbleEmuAddr + ":" + pebbleEmuPort, "Pebble qemu", DeviceType.PEBBLE);
+ GBDevice pebbleEmuDevice = new GBDevice(pebbleEmuAddr + ":" + pebbleEmuPort, "Pebble qemu", "", DeviceType.PEBBLE);
availableDevices.add(pebbleEmuDevice);
}
return availableDevices;
@@ -280,7 +280,7 @@ public class DeviceHelper {
*/
public GBDevice toGBDevice(Device dbDevice) {
DeviceType deviceType = DeviceType.fromKey(dbDevice.getType());
- GBDevice gbDevice = new GBDevice(dbDevice.getIdentifier(), dbDevice.getName(), deviceType);
+ GBDevice gbDevice = new GBDevice(dbDevice.getIdentifier(), dbDevice.getName(), dbDevice.getAlias(), deviceType);
List deviceAttributesList = dbDevice.getDeviceAttributesList();
if (deviceAttributesList.size() > 0) {
gbDevice.setModel(dbDevice.getModel());