2021-01-10 23:37:09 +01:00
|
|
|
/* Copyright (C) 2019-2021 Daniel Dakhno
|
|
|
|
|
|
|
|
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/>. */
|
2019-12-15 14:58:19 +01:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
2020-02-16 01:17:45 +01:00
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.nio.ByteOrder;
|
|
|
|
import java.util.zip.CRC32;
|
2019-12-15 14:58:19 +01:00
|
|
|
|
|
|
|
public class NotificationHRConfiguration implements Serializable {
|
|
|
|
private String packageName;
|
2021-04-20 09:55:27 +02:00
|
|
|
private String iconName;
|
2020-02-16 01:17:45 +01:00
|
|
|
private byte[] packageCrc;
|
2019-12-15 14:58:19 +01:00
|
|
|
|
2021-04-20 09:55:27 +02:00
|
|
|
public NotificationHRConfiguration(String packageName, String iconName) {
|
2019-12-15 14:58:19 +01:00
|
|
|
this.packageName = packageName;
|
2021-04-20 09:55:27 +02:00
|
|
|
this.iconName = iconName;
|
2020-02-16 01:17:45 +01:00
|
|
|
|
|
|
|
CRC32 crc = new CRC32();
|
|
|
|
crc.update(packageName.getBytes());
|
|
|
|
|
|
|
|
this.packageCrc = ByteBuffer
|
|
|
|
.allocate(4)
|
|
|
|
.order(ByteOrder.LITTLE_ENDIAN)
|
|
|
|
.putInt((int) crc.getValue())
|
|
|
|
.array();
|
|
|
|
}
|
|
|
|
|
2021-04-20 09:55:27 +02:00
|
|
|
public NotificationHRConfiguration(String packageName, byte[] packageCrc, String iconName) {
|
2020-02-16 01:17:45 +01:00
|
|
|
this.packageCrc = packageCrc;
|
|
|
|
this.packageName = packageName;
|
2021-04-20 09:55:27 +02:00
|
|
|
this.iconName = iconName;
|
2019-12-15 14:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getPackageName() {
|
|
|
|
return packageName;
|
|
|
|
}
|
|
|
|
|
2021-04-20 09:55:27 +02:00
|
|
|
public String getIconName() {
|
|
|
|
return iconName;
|
2019-12-15 14:58:19 +01:00
|
|
|
}
|
2020-02-16 01:17:45 +01:00
|
|
|
|
|
|
|
public byte[] getPackageCrc() {
|
|
|
|
return packageCrc;
|
|
|
|
}
|
2019-12-15 14:58:19 +01:00
|
|
|
}
|