mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Huawei: Add UV index support
Also adds "0.0 to 15.0" comment to the weatherSpec uvIndex.
This commit is contained in:
parent
2e091492f5
commit
fbe727644e
@ -423,6 +423,10 @@ public class HuaweiCoordinator {
|
|||||||
return supportsCommandForService(0x0f, 0x0b);
|
return supportsCommandForService(0x0f, 0x0b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean supportsWeatherUvIndex() {
|
||||||
|
return supportsExpandCapability(0x2f);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean supportsWorkouts() {
|
public boolean supportsWorkouts() {
|
||||||
return supportsCommandForService(0x17, 0x01);
|
return supportsCommandForService(0x17, 0x01);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,9 @@ public class Weather {
|
|||||||
// WeatherSunMoonSupport
|
// WeatherSunMoonSupport
|
||||||
public boolean sunRiseSetSupported = false;
|
public boolean sunRiseSetSupported = false;
|
||||||
public boolean moonPhaseSupported = false;
|
public boolean moonPhaseSupported = false;
|
||||||
|
|
||||||
|
// ExpandCapabilityRequest
|
||||||
|
public boolean uvIndexSupported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum WeatherIcon {
|
public enum WeatherIcon {
|
||||||
@ -358,6 +361,7 @@ public class Weather {
|
|||||||
HuaweiTemperatureFormat temperatureUnit,
|
HuaweiTemperatureFormat temperatureUnit,
|
||||||
Short airQualityIndex,
|
Short airQualityIndex,
|
||||||
Integer observationTime,
|
Integer observationTime,
|
||||||
|
Float uvIndex,
|
||||||
String sourceName
|
String sourceName
|
||||||
) {
|
) {
|
||||||
super(paramsProvider);
|
super(paramsProvider);
|
||||||
@ -411,7 +415,8 @@ public class Weather {
|
|||||||
this.tlv.put(0x0c, observationTime);
|
this.tlv.put(0x0c, observationTime);
|
||||||
if (sourceName != null && settings.sourceSupported)
|
if (sourceName != null && settings.sourceSupported)
|
||||||
this.tlv.put(0x0e, sourceName);
|
this.tlv.put(0x0e, sourceName);
|
||||||
this.tlv.put(0x0f, (byte) 0);
|
if (uvIndex != null && settings.uvIndexSupported)
|
||||||
|
this.tlv.put(0x0f, uvIndex.byteValue());
|
||||||
|
|
||||||
this.isEncrypted = true;
|
this.isEncrypted = true;
|
||||||
this.complete = true;
|
this.complete = true;
|
||||||
|
@ -54,7 +54,7 @@ public class WeatherSpec implements Parcelable, Serializable {
|
|||||||
public int todayMinTemp; // kelvin
|
public int todayMinTemp; // kelvin
|
||||||
public float windSpeed; // km per hour
|
public float windSpeed; // km per hour
|
||||||
public int windDirection; // deg
|
public int windDirection; // deg
|
||||||
public float uvIndex;
|
public float uvIndex; // 0.0 to 15.0
|
||||||
public int precipProbability; // %
|
public int precipProbability; // %
|
||||||
public int dewPoint; // kelvin
|
public int dewPoint; // kelvin
|
||||||
public float pressure; // mb
|
public float pressure; // mb
|
||||||
@ -357,7 +357,7 @@ public class WeatherSpec implements Parcelable, Serializable {
|
|||||||
public int humidity;
|
public int humidity;
|
||||||
public float windSpeed; // km per hour
|
public float windSpeed; // km per hour
|
||||||
public int windDirection; // deg
|
public int windDirection; // deg
|
||||||
public float uvIndex;
|
public float uvIndex; // 0.0 to 15.0
|
||||||
public int precipProbability; // %
|
public int precipProbability; // %
|
||||||
public int sunRise;
|
public int sunRise;
|
||||||
public int sunSet;
|
public int sunSet;
|
||||||
@ -438,7 +438,7 @@ public class WeatherSpec implements Parcelable, Serializable {
|
|||||||
public int humidity;
|
public int humidity;
|
||||||
public float windSpeed; // km per hour
|
public float windSpeed; // km per hour
|
||||||
public int windDirection; // deg
|
public int windDirection; // deg
|
||||||
public float uvIndex;
|
public float uvIndex; // 0.0 to 15.0
|
||||||
public int precipProbability; // %
|
public int precipProbability; // %
|
||||||
|
|
||||||
public Hourly() {
|
public Hourly() {
|
||||||
|
@ -1877,6 +1877,7 @@ public class HuaweiSupportProvider {
|
|||||||
WeatherSpec weatherSpec = weatherSpecs.get(0);
|
WeatherSpec weatherSpec = weatherSpecs.get(0);
|
||||||
|
|
||||||
Weather.Settings weatherSettings = new Weather.Settings();
|
Weather.Settings weatherSettings = new Weather.Settings();
|
||||||
|
weatherSettings.uvIndexSupported = getHuaweiCoordinator().supportsWeatherUvIndex();
|
||||||
|
|
||||||
SendWeatherStartRequest weatherStartRequest = new SendWeatherStartRequest(this, weatherSettings);
|
SendWeatherStartRequest weatherStartRequest = new SendWeatherStartRequest(this, weatherSettings);
|
||||||
try {
|
try {
|
||||||
|
@ -66,6 +66,7 @@ public class SendWeatherCurrentRequest extends Request {
|
|||||||
temperatureFormat,
|
temperatureFormat,
|
||||||
aqi,
|
aqi,
|
||||||
weatherSpec.timestamp,
|
weatherSpec.timestamp,
|
||||||
|
weatherSpec.uvIndex,
|
||||||
"Gadgetbridge"
|
"Gadgetbridge"
|
||||||
).serialize();
|
).serialize();
|
||||||
} catch (HuaweiPacket.CryptoException e) {
|
} catch (HuaweiPacket.CryptoException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user