mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 10:35:50 +01:00
Huawei: SetMediumToStrengthThresholdRequest v2 implemented
This commit is contained in:
parent
fa99ea5831
commit
113f9b87c6
@ -396,12 +396,14 @@ public class HuaweiCoordinator {
|
||||
public boolean supportsFitnessThresholdValue() {
|
||||
return supportsCommandForService(0x07, 0x29);
|
||||
}
|
||||
public boolean supportsFitnessThresholdValueV2() { return supportsExpandCapability(0x9a) || supportsExpandCapability(0x9c); }
|
||||
|
||||
// 0x1d - SupportTemperature
|
||||
// 0xba - SupportTemperatureClassification
|
||||
// 0x43 - SupportTemperatureStudy
|
||||
public boolean supportsTemperature() { return supportsExpandCapability(0x1d); }
|
||||
|
||||
|
||||
public boolean supportsEventAlarm() {
|
||||
return supportsCommandForService(0x08, 0x01);
|
||||
}
|
||||
|
@ -550,7 +550,9 @@ public class FitnessData {
|
||||
byte heartRate,
|
||||
byte cycleSpeed,
|
||||
byte sample,
|
||||
byte countLength) {
|
||||
byte countLength,
|
||||
int walkRunSpeed,
|
||||
int walkRunWithHeartRate) {
|
||||
super(paramsProvider);
|
||||
|
||||
this.serviceId = FitnessData.id;
|
||||
@ -571,7 +573,12 @@ public class FitnessData {
|
||||
.put(0x04, cycleSpeed)
|
||||
.put(0x05, sample)
|
||||
.put(0x06, countLength);
|
||||
|
||||
if(walkRunSpeed != -1) {
|
||||
this.tlv.put(0x07, (byte)walkRunSpeed);
|
||||
}
|
||||
if(walkRunWithHeartRate != -1) {
|
||||
this.tlv.put(0x08, (byte)walkRunWithHeartRate);
|
||||
}
|
||||
this.complete = true;
|
||||
}
|
||||
}
|
||||
|
@ -44,14 +44,29 @@ public class SetMediumToStrengthThresholdRequest extends Request {
|
||||
protected List<byte[]> createRequest() throws RequestCreationException {
|
||||
try {
|
||||
//Hardcoded value till interface enable threshold values
|
||||
return new MediumToStrengthThreshold.Request(paramsProvider,
|
||||
(byte)0x6E,
|
||||
(byte)0x3C,
|
||||
(byte)0x05,
|
||||
(byte)0x40,
|
||||
(byte)0x50,
|
||||
(byte)0x03
|
||||
).serialize();
|
||||
if(supportProvider.getHuaweiCoordinator().supportsFitnessThresholdValueV2()) {
|
||||
return new MediumToStrengthThreshold.Request(paramsProvider,
|
||||
(byte) 0x6E,
|
||||
(byte) 0x3C,
|
||||
(byte) 0x19,
|
||||
(byte) 0x58,
|
||||
(byte) 0x01,
|
||||
(byte) 0x01,
|
||||
0x28,
|
||||
0x28
|
||||
).serialize();
|
||||
} else {
|
||||
return new MediumToStrengthThreshold.Request(paramsProvider,
|
||||
(byte) 0x6E,
|
||||
(byte) 0x3C,
|
||||
(byte) 0x05,
|
||||
(byte) 0x40,
|
||||
(byte) 0x50,
|
||||
(byte) 0x03,
|
||||
-1,
|
||||
-1
|
||||
).serialize();
|
||||
}
|
||||
} catch (HuaweiPacket.CryptoException e) {
|
||||
throw new RequestCreationException(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user