use of nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec in project Gadgetbridge by Freeyourgadget.
the class AppMessageHandlerObsidian method onAppStart.
@Override
public GBDeviceEvent[] onAppStart() {
WeatherSpec weatherSpec = Weather.getInstance().getWeatherSpec();
if (weatherSpec == null) {
return new GBDeviceEvent[] { null };
}
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
sendBytes.encodedBytes = encodeObisdianWeather(weatherSpec);
return new GBDeviceEvent[] { sendBytes };
}
use of nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec in project Gadgetbridge by Freeyourgadget.
the class AppMessageHandlerSquare method onAppStart.
@Override
public GBDeviceEvent[] onAppStart() {
WeatherSpec weatherSpec = Weather.getInstance().getWeatherSpec();
if (weatherSpec == null) {
return new GBDeviceEvent[] { null };
}
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
sendBytes.encodedBytes = encodeSquareWeatherMessage(weatherSpec);
return new GBDeviceEvent[] { sendBytes };
}
use of nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec in project Gadgetbridge by Freeyourgadget.
the class AppMessageHandlerHealthify method onAppStart.
@Override
public GBDeviceEvent[] onAppStart() {
WeatherSpec weatherSpec = Weather.getInstance().getWeatherSpec();
if (weatherSpec == null) {
return new GBDeviceEvent[] { null };
}
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
sendBytes.encodedBytes = encodeHelthifyWeatherMessage(weatherSpec);
return new GBDeviceEvent[] { sendBytes };
}
use of nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec in project Gadgetbridge by Freeyourgadget.
the class WeatherNotificationReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
if (!intent.getAction().contains("WEATHER_UPDATE_2")) {
LOG.info("Wrong action");
return;
}
ParcelableWeather2 weather = null;
try {
weather = intent.getParcelableExtra("ru.gelin.android.weather.notification.EXTRA_WEATHER");
} catch (RuntimeException e) {
e.printStackTrace();
}
if (weather != null) {
Weather.getInstance().setWeather2(weather);
LOG.info("weather in " + weather.location + " is " + weather.currentCondition + " (" + (weather.currentTemp - 273) + "°C)");
WeatherSpec weatherSpec = new WeatherSpec();
weatherSpec.timestamp = (int) (weather.queryTime / 1000);
weatherSpec.location = weather.location;
weatherSpec.currentTemp = weather.currentTemp;
weatherSpec.currentCondition = weather.currentCondition;
weatherSpec.currentConditionCode = weather.currentConditionCode;
weatherSpec.todayMaxTemp = weather.todayHighTemp;
weatherSpec.todayMinTemp = weather.todayLowTemp;
weatherSpec.tomorrowConditionCode = weather.forecastConditionCode;
weatherSpec.tomorrowMaxTemp = weather.forecastHighTemp;
weatherSpec.tomorrowMinTemp = weather.forecastLowTemp;
Weather.getInstance().setWeatherSpec(weatherSpec);
GBApplication.deviceService().onSendWeather(weatherSpec);
}
}
Aggregations