Add air pressure at sealevel data type (#39)
This commit is contained in:
parent
01959ce3b7
commit
fa96904c8b
@ -15,8 +15,8 @@ android {
|
|||||||
applicationId = "de.timklge.karooheadwind"
|
applicationId = "de.timklge.karooheadwind"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 11
|
versionCode = 12
|
||||||
versionName = "1.2.3"
|
versionName = "1.2.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
"packageName": "de.timklge.karooheadwind",
|
"packageName": "de.timklge.karooheadwind",
|
||||||
"iconUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/karoo-headwind.png",
|
"iconUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/karoo-headwind.png",
|
||||||
"latestApkUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/app-release.apk",
|
"latestApkUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/app-release.apk",
|
||||||
"latestVersion": "1.2.3",
|
"latestVersion": "1.2.4",
|
||||||
"latestVersionCode": 11,
|
"latestVersionCode": 12,
|
||||||
"developer": "timklge",
|
"developer": "timklge",
|
||||||
"description": "Provides headwind direction, wind speed and other weather data fields",
|
"description": "Provides headwind direction, wind speed and other weather data fields",
|
||||||
"releaseNotes": "Update gps bearing retrieval, data type exposure for other extensions, optimize build"
|
"releaseNotes": "Add sealevel pressure data type"
|
||||||
}
|
}
|
||||||
@ -11,6 +11,7 @@ import de.timklge.karooheadwind.datatypes.WindGustsDataType
|
|||||||
import de.timklge.karooheadwind.datatypes.HeadwindSpeedDataType
|
import de.timklge.karooheadwind.datatypes.HeadwindSpeedDataType
|
||||||
import de.timklge.karooheadwind.datatypes.TailwindAndRideSpeedDataType
|
import de.timklge.karooheadwind.datatypes.TailwindAndRideSpeedDataType
|
||||||
import de.timklge.karooheadwind.datatypes.HeadwindDirectionDataType
|
import de.timklge.karooheadwind.datatypes.HeadwindDirectionDataType
|
||||||
|
import de.timklge.karooheadwind.datatypes.SealevelPressureDataType
|
||||||
import de.timklge.karooheadwind.datatypes.TemperatureDataType
|
import de.timklge.karooheadwind.datatypes.TemperatureDataType
|
||||||
import de.timklge.karooheadwind.datatypes.UserWindSpeedDataType
|
import de.timklge.karooheadwind.datatypes.UserWindSpeedDataType
|
||||||
import de.timklge.karooheadwind.datatypes.WeatherDataType
|
import de.timklge.karooheadwind.datatypes.WeatherDataType
|
||||||
@ -42,7 +43,7 @@ import kotlin.math.absoluteValue
|
|||||||
import kotlin.time.Duration.Companion.hours
|
import kotlin.time.Duration.Companion.hours
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
|
|
||||||
class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.3") {
|
class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.4") {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "karoo-headwind"
|
const val TAG = "karoo-headwind"
|
||||||
}
|
}
|
||||||
@ -68,6 +69,7 @@ class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.2.3") {
|
|||||||
WindDirectionDataType(karooSystem, applicationContext),
|
WindDirectionDataType(karooSystem, applicationContext),
|
||||||
PrecipitationDataType(applicationContext),
|
PrecipitationDataType(applicationContext),
|
||||||
SurfacePressureDataType(applicationContext),
|
SurfacePressureDataType(applicationContext),
|
||||||
|
SealevelPressureDataType(applicationContext),
|
||||||
UserWindSpeedDataType(karooSystem, applicationContext)
|
UserWindSpeedDataType(karooSystem, applicationContext)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,8 @@ suspend fun KarooSystemService.makeOpenMeteoHttpRequest(gpsCoordinates: GpsCoord
|
|||||||
val temperatureUnit = if (profile?.preferredUnit?.temperature != UserProfile.PreferredUnit.UnitType.IMPERIAL) TemperatureUnit.CELSIUS else TemperatureUnit.FAHRENHEIT
|
val temperatureUnit = if (profile?.preferredUnit?.temperature != UserProfile.PreferredUnit.UnitType.IMPERIAL) TemperatureUnit.CELSIUS else TemperatureUnit.FAHRENHEIT
|
||||||
|
|
||||||
return callbackFlow {
|
return callbackFlow {
|
||||||
// https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=surface_pressure,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=1&forecast_days=1&forecast_hours=12
|
// https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=surface_pressure,pressure_msl,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=1&forecast_days=1&forecast_hours=12
|
||||||
val url = "https://api.open-meteo.com/v1/forecast?latitude=${gpsCoordinates.lat}&longitude=${gpsCoordinates.lon}¤t=surface_pressure,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=0&forecast_days=1&forecast_hours=12&wind_speed_unit=${settings.windUnit.id}&precipitation_unit=${precipitationUnit.id}&temperature_unit=${temperatureUnit.id}"
|
val url = "https://api.open-meteo.com/v1/forecast?latitude=${gpsCoordinates.lat}&longitude=${gpsCoordinates.lon}¤t=surface_pressure,pressure_msl,temperature_2m,relative_humidity_2m,precipitation,weather_code,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&hourly=temperature_2m,precipitation_probability,precipitation,weather_code,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timeformat=unixtime&past_hours=0&forecast_days=1&forecast_hours=12&wind_speed_unit=${settings.windUnit.id}&precipitation_unit=${precipitationUnit.id}&temperature_unit=${temperatureUnit.id}"
|
||||||
|
|
||||||
Log.d(KarooHeadwindExtension.TAG, "Http request to ${url}...")
|
Log.d(KarooHeadwindExtension.TAG, "Http request to ${url}...")
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ data class OpenMeteoData(
|
|||||||
@SerialName("precipitation") val precipitation: Double,
|
@SerialName("precipitation") val precipitation: Double,
|
||||||
@SerialName("cloud_cover") val cloudCover: Int,
|
@SerialName("cloud_cover") val cloudCover: Int,
|
||||||
@SerialName("surface_pressure") val surfacePressure: Double,
|
@SerialName("surface_pressure") val surfacePressure: Double,
|
||||||
|
@SerialName("pressure_msl") val sealevelPressure: Double,
|
||||||
@SerialName("wind_speed_10m") val windSpeed: Double,
|
@SerialName("wind_speed_10m") val windSpeed: Double,
|
||||||
@SerialName("wind_direction_10m") val windDirection: Double,
|
@SerialName("wind_direction_10m") val windDirection: Double,
|
||||||
@SerialName("wind_gusts_10m") val windGusts: Double,
|
@SerialName("wind_gusts_10m") val windGusts: Double,
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package de.timklge.karooheadwind.datatypes
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import de.timklge.karooheadwind.OpenMeteoCurrentWeatherResponse
|
||||||
|
|
||||||
|
class SealevelPressureDataType(context: Context) : BaseDataType(context, "sealevelPressure"){
|
||||||
|
override fun getValue(data: OpenMeteoCurrentWeatherResponse): Double {
|
||||||
|
return data.current.sealevelPressure
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -80,7 +80,7 @@ class WeatherDataType(
|
|||||||
while (true){
|
while (true){
|
||||||
emit(StreamData(
|
emit(StreamData(
|
||||||
OpenMeteoCurrentWeatherResponse(
|
OpenMeteoCurrentWeatherResponse(
|
||||||
OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
|
OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 980.0, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
|
||||||
0.0, 0.0, "Europe/Berlin", 30.0, 0,
|
0.0, 0.0, "Europe/Berlin", 30.0, 0,
|
||||||
|
|
||||||
null
|
null
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class WeatherForecastDataType(
|
|||||||
emit(
|
emit(
|
||||||
StreamData(
|
StreamData(
|
||||||
OpenMeteoCurrentWeatherResponse(
|
OpenMeteoCurrentWeatherResponse(
|
||||||
OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
|
OpenMeteoData(Instant.now().epochSecond, 0, 20.0, 50, 3.0, 0, 1013.25, 980.0, 15.0, 30.0, 30.0, WeatherInterpretation.getKnownWeatherCodes().random()),
|
||||||
0.0, 0.0, "Europe/Berlin", 30.0, 0,
|
0.0, 0.0, "Europe/Berlin", 30.0, 0,
|
||||||
|
|
||||||
OpenMeteoForecastData(forecastTimes, forecastTemperatures, forecastPrecipitationPropability,
|
OpenMeteoForecastData(forecastTimes, forecastTemperatures, forecastPrecipitationPropability,
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
<string name="precipitation_description">Current precipitation (rainfall / snowfall)</string>
|
<string name="precipitation_description">Current precipitation (rainfall / snowfall)</string>
|
||||||
<string name="surfacePressure">Surface pressure</string>
|
<string name="surfacePressure">Surface pressure</string>
|
||||||
<string name="surfacePressure_description">Atmospheric pressure at surface in configured unit</string>
|
<string name="surfacePressure_description">Atmospheric pressure at surface in configured unit</string>
|
||||||
|
<string name="sealevelPressure">Sealevel pressure</string>
|
||||||
|
<string name="sealevelPressure_description">Atmospheric pressure at sea level in configured unit</string>
|
||||||
<string name="weather">Weather</string>
|
<string name="weather">Weather</string>
|
||||||
<string name="weather_description">Current weather conditions</string>
|
<string name="weather_description">Current weather conditions</string>
|
||||||
<string name="weather_forecast">Weather Forecast</string>
|
<string name="weather_forecast">Weather Forecast</string>
|
||||||
|
|||||||
@ -95,6 +95,13 @@
|
|||||||
icon="@drawable/ic_cloud"
|
icon="@drawable/ic_cloud"
|
||||||
typeId="surfacePressure" />
|
typeId="surfacePressure" />
|
||||||
|
|
||||||
|
<DataType
|
||||||
|
description="@string/sealevelPressure_description"
|
||||||
|
displayName="@string/sealevelPressure"
|
||||||
|
graphical="false"
|
||||||
|
icon="@drawable/ic_cloud"
|
||||||
|
typeId="sealevelPressure" />
|
||||||
|
|
||||||
<DataType
|
<DataType
|
||||||
description="@string/temperature_description"
|
description="@string/temperature_description"
|
||||||
displayName="@string/temperature"
|
displayName="@string/temperature"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user