Weather
Sets weather listener
The watch can save real-time weather for 2 hours, and the weather information will be cleared after 2 hours. When the watch does not have today's weather information, the watch will reset the weather when it switches to the weather interface.
Sets the weather to monitor weatherChangeEveStm, return the update result of the weather status through the data stream, and return it as a WeatherChangeBean object.
_blePlugin.weatherChangeEveStm.listen(
(WeatherChangeBean event) {
/// Do something with new state,for example:
setState(() {
switch (event.type) {
case WeatherChangeType.updateWeather:
break;
case WeatherChangeType.tempUnitChange:
_weather = event.tempUnit!;
break;
default:
break;
}
});
});
callback Description :
WeatherChangeBean:
callback value | callback type | callback description |
---|---|---|
type | int | Weather change return value type, the type is WeatherChangeType |
tempUnit | int | Temperature unit |
WeatherChangeType:
type | value | value description |
---|---|---|
updateWeather | 1 | Represents the data returned by the weather change monitor |
tempUnitChange | 2 | Represents the data returned by the temperature change monitor |
Sets today's weather
Set the watch's weather for today.
_blePlugin.sendTodayWeather(TodayWeatherBean info);
Parameter Description :
TodayWeatherBean:
value | value type | value description |
---|---|---|
city | String | City |
lunar | String | Lunar Festival (not necessary) |
festival | String | festival(not necessary) |
pm25 | int | PM2.5 |
temp | int | Real-time temperature |
weatherId | int | Weather status,Parameter source WeatherId |
WeatherId:
type | value | value description |
---|---|---|
cloudy | 0 | partly cloudy |
foggy | 1 | fog |
overcast | 2 | overcast |
rainy | 3 | rainy |
snowy | 4 | snowy |
sunny | 5 | sunny |
sandstorm | 6 | sandstorm |
haze | 7 | haze |
Sets weather in the next 7 days
Sets the weather for the next 7 days to the watch.
_blePlugin.sendFutureWeather(FutureWeatherListBean info);
Parameter Description :
FutureWeatherListBean:
value | value type | value description |
---|---|---|
future | List< FutureWeatherBean > | future weather |
FutureWeatherBean:
value | value type | value description |
---|---|---|
weatherId | int | weather Id |
lowTemperature | int | lowest temperature |
highTemperature | int | maximum temperature |