Search in sources :

Example 6 with WeatherSpec

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 };
}
Also used : GBDeviceEvent(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent) WeatherSpec(nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec) GBDeviceEventSendBytes(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes)

Example 7 with WeatherSpec

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 };
}
Also used : GBDeviceEvent(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent) WeatherSpec(nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec) GBDeviceEventSendBytes(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes)

Example 8 with WeatherSpec

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 };
}
Also used : GBDeviceEvent(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent) WeatherSpec(nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec) GBDeviceEventSendBytes(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes)

Example 9 with WeatherSpec

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);
    }
}
Also used : ParcelableWeather2(ru.gelin.android.weather.notification.ParcelableWeather2) WeatherSpec(nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec)

Aggregations

WeatherSpec (nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec)9 GBDeviceEvent (nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent)7 GBDeviceEventSendBytes (nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes)7 Uri (android.net.Uri)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 GBDevice (nodomain.freeyourgadget.gadgetbridge.impl.GBDevice)1 Alarm (nodomain.freeyourgadget.gadgetbridge.model.Alarm)1 CalendarEventSpec (nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec)1 CallSpec (nodomain.freeyourgadget.gadgetbridge.model.CallSpec)1 CannedMessagesSpec (nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec)1 EXTRA_APP_UUID (nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_APP_UUID)1 MusicSpec (nodomain.freeyourgadget.gadgetbridge.model.MusicSpec)1 MusicStateSpec (nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec)1 NotificationSpec (nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec)1 NotificationType (nodomain.freeyourgadget.gadgetbridge.model.NotificationType)1 GBPrefs (nodomain.freeyourgadget.gadgetbridge.util.GBPrefs)1 Prefs (nodomain.freeyourgadget.gadgetbridge.util.Prefs)1 ParcelableWeather2 (ru.gelin.android.weather.notification.ParcelableWeather2)1