Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
326e56a24c | ||
|
|
6f388520f5 | ||
|
|
c8a52eec58 | ||
|
|
e568f43dd7 | ||
|
|
22ccdd21ac | ||
|
|
6137fface2 | ||
|
|
4588941a40 | ||
|
|
b943eb2028 | ||
|
|
80e7a3e800 | ||
|
|
51f941f68e | ||
|
|
43a966e81f | ||
|
|
e455bec77b | ||
|
|
a7c4e82050 | ||
|
|
40b2a25633 | ||
|
|
34dccea36f | ||
|
|
0c3188dec0 | ||
|
|
21300cb695 | ||
|
|
5afec93cbf | ||
|
|
482c4cb1e5 | ||
|
|
40794ccc88 | ||
|
|
f27f0d39b0 | ||
|
|
5acfb36369 | ||
|
|
38573fdc85 | ||
|
|
a5ba028d55 | ||
|
|
dfa6288272 | ||
|
|
b62f6510bb | ||
|
|
5d8539282a | ||
|
|
e79315ba9f | ||
|
|
a175a98236 | ||
|
|
1f619a93db | ||
|
|
9f596c4f2c | ||
|
|
e3105027ae |
Vendored
+5
-4
@@ -3,9 +3,10 @@
|
||||
// this groovy script is executed by jenkins
|
||||
node {
|
||||
|
||||
environment {
|
||||
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
||||
}
|
||||
// set environment variables
|
||||
env.ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
||||
env.JAVA_HOME = '/opt/openjdk-bin-11'
|
||||
env.PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
|
||||
|
||||
// checkout code from scm
|
||||
stage('Checkout') {
|
||||
@@ -48,7 +49,7 @@ node {
|
||||
if (env.BRANCH_NAME == "master" && release) {
|
||||
echo "Deploying to production server ..."
|
||||
withCredentials([sshUserPrivateKey(credentialsId: "mowesta-server-key", keyFileVariable: "KEYFILE")]) {
|
||||
sh 'scp -i $KEYFILE site-ear/build/libs/site-ear-' + version + '.ear wildfly@apps-pro.nes.uni-due.de:/opt/wildfly-21-mowesta/standalone/deployments/mowesta.ear'
|
||||
// sh 'scp -i $KEYFILE site-ear/build/libs/site-ear-' + version + '.ear wildfly@apps-pro.nes.uni-due.de:/opt/wildfly-21-mowesta/standalone/deployments/mowesta.ear'
|
||||
sh 'scp -i $KEYFILE android-app/build/outputs/apk/prod/release/*.apk wildfly@apps-pro.nes.uni-due.de:/opt/android/mowesta/'
|
||||
}
|
||||
} else if (env.BRANCH_NAME == "master" || env.BRANCH_NAME == "feat/auth") {
|
||||
|
||||
+30
-18
@@ -4,32 +4,42 @@ apply plugin: 'com.google.android.gms.oss-licenses-plugin'
|
||||
|
||||
description = "Mowesta Android App"
|
||||
|
||||
|
||||
ext {
|
||||
// android app dependencies
|
||||
versionPlay = '17.0.0'
|
||||
versionAndroidXCore = '1.2.0'
|
||||
versionAndroidXCore = '1.3.1'
|
||||
versionAndroidXCoreTest = '2.1.0'
|
||||
versionAndroidXRecycler = '1.1.0'
|
||||
versionAndroidXRecycler = '1.2.1'
|
||||
versionAndroidXPaging = '2.1.2'
|
||||
versionAndroidXCard = '1.0.0'
|
||||
versionAndroidXCoordinator = '1.1.0'
|
||||
versionAndroidXConstraint = '2.0.4'
|
||||
versionAndroidXNavigation = '2.3.2'
|
||||
versionAndroidXLifecycle = '2.2.0'
|
||||
versionAndroidXConstraint = '2.1.0'
|
||||
versionAndroidXNavigation = '2.3.5'
|
||||
versionAndroidXLifecycle = '2.3.1'
|
||||
versionAndroidXSecurity = '1.1.0-alpha03'
|
||||
versionAndroidXViewpager = '1.0.0'
|
||||
versionGoogleMaterial = '1.2.1'
|
||||
versionGoogleMaterial = '1.4.0'
|
||||
versionAndroidXSwipeRefresh = '1.1.0'
|
||||
versionExoPlayer = '2.11.5'
|
||||
versionAndroidXWebkit = '1.4.0'
|
||||
versionExoPlayer = '2.14.2'
|
||||
versionApp = project.version
|
||||
}
|
||||
|
||||
// remove project version to workaround bugs in
|
||||
// oss-license-plugin that detects local libraries
|
||||
// by checking for a version called "unspecified"
|
||||
// see DependencyTask.groovy on GitHub at
|
||||
// https://github.com/google/play-services-plugins
|
||||
project.version = "unspecified"
|
||||
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation project(":android-sdk")
|
||||
|
||||
implementation "javax.xml.bind:jaxb-api:${versionJaxb}"
|
||||
|
||||
implementation "androidx.appcompat:appcompat:${versionAndroidXAppcompat}"
|
||||
|
||||
implementation "com.google.android.material:material:${versionGoogleMaterial}"
|
||||
@@ -51,6 +61,7 @@ dependencies {
|
||||
implementation "androidx.lifecycle:lifecycle-service:${versionAndroidXLifecycle}"
|
||||
implementation "androidx.lifecycle:lifecycle-process:${versionAndroidXLifecycle}"
|
||||
|
||||
implementation "androidx.webkit:webkit:${versionAndroidXWebkit}"
|
||||
|
||||
implementation "com.google.android.exoplayer:exoplayer-core:${versionExoPlayer}"
|
||||
implementation "com.google.android.exoplayer:exoplayer-ui:${versionExoPlayer}"
|
||||
@@ -84,13 +95,13 @@ configurations {
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
defaultConfig {
|
||||
applicationId "com.mowesta.android.app"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
versionCode 16
|
||||
versionName "${version}"
|
||||
targetSdkVersion 30
|
||||
versionCode 20
|
||||
versionName "${versionApp}"
|
||||
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue "string", "application_long", "MoWeSta"
|
||||
@@ -98,6 +109,11 @@ android {
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
}
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments += ["room.schemaLocation": "${projectDir}/src/main/sql/".toString()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@@ -128,7 +144,7 @@ android {
|
||||
dimension "backend"
|
||||
applicationIdSuffix ".beta"
|
||||
resValue "string", "mowesta_url_default", "https://beta.mowesta.com/api"
|
||||
resValue "string", "application_long", "MoWeSta Beta"
|
||||
resValue "string", "application_long", "B-MoWeSta"
|
||||
}
|
||||
prod {
|
||||
dimension "backend"
|
||||
@@ -154,16 +170,12 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
javaMaxHeapSize "512m"
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// enable unchecked and deprecation warning during compilation
|
||||
gradle.projectsEvaluated {
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<receiver android:name=".MowestaReceiver">
|
||||
<receiver android:name=".MowestaReceiver" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
@@ -62,6 +62,7 @@
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".widget.ForecastWidgetProvider"
|
||||
android:exported="true"
|
||||
android:label="@string/widget_forecast_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
@@ -70,6 +71,7 @@
|
||||
android:resource="@xml/widget_forecast" />
|
||||
</receiver>
|
||||
<receiver
|
||||
android:exported="true"
|
||||
android:name=".widget.MeasureWidgetProvider"
|
||||
android:label="@string/widget_measure_name">
|
||||
<intent-filter>
|
||||
|
||||
Binary file not shown.
@@ -1,10 +1,15 @@
|
||||
package com.mowesta.android.app;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.net.http.HttpResponseCache;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
@@ -14,8 +19,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.app.repository.UserCredentials;
|
||||
@@ -24,6 +33,8 @@ import com.mowesta.android.app.task.RefreshTask;
|
||||
import com.mowesta.android.app.task.SyncTask;
|
||||
import com.mowesta.android.app.util.PermissionUtil;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.sdk.SdkRepository;
|
||||
import com.mowesta.android.sdk.task.ClearTask;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -48,9 +59,15 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
private static final int DELAY_REFRESH = 15 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* The code used to request the permissions.
|
||||
* The code used to request the permission for localizing in the foreground.
|
||||
*/
|
||||
private static final int CODE_REQUEST_PERMISSIONS = 3334;
|
||||
public static final int CODE_REQUEST_FOREGROUND_PERMISSIONS = 3334;
|
||||
|
||||
/**
|
||||
* The code used to request the permission for localizing in the background.
|
||||
*/
|
||||
private static final int CODE_REQUEST_BACKGROUND_PERMISSIONS = 3335;
|
||||
|
||||
|
||||
/**
|
||||
* The preferences.
|
||||
@@ -104,6 +121,10 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
}
|
||||
};
|
||||
|
||||
public MowestaActivity() {
|
||||
super(R.layout.activity_app);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -111,22 +132,37 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
app = (IApp) getApplication();
|
||||
favoriteTask.execute(null, app.getFavoriteRepository().getDatabase());
|
||||
settings = app.getSettings();
|
||||
setContentView(R.layout.activity_app);
|
||||
installHttpCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
// got to navigation drawer when user presses notification
|
||||
setIntent(intent);
|
||||
Navigation.findNavController(this, R.id.navigation_app).navigate(R.id.action_drawer);
|
||||
|
||||
}
|
||||
|
||||
// got to navigation drawer when user presses notification
|
||||
private void handleNotificationIntent() {
|
||||
Intent intent = getIntent();
|
||||
if (intent.hasExtra(getString(R.string.mowesta_sdk_notification_activity_extra_name))) {
|
||||
String value = intent.getStringExtra(getString(R.string.mowesta_sdk_notification_activity_extra_name));
|
||||
if (value != null && value.equals(getString(R.string.mowesta_sdk_notification_activity_extra_value))) {
|
||||
NavController controller = Navigation.findNavController(this, R.id.navigation_app);
|
||||
if (controller.getGraph().getId() == R.id.navigation_core) {
|
||||
controller.navigate(R.id.action_drawer);
|
||||
} else {
|
||||
controller.navigate(R.id.action_core);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
settings.getPreferences().registerOnSharedPreferenceChangeListener(preferenceListener);
|
||||
handleNotificationIntent();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,16 +207,11 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
*/
|
||||
public void requestPermissions() {
|
||||
Log.d(TAG, "Requesting permissions.");
|
||||
requestPermissions(PermissionUtil.getNonGrantedBackgroundPermissions(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests the permissions.
|
||||
*
|
||||
* @param permissions The permissions to request.
|
||||
*/
|
||||
public void requestPermissions(String[] permissions) {
|
||||
ActivityCompat.requestPermissions(this, permissions, CODE_REQUEST_PERMISSIONS);
|
||||
if (!PermissionUtil.hasPermissions(this, PermissionUtil.getForegroundPermissions(this))) {
|
||||
ActivityCompat.requestPermissions(this, PermissionUtil.getForegroundPermissions(this), CODE_REQUEST_BACKGROUND_PERMISSIONS);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
|
||||
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.ACCESS_BACKGROUND_LOCATION }, CODE_REQUEST_BACKGROUND_PERMISSIONS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,8 +223,10 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
*/
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
switch (requestCode) {
|
||||
case CODE_REQUEST_PERMISSIONS: {
|
||||
case CODE_REQUEST_BACKGROUND_PERMISSIONS:
|
||||
case CODE_REQUEST_FOREGROUND_PERMISSIONS: {
|
||||
boolean granted = true;
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (int i = 0, s = Math.min(permissions.length, grantResults.length); i < s; i++) {
|
||||
@@ -204,9 +237,10 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
Log.d(TAG, "Permission result: " + b.toString());
|
||||
if (!granted) {
|
||||
settings.setPrivacyMeasure(false);
|
||||
showMissingPermission();
|
||||
} else {
|
||||
MowestaService.startService(this);
|
||||
showMissingPermission(requestCode == CODE_REQUEST_FOREGROUND_PERMISSIONS);
|
||||
} else if (requestCode == CODE_REQUEST_BACKGROUND_PERMISSIONS){
|
||||
if (!PermissionUtil.hasBackgroundPermissions(this)) requestPermissions();
|
||||
else MowestaService.startService(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -218,22 +252,61 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
/**
|
||||
* Shows a snackbar indicating a missing permission.
|
||||
*/
|
||||
public void showMissingPermission() {
|
||||
View coordinator = findViewById(R.id.layout_coordinator);
|
||||
Snackbar.make(coordinator, R.string.message_no_permission, Snackbar.LENGTH_LONG )
|
||||
.setAction(R.string.button_configure, (view) -> {
|
||||
// go to app settings
|
||||
public void showMissingPermission(boolean foreground) {
|
||||
PermissionDialogFragment pdf = PermissionDialogFragment.newInstance(foreground);
|
||||
pdf.show(getSupportFragmentManager(), "permissions");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A dialog fragment to explain the need for permissions.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public static class PermissionDialogFragment extends DialogFragment {
|
||||
|
||||
private static final String KEY_FOREGROUND = "foreground";
|
||||
|
||||
public static PermissionDialogFragment newInstance(boolean foreground) {
|
||||
PermissionDialogFragment f = new PermissionDialogFragment();
|
||||
Bundle b = new Bundle();
|
||||
b.putBoolean(KEY_FOREGROUND, foreground);
|
||||
f.setArguments(b);
|
||||
return f;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
MaterialAlertDialogBuilder b = new MaterialAlertDialogBuilder(getActivity());
|
||||
b.setTitle(R.string.message_permission_title);
|
||||
b.setMessage(isForeground()?R.string.message_permission_foreground:R.string.message_permission_background);
|
||||
b.setIcon(R.drawable.ic_gps_off_normal_24);
|
||||
b.setNeutralButton(R.string.button_configure, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
Uri uri = Uri.fromParts("package", getPackageName(), null);
|
||||
Uri uri = Uri.fromParts("package", getActivity().getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
View coordinator = getActivity().findViewById(R.id.layout_coordinator);
|
||||
Snackbar.make(coordinator, R.string.message_configure_failed,
|
||||
Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
return b.show();
|
||||
}
|
||||
|
||||
private boolean isForeground() {
|
||||
Bundle b = getArguments();
|
||||
return b.getBoolean(KEY_FOREGROUND, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import com.mowesta.android.app.repository.DeviceRepository;
|
||||
import com.mowesta.android.app.repository.FavoriteRepository;
|
||||
import com.mowesta.android.app.repository.UserRepository;
|
||||
import com.mowesta.android.app.repository.WidgetRepository;
|
||||
import com.mowesta.android.app.widget.AbstractWidgetProvider;
|
||||
import com.mowesta.android.app.widget.ForecastWidgetProvider;
|
||||
import com.mowesta.android.app.widget.MeasureWidgetProvider;
|
||||
import com.mowesta.android.app.widget.WidgetReceiver;
|
||||
|
||||
import java.io.File;
|
||||
@@ -31,6 +34,13 @@ import java.io.File;
|
||||
*/
|
||||
public class MowestaApp extends Application implements IApp {
|
||||
|
||||
/**
|
||||
* The widget providers of the app.
|
||||
*/
|
||||
private AbstractWidgetProvider[] widgetProviders = {
|
||||
new ForecastWidgetProvider(),
|
||||
new MeasureWidgetProvider()
|
||||
};
|
||||
|
||||
/**
|
||||
* The user repository.
|
||||
@@ -81,7 +91,9 @@ public class MowestaApp extends Application implements IApp {
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
WidgetReceiver.updateWidgets(this);
|
||||
for (int i = widgetProviders.length - 1; i >= 0; i--) {
|
||||
widgetProviders[i].triggerUpdates(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mowesta.android.app.arduino;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -48,7 +49,7 @@ public abstract class NetworkTask {
|
||||
/**
|
||||
* A handler to register the timeout.
|
||||
*/
|
||||
protected @NonNull Handler handler = new Handler();
|
||||
protected @NonNull Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,20 +4,20 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.net.DhcpInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class TransferTask {
|
||||
/**
|
||||
* The handler to post the result.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates a new task.
|
||||
@@ -110,7 +110,7 @@ public class TransferTask {
|
||||
*/
|
||||
public void execute() {
|
||||
WifiManager manager = (WifiManager)application.getSystemService(Context.WIFI_SERVICE);
|
||||
AsyncTask.SERIAL_EXECUTOR.execute(() -> {
|
||||
AbstractTask.SERIAL_EXECUTOR.execute(() -> {
|
||||
try {
|
||||
// sleep for a couple of seconds, since it
|
||||
// will take some time to get an ip address
|
||||
|
||||
@@ -119,6 +119,12 @@ public class Widget {
|
||||
@ColumnInfo(name = "si")
|
||||
private boolean si;
|
||||
|
||||
/**
|
||||
* The color of the widget text.
|
||||
*/
|
||||
@ColumnInfo(name = "color")
|
||||
private int color;
|
||||
|
||||
/**
|
||||
* Returns the widget type.
|
||||
*
|
||||
@@ -370,4 +376,22 @@ public class Widget {
|
||||
public void setSi(boolean si) {
|
||||
this.si = si;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text color.
|
||||
*
|
||||
* @return The text color.
|
||||
*/
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text color.
|
||||
*
|
||||
* @param color The text color.
|
||||
*/
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,62 @@
|
||||
package com.mowesta.android.app.database;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.room.AutoMigration;
|
||||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.migration.Migration;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The database to store the widget information.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@Database(entities = { Widget.class }, version = 3, exportSchema = false)
|
||||
@Database(entities = { Widget.class }, version = 4, exportSchema = true)
|
||||
|
||||
public abstract class WidgetDatabase extends RoomDatabase {
|
||||
|
||||
/**
|
||||
* Adds a non-null color column to the widget entry. This requires
|
||||
* us to copy the data, since sql lite cannot dynamically add or
|
||||
* remove constraints.
|
||||
*/
|
||||
private static final Migration MIGRATION_3_4 = new Migration(3, 4) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
database.execSQL("DROP INDEX IF EXISTS `index_widget_type_ref`");
|
||||
database.execSQL("ALTER TABLE `widget` ADD COLUMN `color` INTEGER");
|
||||
database.execSQL("UPDATE `widget` SET `color` = ?", new Object[] { Color.rgb(255, 255, 255) } );
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS `new_widget` (`type` INTEGER NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `ref` INTEGER NOT NULL, `dataId` INTEGER NOT NULL, `dataTime` INTEGER NOT NULL, `dataValue` TEXT, `contentTime` INTEGER NOT NULL, `contentValue` TEXT, `celsius` INTEGER NOT NULL, `si` INTEGER NOT NULL, `color` INTEGER NOT NULL)");
|
||||
database.execSQL("INSERT INTO `new_widget` SELECT * FROM `widget`");
|
||||
database.execSQL("DROP TABLE `widget`");
|
||||
database.execSQL("ALTER TABLE `new_widget` RENAME TO `widget`");
|
||||
database.execSQL("CREATE INDEX IF NOT EXISTS `index_widget_type_ref` ON `widget` (`type`, `ref`)");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an array with all migrations.
|
||||
*
|
||||
* @return The array with migrations.
|
||||
*/
|
||||
public static Migration[] getMigrations() {
|
||||
return new Migration[] {
|
||||
MIGRATION_3_4
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the widget accessor.
|
||||
*
|
||||
* @return The widget accessor.
|
||||
*/
|
||||
public abstract WidgetAccessor getAccessor();
|
||||
|
||||
|
||||
}
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.databinding.DialogAdvertiseBinding;
|
||||
import com.mowesta.android.app.model.AdvertiseViewModel;
|
||||
|
||||
public class AdvertiseDialogFragment extends BottomSheetDialogFragment {
|
||||
|
||||
public static final String KEY_ADVERTISEMENT = "advertisement";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
BottomSheetDialog d = (BottomSheetDialog) dialog;
|
||||
FrameLayout bottomSheet = (FrameLayout) d.findViewById(com.google.android.material.R.id.design_bottom_sheet);
|
||||
BottomSheetBehavior.from(bottomSheet).setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
});
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
DialogAdvertiseBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_advertise, container, false);
|
||||
AdvertiseViewModel model = new ViewModelProvider(this).get(AdvertiseViewModel.class);
|
||||
binding.setModel(model);
|
||||
binding.setLifecycleOwner(getViewLifecycleOwner());
|
||||
binding.videoView.setPlayer(model.getExoPlayer());
|
||||
model.getClose().observe(getViewLifecycleOwner(), (v) -> { if (v) this.dismiss(); } );
|
||||
model.getOpen().observe(getViewLifecycleOwner(), (v) -> {
|
||||
if (v) {
|
||||
String url = "https://www.mowesta.com/2021/08/21/fair-experiment-bei-den-schlosslichtspielen-in-karlsruhe/";
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(url));
|
||||
try {
|
||||
startActivity(i);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Snackbar.make(getView(), R.string.message_no_browser, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
model.getOpen().setValue(Boolean.FALSE);
|
||||
}
|
||||
});
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
public boolean shouldShow(Context context) {
|
||||
long time = System.currentTimeMillis();
|
||||
if (time > 1633298400000l) return false;
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
long last = prefs.getLong(KEY_ADVERTISEMENT, 0);
|
||||
return (time - last > 7 * 24* 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
Context context = getActivity();
|
||||
if (context != null) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences.Editor e = prefs.edit();
|
||||
e.putLong(KEY_ADVERTISEMENT, System.currentTimeMillis());
|
||||
e.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -2,6 +2,7 @@ package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -53,7 +54,6 @@ public class CityForecastFragment extends CityFragment.ChildFragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
ViewPager2 pager = view.findViewById(R.id.pager);
|
||||
CityViewModel model = getCityViewModel();
|
||||
pager.setAdapter(new ForecastAdapter(this));
|
||||
model.getNavigation().observe(getViewLifecycleOwner(), (request) -> {
|
||||
if (request != null) {
|
||||
switch (request.getType()) {
|
||||
@@ -69,7 +69,8 @@ public class CityForecastFragment extends CityFragment.ChildFragment {
|
||||
}
|
||||
}
|
||||
});
|
||||
TabLayout tabs = getActivity().findViewById(R.id.tabs);
|
||||
pager.setAdapter(new ForecastAdapter(this));
|
||||
TabLayout tabs = view.findViewById(R.id.tabs);
|
||||
new TabLayoutMediator(tabs, pager, (tab, position) -> {
|
||||
switch (position) {
|
||||
case 0:
|
||||
@@ -88,6 +89,7 @@ public class CityForecastFragment extends CityFragment.ChildFragment {
|
||||
}).attach();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The adapter for the pager that displays the different time granularities.
|
||||
*
|
||||
@@ -130,7 +132,7 @@ public class CityForecastFragment extends CityFragment.ChildFragment {
|
||||
public static class ForecastRecyclerFragment extends CityFragment.ChildFragment {
|
||||
|
||||
/** A handler to post updates. */
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -67,7 +68,7 @@ public class CityGradientFragment extends CityFragment.ChildFragment {
|
||||
/**
|
||||
* The handler to post the removal of
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* The animator for the progress bar.
|
||||
|
||||
@@ -90,8 +90,8 @@ public class CityInfoFragment extends CityFragment.ChildFragment {
|
||||
appController.navigate(R.id.destination_station, bundle, opts.build());
|
||||
}
|
||||
});
|
||||
NavController cityController = Navigation.findNavController(getActivity(), R.id.navigation_city);
|
||||
binding.setConditionListener(m -> {
|
||||
NavController cityController = Navigation.findNavController(getActivity(), R.id.navigation_city);
|
||||
cityController.navigate(R.id.destination_city_forecast);
|
||||
});
|
||||
binding.setLifecycleOwner(getViewLifecycleOwner());
|
||||
|
||||
@@ -36,6 +36,11 @@ import java.util.List;
|
||||
*/
|
||||
public class CityVideoFragment extends CityFragment.ChildFragment {
|
||||
|
||||
/**
|
||||
* The mediator to update the tabs.
|
||||
*/
|
||||
private TabLayoutMediator mediator;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -49,32 +54,40 @@ public class CityVideoFragment extends CityFragment.ChildFragment {
|
||||
TabLayout tabs = view.findViewById(R.id.tabs);
|
||||
List<Integer> pages = new ArrayList<>();
|
||||
CityViewModel model = getCityViewModel();
|
||||
pager.setAdapter(new VideoAdpter(this, pages));
|
||||
updateMediator(tabs, pager, pages);
|
||||
Observer<List<VideoViewModel>> videoObserver = (v) -> {
|
||||
pages.clear();
|
||||
if (model.getIconGlobal().getValue().size() > 0) pages.add(0, 0);
|
||||
if (model.getIconEurope().getValue().size() > 0) pages.add(0, 1);
|
||||
if (model.getCosmoEurope().getValue().size() > 0) pages.add(0, 2);
|
||||
pager.setAdapter(new VideoAdpter(this, pages));
|
||||
new TabLayoutMediator(tabs, pager, (tab, position) -> {
|
||||
int page = pages.get(position);
|
||||
switch (page) {
|
||||
case 0:
|
||||
tab.setText(R.string.video_source_icon_global);
|
||||
break;
|
||||
case 1:
|
||||
tab.setText(R.string.video_source_icon_europe);
|
||||
break;
|
||||
default:
|
||||
tab.setText(R.string.video_source_cosmo_europe);
|
||||
break;
|
||||
}
|
||||
}).attach();
|
||||
updateMediator(tabs, pager, pages);
|
||||
};
|
||||
model.getCosmoEurope().observe(getViewLifecycleOwner(), videoObserver);
|
||||
model.getIconEurope().observe(getViewLifecycleOwner(), videoObserver);
|
||||
model.getIconGlobal().observe(getViewLifecycleOwner(), videoObserver);
|
||||
}
|
||||
|
||||
private void updateMediator(TabLayout tabs, ViewPager2 pager, List<Integer> pages) {
|
||||
if (mediator != null && mediator.isAttached()) mediator.detach();
|
||||
mediator = new TabLayoutMediator(tabs, pager, (tab, position) -> {
|
||||
int page = pages.get(position);
|
||||
switch (page) {
|
||||
case 0:
|
||||
tab.setText(R.string.video_source_icon_global);
|
||||
break;
|
||||
case 1:
|
||||
tab.setText(R.string.video_source_icon_europe);
|
||||
break;
|
||||
default:
|
||||
tab.setText(R.string.video_source_cosmo_europe);
|
||||
break;
|
||||
}
|
||||
});
|
||||
mediator.attach();
|
||||
}
|
||||
|
||||
/**
|
||||
* The adapter for the pager that displays the different videos.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.databinding.DialogColorBinding;
|
||||
import com.mowesta.android.app.model.ColorViewModel;
|
||||
|
||||
/**
|
||||
* A dialog fragment to display a color picker. The fragment uses the parent's color view model
|
||||
* to communicate with the caller.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class ColorDialogFragment extends DialogFragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
ColorViewModel model = new ViewModelProvider(getParentFragment()).get(ColorViewModel.class);
|
||||
DialogColorBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_color, container, false);
|
||||
binding.setModel(model);
|
||||
binding.setLifecycleOwner(getViewLifecycleOwner());
|
||||
View view = inflater.inflate(R.layout.dialog_color, null);
|
||||
binding.colorSliderRed.setValue(model.getRed().getValue());
|
||||
binding.colorSliderGreen.setValue(model.getGreen().getValue());
|
||||
binding.colorSliderBlue.setValue(model.getBlue().getValue());
|
||||
binding.colorSliderRed.addOnChangeListener((slider, value, fromUser) -> {
|
||||
if (fromUser) model.getRed().setValue(value);
|
||||
});
|
||||
binding.colorSliderGreen.addOnChangeListener((slider, value, fromUser) -> {
|
||||
if (fromUser) model.getGreen().setValue(value);
|
||||
});
|
||||
binding.colorSliderBlue.addOnChangeListener((slider, value, fromUser) -> {
|
||||
if (fromUser) model.getBlue().setValue(value);
|
||||
});
|
||||
model.getColor().observe(getViewLifecycleOwner(), (color) -> {
|
||||
binding.colorResultText.setTextColor(color);
|
||||
binding.colorResultImage.setColorFilter(color);
|
||||
});
|
||||
binding.buttonOk.setOnClickListener((v) -> {
|
||||
model.setState(ColorViewModel.State.CONFIRMED);
|
||||
dismiss();
|
||||
});
|
||||
binding.buttonCancel.setOnClickListener((v) -> {
|
||||
model.setState(ColorViewModel.State.DISMISSED);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(@NonNull DialogInterface dialog) {
|
||||
ColorViewModel model = new ViewModelProvider(getParentFragment()).get(ColorViewModel.class);
|
||||
model.setState(ColorViewModel.State.DISMISSED);
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -176,7 +177,7 @@ public class ConnectFragment extends Fragment {
|
||||
/**
|
||||
* The handler to post events asynchronously.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,8 @@ import android.database.AbstractCursor;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -85,17 +87,21 @@ public class DrawerFragment extends AbstractNetworkFragment {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
preventSplashScreen();
|
||||
handleNotificationIntent();
|
||||
if (!preventSplashScreen()) {
|
||||
handleNotificationIntent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent going back to the splash screen if opened through deep link.
|
||||
*/
|
||||
private void preventSplashScreen() {
|
||||
private boolean preventSplashScreen() {
|
||||
NavController nav = Navigation.findNavController(getActivity().findViewById(R.id.navigation_app));
|
||||
if (nav.getGraph().getId() != R.id.navigation_core) {
|
||||
nav.setGraph(R.navigation.navigation_core);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +114,8 @@ public class DrawerFragment extends AbstractNetworkFragment {
|
||||
if (intent.hasExtra(getString(R.string.mowesta_sdk_notification_activity_extra_name))) {
|
||||
String value = intent.getStringExtra(getString(R.string.mowesta_sdk_notification_activity_extra_name));
|
||||
if (value != null && value.equals(getString(R.string.mowesta_sdk_notification_activity_extra_value))) {
|
||||
Navigation.findNavController(getView().findViewById(R.id.navigation_drawer)).navigate(R.id.destination_settings);
|
||||
getActivity().setIntent(new Intent());
|
||||
Navigation.findNavController(getView().findViewById(R.id.navigation_drawer)).navigate(R.id.destination_settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ public class FavoritesFragment extends Fragment {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
// possibly show the ad for schlosslichtspiele
|
||||
AdvertiseDialogFragment adf = new AdvertiseDialogFragment();
|
||||
if (adf.shouldShow(getContext())) {
|
||||
adf.show(getChildFragmentManager(), "ad");
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -95,8 +100,8 @@ public class FavoritesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
|
||||
int fromPosition = viewHolder.getAdapterPosition();
|
||||
int toPosition = target.getAdapterPosition();
|
||||
int fromPosition = viewHolder.getBindingAdapterPosition();
|
||||
int toPosition = target.getBindingAdapterPosition();
|
||||
this.target = toPosition;
|
||||
recyclerView.getAdapter().notifyItemMoved(fromPosition, toPosition);
|
||||
return false;
|
||||
@@ -122,7 +127,7 @@ public class FavoritesFragment extends Fragment {
|
||||
favorites = null;
|
||||
} else if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) {
|
||||
favorites = model.getFavorites().getValue();
|
||||
selection = viewHolder.getAdapterPosition();
|
||||
selection = viewHolder.getBindingAdapterPosition();
|
||||
target = -1;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-3
@@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.renderscript.ScriptGroup;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -23,6 +24,7 @@ import com.mowesta.android.app.database.Widget;
|
||||
import com.mowesta.android.app.database.WidgetDatabase;
|
||||
import com.mowesta.android.app.databinding.FragmentForecastWidgetBinding;
|
||||
import com.mowesta.android.app.model.AbstractNetworkViewModel;
|
||||
import com.mowesta.android.app.model.ColorViewModel;
|
||||
import com.mowesta.android.app.model.ForecastWidgetViewModel;
|
||||
import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.app.widget.ForecastWidgetProvider;
|
||||
@@ -83,6 +85,9 @@ public class ForecastWidgetFragment extends AbstractNetworkFragment {
|
||||
ForecastWidgetViewModel model = new ViewModelProvider(this).get(ForecastWidgetViewModel.class);
|
||||
binding.setLifecycleOwner(getViewLifecycleOwner());
|
||||
binding.setModel(model);
|
||||
model.getColor().observe(getViewLifecycleOwner(), (color) -> {
|
||||
binding.buttonColor.setColorFilter(color);
|
||||
});
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -90,6 +95,12 @@ public class ForecastWidgetFragment extends AbstractNetworkFragment {
|
||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
ForecastWidgetViewModel model = new ViewModelProvider(this).get(ForecastWidgetViewModel.class);
|
||||
ColorViewModel color = new ViewModelProvider(this).get(ColorViewModel.class);
|
||||
color.getState().observe(getViewLifecycleOwner(), state -> {
|
||||
if (state == ColorViewModel.State.CONFIRMED) {
|
||||
model.getColor().setValue(color.getColor().getValue());
|
||||
}
|
||||
});
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler);
|
||||
recyclerView.setAdapter(new CityEntryListAdapter(
|
||||
getViewLifecycleOwner(),
|
||||
@@ -97,7 +108,16 @@ public class ForecastWidgetFragment extends AbstractNetworkFragment {
|
||||
model.getCities(),
|
||||
model.getSelection()));
|
||||
model.getFinished().observe(getViewLifecycleOwner(), (c) -> {
|
||||
if (c != null) finish(c, model.getCelsius().getValue());
|
||||
if (c != null) finish(c, model.getCelsius().getValue(), model.getColor().getValue());
|
||||
});
|
||||
model.getDialog().observe(getViewLifecycleOwner(), (d) -> {
|
||||
if (d) {
|
||||
color.setColor(model.getColor().getValue());
|
||||
color.setState(ColorViewModel.State.VISIBLE);
|
||||
ColorDialogFragment cdf = new ColorDialogFragment();
|
||||
cdf.show(getChildFragmentManager(), "color");
|
||||
model.getDialog().setValue(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,9 +125,10 @@ public class ForecastWidgetFragment extends AbstractNetworkFragment {
|
||||
* Finishes the the configuration and stores the widget configuration in the database.
|
||||
*
|
||||
* @param city The city.
|
||||
* @param color The color.
|
||||
* @param celsius A flag to indicate whether the widget uses celsius or fahrenheit.
|
||||
*/
|
||||
public void finish(City city, boolean celsius) {
|
||||
public void finish(City city, boolean celsius, int color) {
|
||||
Activity activity = getActivity();
|
||||
Context app = activity.getApplicationContext();
|
||||
DatabaseTask<WidgetDatabase, Integer, Widget> task = new DatabaseTask<>((input, database)-> {
|
||||
@@ -119,11 +140,12 @@ public class ForecastWidgetFragment extends AbstractNetworkFragment {
|
||||
w.setDataId(city.getId());
|
||||
w.setData(city);
|
||||
w.setDataTime(now);
|
||||
w.setColor(color);
|
||||
database.getAccessor().add(w);
|
||||
return w;
|
||||
}, (input, result) -> {
|
||||
ForecastWidgetProvider provider = new ForecastWidgetProvider();
|
||||
provider.triggerUpdate(app, input);
|
||||
provider.triggerUpdate(app, input, true);
|
||||
if (!activity.isDestroyed()) {
|
||||
activity.finish();
|
||||
}
|
||||
|
||||
+24
-3
@@ -30,6 +30,7 @@ import com.mowesta.android.app.database.Widget;
|
||||
import com.mowesta.android.app.database.WidgetDatabase;
|
||||
import com.mowesta.android.app.databinding.FragmentMeasureWidgetBinding;
|
||||
import com.mowesta.android.app.model.AbstractNetworkViewModel;
|
||||
import com.mowesta.android.app.model.ColorViewModel;
|
||||
import com.mowesta.android.app.model.MeasureWidgetViewModel;
|
||||
import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.app.widget.MeasureWidgetProvider;
|
||||
@@ -108,6 +109,9 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
binding.customizeTemperature.setOnItemClickListener((parent, view, position, id) -> {
|
||||
model.getCelsius().setValue(position == 0);
|
||||
});
|
||||
model.getColor().observe(getViewLifecycleOwner(), (color) -> {
|
||||
binding.buttonColor.setColorFilter(color);
|
||||
});
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -115,6 +119,12 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
MeasureWidgetViewModel model = new ViewModelProvider(this).get(MeasureWidgetViewModel.class);
|
||||
ColorViewModel color = new ViewModelProvider(this).get(ColorViewModel.class);
|
||||
color.getState().observe(getViewLifecycleOwner(), state -> {
|
||||
if (state == ColorViewModel.State.CONFIRMED) {
|
||||
model.getColor().setValue(color.getColor().getValue());
|
||||
}
|
||||
});
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler);
|
||||
DeviceEntryPagedListAdapter adapter = new DeviceEntryPagedListAdapter(getViewLifecycleOwner(), (device) -> {
|
||||
model.getSelection().setValue(device);
|
||||
@@ -129,7 +139,7 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
recyclerView.setAdapter(adapter);
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> model.reload());
|
||||
model.getFinished().observe(getViewLifecycleOwner(), (c) -> {
|
||||
if (c != null) finish(c, model.getCelsius().getValue(), model.getSi().getValue());
|
||||
if (c != null) finish(c, model.getCelsius().getValue(), model.getSi().getValue(), model.getColor().getValue());
|
||||
});
|
||||
model.getLogin().observe(getViewLifecycleOwner(), (v) -> {
|
||||
if (v) {
|
||||
@@ -137,6 +147,15 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
model.getDialog().observe(getViewLifecycleOwner(), (d) -> {
|
||||
if (d) {
|
||||
color.setColor(model.getColor().getValue());
|
||||
color.setState(ColorViewModel.State.VISIBLE);
|
||||
ColorDialogFragment cdf = new ColorDialogFragment();
|
||||
cdf.show(getChildFragmentManager(), "color");
|
||||
model.getDialog().setValue(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,9 +197,10 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
*
|
||||
* @param device The device.
|
||||
* @param celsius A flag to indicate whether the widget uses celsius or fahrenheit.
|
||||
* @param color The widget color.
|
||||
* @param si A flag to indicate which measurement unit system.
|
||||
*/
|
||||
public void finish(Device device, boolean celsius, boolean si) {
|
||||
public void finish(Device device, boolean celsius, boolean si, int color) {
|
||||
Activity activity = getActivity();
|
||||
Context app = activity.getApplicationContext();
|
||||
DatabaseTask<WidgetDatabase, Integer, Widget> task = new DatabaseTask<>((input, database)-> {
|
||||
@@ -189,6 +209,7 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
w.setReference(input);
|
||||
w.setType(Widget.TYPE_MEASURE);
|
||||
w.setCelsius(celsius);
|
||||
w.setColor(color);
|
||||
w.setSi(si);
|
||||
w.setDataId(device.getId());
|
||||
w.setData(device);
|
||||
@@ -197,7 +218,7 @@ public class MeasureWidgetFragment extends AbstractNetworkFragment {
|
||||
return w;
|
||||
}, (input, result) -> {
|
||||
MeasureWidgetProvider provider = new MeasureWidgetProvider();
|
||||
provider.triggerUpdate(app, input);
|
||||
provider.triggerUpdate(app, input, true);
|
||||
if (!activity.isDestroyed()) {
|
||||
activity.finish();
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
setClickListener(KEY_ABOUT_TERMS, new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Navigation.findNavController(getActivity(), R.id.navigation_app).navigate(R.id.destination_terms);
|
||||
Navigation.findNavController(getActivity(), R.id.navigation_app).navigate(R.id.destination_review);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -432,7 +432,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
b.setTitle(R.string.setting_privacy_reset_title);
|
||||
b.setMessage(R.string.setting_privacy_reset_message);
|
||||
b.setIcon(R.drawable.ic_delete_forever_normal_24);
|
||||
b.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
b.setPositiveButton(R.string.button_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// stop the service and its background processing
|
||||
@@ -460,7 +460,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
}).execute();
|
||||
}
|
||||
});
|
||||
b.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||
b.setNegativeButton(R.string.button_no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// nothing to be done
|
||||
|
||||
@@ -17,6 +17,7 @@ import android.view.animation.OvershootInterpolator;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
@@ -66,7 +67,7 @@ public class SetupFragment extends Fragment {
|
||||
SetupViewModel.GpsStatus status = model.registerGpsReceiver();
|
||||
switch (status) {
|
||||
case PROHIBITED:
|
||||
((MowestaActivity)getActivity()).requestPermissions(PermissionUtil.getForegroundPermissions(getActivity()));
|
||||
ActivityCompat.requestPermissions(getActivity(), PermissionUtil.getForegroundPermissions(getActivity()), MowestaActivity.CODE_REQUEST_FOREGROUND_PERMISSIONS);
|
||||
break;
|
||||
case DISABLED:
|
||||
Snackbar.make(container, R.string.setup_error_gps_disabled, Snackbar.LENGTH_LONG).setAction(R.string.button_configure, (v) -> {
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -54,7 +55,7 @@ public class SplashFragment extends Fragment {
|
||||
/**
|
||||
* The handler.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* The settings to check states.
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
@@ -33,11 +34,14 @@ import androidx.navigation.Navigation;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
import androidx.webkit.WebViewAssetLoader;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
@@ -165,7 +169,9 @@ public class TermsFragment extends Fragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
int url = getArguments().getInt("url", 0);
|
||||
webView = (WebView) view.findViewById(R.id.web_view);
|
||||
webView.getSettings().setAllowFileAccessFromFileURLs(true);
|
||||
final WebViewAssetLoader assetLoader = new WebViewAssetLoader.Builder()
|
||||
.addPathHandler("/assets/", new WebViewAssetLoader.AssetsPathHandler(view.getContext()))
|
||||
.build();
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -179,6 +185,20 @@ public class TermsFragment extends Fragment {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(21)
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view,
|
||||
WebResourceRequest request) {
|
||||
return assetLoader.shouldInterceptRequest(request.getUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation") // for API < 21
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||
return assetLoader.shouldInterceptRequest(Uri.parse(url));
|
||||
}
|
||||
|
||||
});
|
||||
if (url != 0) {
|
||||
webView.loadUrl(getResources().getString(url));
|
||||
|
||||
@@ -6,10 +6,12 @@ import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
@@ -23,14 +25,15 @@ import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.source.MediaSource;
|
||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
||||
import com.google.android.exoplayer2.upstream.cache.CacheDataSourceFactory;
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
|
||||
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
|
||||
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.mowesta.android.app.IApp;
|
||||
import com.mowesta.android.app.MowestaSettings;
|
||||
@@ -154,7 +157,7 @@ public class VideoFragment extends AbstractNetworkFragment {
|
||||
/**
|
||||
* The handler for the timing.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* The date formatter.
|
||||
@@ -272,12 +275,15 @@ public class VideoFragment extends AbstractNetworkFragment {
|
||||
model.exoPlayer = new SimpleExoPlayer.Builder(getContext()).build();
|
||||
model.scaler.setContent(video.getWidth(), video.getHeight());
|
||||
IApp app = (IApp)getActivity().getApplication();
|
||||
DataSource.Factory dataSourceFactory = new CacheDataSourceFactory
|
||||
(app.getMediaCache(), new DefaultHttpDataSourceFactory( Util.getUserAgent
|
||||
(getContext(), getContext().getPackageName()), null));
|
||||
MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.createMediaSource(Uri.parse(video.getUrl()));
|
||||
model.exoPlayer.prepare(videoSource);
|
||||
DefaultHttpDataSource.Factory hf = new DefaultHttpDataSource.Factory();
|
||||
hf.setUserAgent(Util.getUserAgent(getContext(), getContext().getPackageName()));
|
||||
CacheDataSource.Factory cdf = new CacheDataSource.Factory();
|
||||
cdf.setUpstreamDataSourceFactory(hf);
|
||||
cdf.setCache(app.getMediaCache());
|
||||
MediaSource videoSource = new ProgressiveMediaSource.Factory(cdf)
|
||||
.createMediaSource(MediaItem.fromUri(video.getUrl()));
|
||||
model.exoPlayer.setMediaSource(videoSource);
|
||||
model.exoPlayer.prepare();
|
||||
model.exoPlayer.setPlayWhenReady(true);
|
||||
model.scaleUrl = video.getScale();
|
||||
model.reload();
|
||||
@@ -311,7 +317,8 @@ public class VideoFragment extends AbstractNetworkFragment {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
Window window = getActivity().getWindow();
|
||||
if (window != null) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
if (video != null) {
|
||||
handler.postDelayed(timer, 500);
|
||||
if (model.markerX != null && model.markerY != null) {
|
||||
@@ -326,7 +333,8 @@ public class VideoFragment extends AbstractNetworkFragment {
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
Window window = getActivity().getWindow();
|
||||
if (window != null) window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
marker.removeOnLayoutChangeListener(markerListener);
|
||||
handler.removeCallbacks(timer);
|
||||
super.onPause();
|
||||
|
||||
+7
-1
@@ -1,6 +1,7 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
@@ -16,6 +17,11 @@ import com.mowesta.android.app.repository.ClientFactory;
|
||||
*/
|
||||
public abstract class AbstractNetworkViewModel extends AndroidViewModel {
|
||||
|
||||
/**
|
||||
* The log tag.
|
||||
*/
|
||||
private static final String TAG = "NetworkViewModel";
|
||||
|
||||
/**
|
||||
* A class to store a parameter together with a request code.
|
||||
*
|
||||
@@ -95,7 +101,7 @@ public abstract class AbstractNetworkViewModel extends AndroidViewModel {
|
||||
* Prints the internal state of the model.
|
||||
*/
|
||||
private void printState() {
|
||||
System.out.println(getClass().getSimpleName() + " " + requestCode + " " + error.getValue() + " " + requests.getValue());
|
||||
Log.d(TAG, getClass().getSimpleName() + " " + requestCode + " " + error.getValue() + " " + requests.getValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.source.MediaSource;
|
||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
||||
import com.google.android.exoplayer2.upstream.AssetDataSource;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
|
||||
public class AdvertiseViewModel extends AndroidViewModel {
|
||||
|
||||
private ExoPlayer exoPlayer;
|
||||
|
||||
private MutableLiveData<Boolean> close = new MutableLiveData<>(Boolean.FALSE);
|
||||
|
||||
private MutableLiveData<Boolean> open = new MutableLiveData<>(Boolean.FALSE);
|
||||
|
||||
public AdvertiseViewModel(Application app) {
|
||||
super(app);
|
||||
SimpleExoPlayer.Builder builder = new SimpleExoPlayer.Builder(app);
|
||||
exoPlayer = builder.build();
|
||||
DataSource.Factory df = new DataSource.Factory() {
|
||||
@Override
|
||||
public DataSource createDataSource() {
|
||||
return new AssetDataSource(app);
|
||||
}
|
||||
};
|
||||
MediaSource videoSource = new ProgressiveMediaSource.Factory(df)
|
||||
.createMediaSource(MediaItem.fromUri("android_assets:///schlosslichtspiele.mp4"));
|
||||
exoPlayer.setRepeatMode(ExoPlayer.REPEAT_MODE_ALL);
|
||||
exoPlayer.setMediaSource(videoSource);
|
||||
exoPlayer.prepare();
|
||||
exoPlayer.setPlayWhenReady(true);
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getClose() {
|
||||
return close;
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
close.setValue(Boolean.TRUE);
|
||||
}
|
||||
|
||||
public void open() {
|
||||
open.setValue(Boolean.TRUE);
|
||||
}
|
||||
|
||||
public ExoPlayer getExoPlayer() {
|
||||
return exoPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCleared() {
|
||||
exoPlayer.stop();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,16 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.paging.DataSource;
|
||||
import androidx.paging.LivePagedListBuilder;
|
||||
import androidx.paging.PagedList;
|
||||
import androidx.paging.PositionalDataSource;
|
||||
|
||||
import com.mowesta.android.app.IApp;
|
||||
import com.mowesta.android.app.repository.ClientFactory;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.CityPage;
|
||||
@@ -36,7 +32,7 @@ public class CitiesViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* A handler to run on the main thread.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates the view model.
|
||||
|
||||
@@ -11,8 +11,6 @@ import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.app.util.DateFormatter;
|
||||
import com.mowesta.android.app.util.TimeUtils;
|
||||
import com.mowesta.android.app.util.WeatherAggregate;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.City;
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
/**
|
||||
* The view model for the color picker dialog.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class ColorViewModel extends ViewModel {
|
||||
|
||||
/**
|
||||
* The dialog state.
|
||||
*/
|
||||
public static enum State {
|
||||
/** The dialog is hidden. */
|
||||
HIDDEN,
|
||||
/** The dialog is visible. */
|
||||
VISIBLE,
|
||||
/** The dialog is confirmed. */
|
||||
CONFIRMED,
|
||||
/** The dialog is dismissed. */
|
||||
DISMISSED
|
||||
}
|
||||
|
||||
/** The red component from 0-255 */
|
||||
private final MutableLiveData<Float> red = new MutableLiveData<>(Float.valueOf(255));
|
||||
/** The green component from 0-255 */
|
||||
private final MutableLiveData<Float> green = new MutableLiveData<>(Float.valueOf(255));
|
||||
/** The blue component from 0-255 */
|
||||
private final MutableLiveData<Float> blue = new MutableLiveData<>(Float.valueOf(255));
|
||||
/** The computed color as RGB */
|
||||
private final MutableLiveData<Integer> color = new MutableLiveData<Integer>();
|
||||
/** The dialog state. */
|
||||
private final MutableLiveData<State> state = new MutableLiveData<>(State.HIDDEN);
|
||||
|
||||
/**
|
||||
* Creates a new model.
|
||||
*/
|
||||
public ColorViewModel() {
|
||||
Observer<Float> observer = (v) -> {
|
||||
color.setValue(Color.rgb(red.getValue().intValue(), green.getValue().intValue(), blue.getValue().intValue()));
|
||||
};
|
||||
red.observeForever(observer);
|
||||
green.observeForever(observer);
|
||||
blue.observeForever(observer);
|
||||
observer.onChanged(0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns live data with the state.
|
||||
*
|
||||
* @return The live data with the state.
|
||||
*/
|
||||
public LiveData<State> getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color.
|
||||
*
|
||||
* @return The color.
|
||||
*/
|
||||
public LiveData<Integer> getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* The blue component 0-255.
|
||||
*
|
||||
* @return The blue component.
|
||||
*/
|
||||
public MutableLiveData<Float> getBlue() {
|
||||
return blue;
|
||||
}
|
||||
|
||||
/**
|
||||
* The red component 0-255.
|
||||
*
|
||||
* @return The red component.
|
||||
*/
|
||||
public MutableLiveData<Float> getRed() {
|
||||
return red;
|
||||
}
|
||||
|
||||
/**
|
||||
* The green component 0-255.
|
||||
*
|
||||
* @return The green component.
|
||||
*/
|
||||
public MutableLiveData<Float> getGreen() {
|
||||
return green;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color.
|
||||
*
|
||||
* @param rgb The rgb color.
|
||||
*/
|
||||
public void setColor(int rgb) {
|
||||
red.setValue(Float.valueOf((rgb >> 16) & 0xff));
|
||||
green.setValue(Float.valueOf((rgb >> 8) & 0xff));
|
||||
blue.setValue(Float.valueOf((rgb >> 0) & 0xff));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dialog state.
|
||||
*
|
||||
* @param state The state.
|
||||
*/
|
||||
public void setState(State state) {
|
||||
this.state.setValue(state);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.app.Application;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.Presentation;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.paging.DataSource;
|
||||
@@ -14,10 +12,8 @@ import androidx.paging.LivePagedListBuilder;
|
||||
import androidx.paging.PagedList;
|
||||
import androidx.paging.PositionalDataSource;
|
||||
|
||||
import com.mowesta.android.app.IApp;
|
||||
import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.app.repository.ClientFactory;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
@@ -25,7 +21,6 @@ import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.CityPage;
|
||||
import com.mowesta.android.feign.model.Country;
|
||||
import com.mowesta.android.feign.model.LocationReference;
|
||||
import com.mowesta.android.feign.model.State;
|
||||
|
||||
import org.geojson.Geometry;
|
||||
|
||||
@@ -61,7 +56,7 @@ public class CountryViewModel extends AbstractPlaceViewModel {
|
||||
/**
|
||||
* The handler to run on main.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* The loader for the country.
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.content.res.Resources;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.mowesta.android.app.MowestaSettings;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
@@ -59,7 +60,7 @@ public class DeviceViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* The handler to run on main.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates a new view model.
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
@@ -13,11 +14,8 @@ import androidx.paging.PositionalDataSource;
|
||||
|
||||
import com.mowesta.android.app.repository.UserCredentials;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.Device;
|
||||
import com.mowesta.android.feign.model.DevicePage;
|
||||
import com.mowesta.android.feign.model.WeatherStation;
|
||||
import com.mowesta.android.feign.model.WeatherStationPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -42,7 +40,7 @@ public class DevicesViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* The handler to debounce the updates to the search term.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates the view model.
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
@@ -15,6 +14,7 @@ import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.feign.model.LocationHierarchyPage;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class DrawerViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* A handler to debounce the search.
|
||||
*/
|
||||
final Handler handler = new Handler();
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* The task to perform the search.
|
||||
|
||||
+21
-9
@@ -1,26 +1,20 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.location.Location;
|
||||
import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.mowesta.android.app.IApp;
|
||||
import com.mowesta.android.app.MowestaSettings;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.app.model.AbstractNetworkViewModel;
|
||||
import com.mowesta.android.app.repository.ClientFactory;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.CityPage;
|
||||
import com.mowesta.android.feign.model.LocationHierarchy;
|
||||
import com.mowesta.android.feign.model.LocationHierarchyPage;
|
||||
import com.mowesta.android.feign.model.LocationReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -43,7 +37,7 @@ public class ForecastWidgetViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* A handler to post updates.
|
||||
*/
|
||||
private final Handler handler = new Handler();
|
||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/** A flag to indicate whether the submit button can be pressed. */
|
||||
private final MutableLiveData<Boolean> valid = new MutableLiveData<>(Boolean.FALSE);
|
||||
@@ -63,6 +57,12 @@ public class ForecastWidgetViewModel extends AbstractNetworkViewModel {
|
||||
/** A boolean to indicate the temperature scale. */
|
||||
private final MutableLiveData<Boolean> celsius = new MutableLiveData<>(Boolean.TRUE);
|
||||
|
||||
/** The color for the widget. */
|
||||
private final MutableLiveData<Integer> color = new MutableLiveData<>(Color.rgb(255, 255, 255));
|
||||
|
||||
/** A boolean to indicate that the dialog should be opened. */
|
||||
private final MutableLiveData<Boolean> dialog = new MutableLiveData<>(Boolean.FALSE);
|
||||
|
||||
/** The favorites of the user that are displayed, if there is no search term. */
|
||||
private final MutableLiveData<List<City>> favorites = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
@@ -157,6 +157,14 @@ public class ForecastWidgetViewModel extends AbstractNetworkViewModel {
|
||||
return selection;
|
||||
}
|
||||
|
||||
public MutableLiveData<Integer> getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public MutableLiveData<Boolean> getDialog() {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setCelsius(boolean value) {
|
||||
this.celsius.setValue(value);
|
||||
}
|
||||
@@ -168,6 +176,10 @@ public class ForecastWidgetViewModel extends AbstractNetworkViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void onColor() {
|
||||
dialog.setValue(Boolean.TRUE);
|
||||
}
|
||||
|
||||
private static CityPage emptyPage() {
|
||||
CityPage result = new CityPage();
|
||||
result.setElements(Collections.emptyList());
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.feign.model.LocationHierarchy;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The view model for a location view.
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.mowesta.android.app.repository.UserRepository;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.app.task.RefreshTask;
|
||||
import com.mowesta.android.app.task.SyncTask;
|
||||
import com.mowesta.android.feign.ApiClient;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.Device;
|
||||
import com.mowesta.android.feign.model.DeviceHandle;
|
||||
|
||||
+34
-7
@@ -1,20 +1,15 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.paging.PagedList;
|
||||
|
||||
import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.Device;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The view model to fingure a measure widget.
|
||||
* The view model to configure a measure widget.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@@ -39,6 +34,12 @@ public class MeasureWidgetViewModel extends DevicesViewModel {
|
||||
/** A boolean to indicate the temperature scale. */
|
||||
private final MutableLiveData<Boolean> si = new MutableLiveData<>(Boolean.TRUE);
|
||||
|
||||
/** The color for the widget. */
|
||||
private final MutableLiveData<Integer> color = new MutableLiveData<>(Color.rgb(255, 255, 255));
|
||||
|
||||
/** A boolean to indicate that the dialog should be opened. */
|
||||
private final MutableLiveData<Boolean> dialog = new MutableLiveData<>(Boolean.FALSE);
|
||||
|
||||
/**
|
||||
* Creates the view model.
|
||||
*
|
||||
@@ -125,4 +126,30 @@ public class MeasureWidgetViewModel extends DevicesViewModel {
|
||||
* @return The live data.
|
||||
*/
|
||||
public MutableLiveData<Boolean> getLogin() { return login; }
|
||||
|
||||
/**
|
||||
* Returns the current color.
|
||||
*
|
||||
* @return The color.
|
||||
*/
|
||||
public MutableLiveData<Integer> getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean to signal that the color picker shall be opened.
|
||||
*
|
||||
* @return The dialog state.
|
||||
*/
|
||||
public MutableLiveData<Boolean> getDialog() {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the color button is pressed.
|
||||
*/
|
||||
public void onColor() {
|
||||
dialog.setValue(Boolean.TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The view model to display a single measurement
|
||||
* in a bottom sheet dialog.
|
||||
* The view model to display a single measurement in a bottom sheet dialog.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -9,16 +8,8 @@ import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.mowesta.android.feign.model.Measurement;
|
||||
import com.mowesta.android.feign.model.WeatherReport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The view model to display a single weather report
|
||||
* in a bottom sheet dialog.
|
||||
|
||||
@@ -12,7 +12,6 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.os.ConfigurationCompat;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
@@ -356,16 +355,22 @@ public class SetupViewModel extends AndroidViewModel {
|
||||
|
||||
private Double parseValue(String value) {
|
||||
if (value == null) return null;
|
||||
value = value.trim();
|
||||
LocaleListCompat c = ConfigurationCompat.getLocales(getApplication().getResources().getConfiguration());
|
||||
for (int i = 0; i < c.size(); i++) {
|
||||
Locale l = c.get(i);
|
||||
NumberFormat f = NumberFormat.getNumberInstance(l);
|
||||
try {
|
||||
return ((Number)f.parseObject(value.trim())).doubleValue();
|
||||
return ((Number)f.parseObject(value)).doubleValue();
|
||||
} catch (ParseException e) {
|
||||
Log.d(TAG, "Failed to parse double from: " + value);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return Double.parseDouble(value.replace(',', '.'));
|
||||
} catch (NumberFormatException e) {
|
||||
Log.d(TAG, "Failed to parse double, giving up: " + value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.paging.DataSource;
|
||||
@@ -13,17 +12,13 @@ import androidx.paging.LivePagedListBuilder;
|
||||
import androidx.paging.PagedList;
|
||||
import androidx.paging.PositionalDataSource;
|
||||
|
||||
import com.mowesta.android.app.IApp;
|
||||
import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.app.repository.ClientFactory;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.app.task.TaskStatus;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.CityPage;
|
||||
import com.mowesta.android.feign.model.Country;
|
||||
import com.mowesta.android.feign.model.LocationReference;
|
||||
import com.mowesta.android.feign.model.State;
|
||||
|
||||
@@ -60,7 +55,7 @@ public class StateViewModel extends AbstractPlaceViewModel {
|
||||
/**
|
||||
* A handler to run on main.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* The loader for the state.
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -61,7 +62,7 @@ public class StationViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* The handler to run on main.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates a new view model.
|
||||
|
||||
@@ -1,33 +1,17 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.paging.DataSource;
|
||||
import androidx.paging.LivePagedListBuilder;
|
||||
import androidx.paging.PagedList;
|
||||
import androidx.paging.PagedListAdapter;
|
||||
import androidx.paging.PositionalDataSource;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mowesta.android.app.IApp;
|
||||
import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.databinding.ViewStationEntryBinding;
|
||||
import com.mowesta.android.app.repository.ClientFactory;
|
||||
import com.mowesta.android.app.task.ApiTask;
|
||||
import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.CityPage;
|
||||
import com.mowesta.android.feign.model.WeatherStation;
|
||||
import com.mowesta.android.feign.model.WeatherStationPage;
|
||||
|
||||
@@ -64,7 +48,7 @@ public class StationsViewModel extends AbstractNetworkViewModel {
|
||||
/**
|
||||
* The handler to debounce the updates to the search term.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates the view model.
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mowesta.android.app.model;
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.mowesta.android.app.model;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
@@ -16,9 +11,6 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import com.mowesta.android.app.task.ImageTask;
|
||||
import com.mowesta.android.feign.model.WeatherVideo;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* The view model for weather videos.
|
||||
*
|
||||
|
||||
@@ -25,7 +25,7 @@ public class WidgetRepository extends Repository {
|
||||
*/
|
||||
public WidgetRepository(IApp application) {
|
||||
super(application);
|
||||
database = Room.databaseBuilder(application.getContext(), WidgetDatabase .class, "widgets").fallbackToDestructiveMigration().build();
|
||||
database = Room.databaseBuilder(application.getContext(), WidgetDatabase .class, "widgets").addMigrations(WidgetDatabase.getMigrations()).build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
import feign.FeignException;
|
||||
|
||||
@@ -45,7 +44,7 @@ public class ApiTask<I, O> {
|
||||
/**
|
||||
* Called when the call fails.
|
||||
*
|
||||
* @parma input The input of the call.
|
||||
* @param input The input of the call.
|
||||
* @param status The error code of the call.
|
||||
*/
|
||||
void onError(I input, int status);
|
||||
@@ -105,18 +104,15 @@ public class ApiTask<I, O> {
|
||||
*
|
||||
* @param input The input.
|
||||
* @param client the api client.
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public ApiTask<Favorite, Boolean> execute(final I input, final DefaultApi client) {
|
||||
new AsyncTask<I, Void, O>() {
|
||||
public void execute(final I input, final DefaultApi client) {
|
||||
new AbstractTask<O>(true) {
|
||||
private Exception e;
|
||||
@Override
|
||||
@SafeVarargs
|
||||
protected final O doInBackground( I... is) {
|
||||
protected final O doInBackground() {
|
||||
try {
|
||||
return call.exeucte(is[0], client);
|
||||
return call.exeucte(input, client);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Exception while executing api task.", e);
|
||||
this.e = e;
|
||||
@@ -137,8 +133,7 @@ public class ApiTask<I, O> {
|
||||
successListener.onSuccess(input, o);
|
||||
}
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, input);
|
||||
return null;
|
||||
}.execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
/**
|
||||
* A task that interacts with a room database. Note that this
|
||||
* task is executed on the serial executor to ensure that it
|
||||
@@ -82,14 +83,12 @@ public class DatabaseTask<D extends RoomDatabase, I, O> {
|
||||
* @param database The database.
|
||||
* @param input The input.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public void execute(final I input, final D database) {
|
||||
new AsyncTask<I, Void, O>() {
|
||||
new AbstractTask<O>(false) {
|
||||
@Override
|
||||
@SafeVarargs
|
||||
protected final O doInBackground(I... is) {
|
||||
return call.exeucte(is[0], database);
|
||||
protected final O doInBackground() {
|
||||
return call.exeucte(input, database);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,7 +96,7 @@ public class DatabaseTask<D extends RoomDatabase, I, O> {
|
||||
super.onPostExecute(o);
|
||||
resultListener.onResult(input, o);
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, input);
|
||||
}.execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ package com.mowesta.android.app.task;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
@@ -54,12 +55,11 @@ public class ImageTask {
|
||||
*
|
||||
* @param url The url to download.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public void execute(final @NonNull String url) {
|
||||
AsyncTask task = new AsyncTask<Void, Void, Bitmap>() {
|
||||
new AbstractTask<Bitmap>(true) {
|
||||
@Override
|
||||
protected Bitmap doInBackground(@SuppressLint("StaticFieldLeak") Void... voids) {
|
||||
protected Bitmap doInBackground() {
|
||||
try {
|
||||
InputStream in = new URL(url).openStream();
|
||||
return BitmapFactory.decodeStream(in);
|
||||
@@ -73,8 +73,7 @@ public class ImageTask {
|
||||
protected void onPostExecute(Bitmap bitmap) {
|
||||
listener.onResult(url, bitmap);
|
||||
}
|
||||
};
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Object[])new Void[0]);
|
||||
}.execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.City;
|
||||
import com.mowesta.android.feign.model.CityPage;
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -102,9 +101,9 @@ public class RefreshTask {
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public void execute(DefaultApi client) {
|
||||
new AsyncTask<Void, Void, Boolean>() {
|
||||
new AbstractTask<Boolean>(true) {
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
protected Boolean doInBackground() {
|
||||
List<Favorite> favorites = database.getAccessor().getAll();
|
||||
final List<Favorite> modified = new ArrayList<>();
|
||||
final List<Favorite> unmodified = new ArrayList<>();
|
||||
@@ -124,7 +123,8 @@ public class RefreshTask {
|
||||
result[0] = false;
|
||||
modified.notifyAll();
|
||||
}
|
||||
}).execute(f, client);
|
||||
});
|
||||
loadTask.execute(f, client);
|
||||
}
|
||||
synchronized (modified) {
|
||||
try {
|
||||
@@ -144,7 +144,7 @@ public class RefreshTask {
|
||||
super.onPostExecute(aBoolean);
|
||||
if (completionListener != null) completionListener.onCompletion(aBoolean);
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
package com.mowesta.android.app.task;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.database.FavoriteDatabase;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.feign.model.LocationReference;
|
||||
import com.mowesta.android.feign.model.Settings;
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A task that will synchronize the entries in the local favorite
|
||||
@@ -76,9 +74,9 @@ public class SyncTask {
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public void execute(DefaultApi client) {
|
||||
new AsyncTask<Void, Void, Boolean>() {
|
||||
new AbstractTask<Boolean>(false) {
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
protected Boolean doInBackground() {
|
||||
List<Favorite> favorites = database.getAccessor().getAll();
|
||||
try {
|
||||
List<Favorite> favs = new ArrayList<>(favorites);
|
||||
@@ -168,7 +166,7 @@ public class SyncTask {
|
||||
if (completionListener != null) completionListener.onCompletion(result);
|
||||
}
|
||||
|
||||
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
||||
}.execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+24
-4
@@ -2,6 +2,7 @@ package com.mowesta.android.app.widget;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
@@ -60,7 +61,7 @@ public abstract class AbstractWidgetProvider extends AppWidgetProvider {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds);
|
||||
Log.d(TAG, "Updating widget data for " + Arrays.toString(appWidgetIds));
|
||||
for (int i = 0; i < appWidgetIds.length; i++) {
|
||||
triggerUpdate(context, appWidgetIds[i]);
|
||||
triggerUpdate(context, appWidgetIds[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ public abstract class AbstractWidgetProvider extends AppWidgetProvider {
|
||||
public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
|
||||
Log.d(TAG, "Updating widget data for " + appWidgetId + " due to change.");
|
||||
triggerUpdate(context, appWidgetId);
|
||||
triggerUpdate(context, appWidgetId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,16 +129,19 @@ public abstract class AbstractWidgetProvider extends AppWidgetProvider {
|
||||
* Triggers the widget service to perform an update.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param schedule Determines whether we also perform a background update.
|
||||
* @param id The id.
|
||||
*/
|
||||
public void triggerUpdate(Context context, int id) {
|
||||
WidgetService.scheduleUpdate(context, type, id);
|
||||
public void triggerUpdate(Context context, int id, boolean schedule) {
|
||||
if (schedule) WidgetService.scheduleUpdate(context, type, id);
|
||||
Log.d(TAG, "Start database query for widget " + id + ".");
|
||||
DatabaseTask<WidgetDatabase, Integer, Widget> task = new DatabaseTask<WidgetDatabase, Integer, Widget>((input, database)-> {
|
||||
List<Widget> widgets = database.getAccessor().get(type, input);
|
||||
if (widgets.isEmpty()) return null;
|
||||
else return widgets.get(0);
|
||||
}, (input, widget)-> {
|
||||
if (widget != null) {
|
||||
Log.d(TAG, "Finish database query for widget " + input + ".");
|
||||
updateWidget(context, widget);
|
||||
}
|
||||
});
|
||||
@@ -160,6 +164,7 @@ public abstract class AbstractWidgetProvider extends AppWidgetProvider {
|
||||
int maxWidth = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, 0);
|
||||
int minHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, 0);
|
||||
int maxHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, 0);
|
||||
Log.d(TAG, String.format("Widget %d: Width(%d-%d) Height(%d-%d)", id, minWidth, maxWidth, minHeight, maxHeight));
|
||||
if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
return new int[] { minWidth, maxHeight };
|
||||
} else {
|
||||
@@ -178,5 +183,20 @@ public abstract class AbstractWidgetProvider extends AppWidgetProvider {
|
||||
public abstract void updateWidget(Context context, Widget widget);
|
||||
|
||||
|
||||
/**
|
||||
* Updates all widgets of the provider.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param schedule True to also schedule a background update.
|
||||
* @return True if any update has been scheduled.
|
||||
*/
|
||||
public boolean triggerUpdates(Context context, boolean schedule) {
|
||||
AppWidgetManager manager = AppWidgetManager.getInstance(context);
|
||||
int[] ids = manager.getAppWidgetIds(new ComponentName(context, getClass()));
|
||||
for (int id: ids) {
|
||||
triggerUpdate(context, id, schedule);
|
||||
}
|
||||
return ids.length > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
-4
@@ -94,6 +94,10 @@ public class ForecastWidgetProvider extends AbstractWidgetProvider {
|
||||
}
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_forecast);
|
||||
// set color
|
||||
views.setTextColor(R.id.widget_location_name, widget.getColor());
|
||||
views.setTextColor(R.id.widget_condition_text, widget.getColor());
|
||||
views.setTextColor(R.id.widget_condition_temperature, widget.getColor());
|
||||
// set city name
|
||||
views.setTextViewText(R.id.widget_location_name, BindingTransforms.getName(context, city.getNames(), false));
|
||||
// set icon
|
||||
@@ -102,7 +106,7 @@ public class ForecastWidgetProvider extends AbstractWidgetProvider {
|
||||
Integer icon = BindingTransforms.getIcon(weatherType, false);
|
||||
if (icon != null) {
|
||||
views.setImageViewResource(R.id.widget_condition_icon, icon);
|
||||
views.setInt(R.id.widget_condition_icon, "setColorFilter", Color.argb(255, 255, 255, 255));
|
||||
views.setInt(R.id.widget_condition_icon, "setColorFilter", widget.getColor());
|
||||
views.setImageViewResource(R.id.widget_condition_background, icon);
|
||||
views.setInt(R.id.widget_condition_background, "setColorFilter", Color.argb(255, 0, 0, 0));
|
||||
}
|
||||
@@ -124,7 +128,7 @@ public class ForecastWidgetProvider extends AbstractWidgetProvider {
|
||||
if (height > (BREAK_VERTICAL * scale) && count > 0) {
|
||||
views.addView(R.id.widget_container_days, new RemoteViews(context.getPackageName(), R.layout.widget_forecast_spacer));
|
||||
for (int i = 0; i < count; i++) {
|
||||
RemoteViews day = createDayView(context, days.get(i), unit);
|
||||
RemoteViews day = createDayView(context, days.get(i), unit, widget.getColor());
|
||||
views.addView(R.id.widget_container_days, day);
|
||||
views.addView(R.id.widget_container_days, new RemoteViews(context.getPackageName(), R.layout.widget_forecast_spacer));
|
||||
}
|
||||
@@ -150,16 +154,21 @@ public class ForecastWidgetProvider extends AbstractWidgetProvider {
|
||||
* @param context The context.
|
||||
* @param model The model.
|
||||
* @param unit The temperature unit.
|
||||
* @param color The color.
|
||||
* @return The view.
|
||||
*/
|
||||
private RemoteViews createDayView(Context context, SummaryViewModel model, MowestaSettings.TemperatureUnit unit) {
|
||||
private RemoteViews createDayView(Context context, SummaryViewModel model, MowestaSettings.TemperatureUnit unit, int color) {
|
||||
RemoteViews day = new RemoteViews(context.getPackageName(), R.layout.widget_forecast_day);
|
||||
// set color
|
||||
day.setTextColor(R.id.widget_day_text, color);
|
||||
day.setTextColor(R.id.widget_day_temperature, color);
|
||||
// set content
|
||||
day.setTextViewText(R.id.widget_day_text, model.getTitle().getValue());
|
||||
WeatherCondition.TypeEnum weatherType = model.getMax().getValue().getType();
|
||||
Integer icon = BindingTransforms.getIcon(weatherType, false);
|
||||
if (icon != null) {
|
||||
day.setImageViewResource(R.id.widget_day_icon, icon);
|
||||
day.setInt(R.id.widget_day_icon, "setColorFilter", Color.argb(255, 255, 255, 255));
|
||||
day.setInt(R.id.widget_day_icon, "setColorFilter", color);
|
||||
day.setImageViewResource(R.id.widget_day_background, icon);
|
||||
day.setInt(R.id.widget_day_background, "setColorFilter", Color.argb(255, 0, 0, 0));
|
||||
}
|
||||
|
||||
+12
-9
@@ -73,6 +73,8 @@ public class MeasureWidgetProvider extends AbstractWidgetProvider {
|
||||
int height = widgetDimension[1];
|
||||
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_measure);
|
||||
views.setTextColor(R.id.widget_device_name, widget.getColor());
|
||||
views.setTextColor(R.id.widget_device_model, widget.getColor());
|
||||
// set device
|
||||
views.setTextViewText(R.id.widget_device_name, device.getDevice());
|
||||
views.setTextViewText(R.id.widget_device_model, device.getModel());
|
||||
@@ -81,7 +83,7 @@ public class MeasureWidgetProvider extends AbstractWidgetProvider {
|
||||
int label = BindingTransforms.getOsLabel(device.getOs());
|
||||
if (icon != 0 && label != 0) {
|
||||
views.setImageViewResource(R.id.widget_device_icon, icon);
|
||||
views.setInt(R.id.widget_device_icon, "setColorFilter", Color.argb(255, 255, 255, 255));
|
||||
views.setInt(R.id.widget_device_icon, "setColorFilter", widget.getColor());
|
||||
views.setImageViewResource(R.id.widget_device_background, icon);
|
||||
views.setInt(R.id.widget_device_background, "setColorFilter", Color.argb(255, 0, 0, 0));
|
||||
views.setContentDescription(R.id.widget_device_icon, context.getResources().getString(label));
|
||||
@@ -92,23 +94,23 @@ public class MeasureWidgetProvider extends AbstractWidgetProvider {
|
||||
List<RemoteViews> items = new ArrayList<>();
|
||||
Date dateTime = new Date(measurement.getTime());
|
||||
String date = android.text.format.DateFormat.getDateFormat(context).format(dateTime);
|
||||
createItemView(items, context, R.drawable.ic_calendar_today_normal_24, R.string.widget_measure_date, UnitUtils.toSpanned(date));
|
||||
createItemView(items, context, R.drawable.ic_calendar_today_normal_24, R.string.widget_measure_date, UnitUtils.toSpanned(date), widget.getColor());
|
||||
String time = android.text.format.DateFormat.getTimeFormat(context).format(dateTime);
|
||||
createItemView(items, context, R.drawable.ic_alarm_normal_24, R.string.widget_measure_time , UnitUtils.toSpanned(time));
|
||||
createItemView(items, context, R.drawable.ic_alarm_normal_24, R.string.widget_measure_time , UnitUtils.toSpanned(time), widget.getColor());
|
||||
if (measurement.getTemperature() != null) {
|
||||
createItemView(items, context, R.drawable.ic_thermometer_normal_24, R.string.label_temperature, UnitUtils.toSpanned(UnitUtils.getTemperature(context, measurement.getTemperature(), unit)));
|
||||
createItemView(items, context, R.drawable.ic_thermometer_normal_24, R.string.label_temperature, UnitUtils.toSpanned(UnitUtils.getTemperature(context, measurement.getTemperature(), unit)), widget.getColor());
|
||||
}
|
||||
if (measurement.getPressure() != null) {
|
||||
createItemView(items, context, R.drawable.ic_barometer_normal_24, R.string.label_pressure, UnitUtils.toSpanned(UnitUtils.getPressure(context, measurement.getPressure(), system)));
|
||||
createItemView(items, context, R.drawable.ic_barometer_normal_24, R.string.label_pressure, UnitUtils.toSpanned(UnitUtils.getPressure(context, measurement.getPressure(), system)), widget.getColor());
|
||||
}
|
||||
if (measurement.getHumidity() != null) {
|
||||
createItemView(items, context, R.drawable.ic_humidity_normal_24, R.string.label_humidity, UnitUtils.toSpanned(context.getResources().getString(R.string.format_humidity, measurement.getHumidity())));
|
||||
createItemView(items, context, R.drawable.ic_humidity_normal_24, R.string.label_humidity, UnitUtils.toSpanned(context.getResources().getString(R.string.format_humidity, measurement.getHumidity())), widget.getColor());
|
||||
}
|
||||
if (device.getOs() != Device.OsEnum.IOS && device.getOs() != Device.OsEnum.ANDROID) {
|
||||
if (measurement.getData().containsKey(MeasurementType.BATTERY_VOLTAGE.name())) {
|
||||
Object[] values = MeasurementType.BATTERY_VOLTAGE.getValues(measurement.getData().get(MeasurementType.BATTERY_VOLTAGE.name()));
|
||||
if (values.length > 0 && values[0] instanceof Double) {
|
||||
createItemView(items, context, R.drawable.ic_outline_battery_unknown_normal_24, R.string.measurement_type_battery_voltage, UnitUtils.toSpanned(context.getResources().getString(R.string.format_voltage, (Double)values[0])));
|
||||
createItemView(items, context, R.drawable.ic_outline_battery_unknown_normal_24, R.string.measurement_type_battery_voltage, UnitUtils.toSpanned(context.getResources().getString(R.string.format_voltage, (Double)values[0])), widget.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,15 +134,16 @@ public class MeasureWidgetProvider extends AbstractWidgetProvider {
|
||||
appWidgetManager.updateAppWidget(widget.getReference(), views);
|
||||
}
|
||||
|
||||
public void createItemView(List<RemoteViews> result, Context context, int icon, int description, Spanned value) {
|
||||
public void createItemView(List<RemoteViews> result, Context context, int icon, int description, Spanned value, int color) {
|
||||
if (value != null) {
|
||||
RemoteViews item = new RemoteViews(context.getPackageName(), R.layout.widget_measure_item);
|
||||
item.setImageViewResource(R.id.widget_item_icon, icon);
|
||||
item.setInt(R.id.widget_item_icon, "setColorFilter", Color.argb(255, 255, 255, 255));
|
||||
item.setInt(R.id.widget_item_icon, "setColorFilter", color);
|
||||
item.setImageViewResource(R.id.widget_item_background, icon);
|
||||
item.setInt(R.id.widget_item_background, "setColorFilter", Color.argb(255, 0, 0, 0));
|
||||
item.setContentDescription(R.id.widget_item_icon, context.getResources().getString(description));
|
||||
item.setTextViewText(R.id.widget_item_text, value);
|
||||
item.setTextColor(R.id.widget_item_text, color);
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,17 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mowesta.android.app.database.Widget;
|
||||
|
||||
/**
|
||||
* The receiver that will
|
||||
* The receiver that is called periodically by the alarm
|
||||
* manager to perform widget updates every x minutes.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class WidgetReceiver extends BroadcastReceiver {
|
||||
|
||||
@@ -90,7 +94,9 @@ public class WidgetReceiver extends BroadcastReceiver {
|
||||
*/
|
||||
private static PendingIntent createIntent(Context context) {
|
||||
Intent intent = new Intent(context, WidgetReceiver.class);
|
||||
return PendingIntent.getBroadcast(context, 2298, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) flags = flags | PendingIntent.FLAG_IMMUTABLE;
|
||||
return PendingIntent.getBroadcast(context, REQuEST_CODE, intent, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.mowesta.android.app.widget;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -19,6 +21,7 @@ import com.mowesta.android.feign.model.Device;
|
||||
import com.mowesta.android.feign.model.Measurement;
|
||||
import com.mowesta.android.feign.model.MeasurementPage;
|
||||
import com.mowesta.android.feign.model.WeatherForecast;
|
||||
import com.mowesta.android.sdk.task.AbstractTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -62,7 +65,7 @@ public class WidgetService extends JobIntentService {
|
||||
/**
|
||||
* A handler to perform work on the ui thread.
|
||||
*/
|
||||
private Handler handler = new Handler();
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Schedules an update for a particular widget referenced by its type and its
|
||||
@@ -73,22 +76,48 @@ public class WidgetService extends JobIntentService {
|
||||
* @param type The widget type.
|
||||
*/
|
||||
public static void scheduleUpdate(Context context, int type, int reference) {
|
||||
Log.d(TAG, "Schedule background update for widget " + reference + " type " + type + ".");
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(context, JobIntentService.class);
|
||||
intent.putExtra(EXTRA_WIDGET_TYPE, type);
|
||||
intent.putExtra(EXTRA_WIDGET_REFERENCE, reference);
|
||||
// schedule background execution with proper locks
|
||||
enqueueWork(context, WidgetService.class, SERVICE_ID, intent);
|
||||
// and also execute immediately, if we are on > o
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
IApp app = (IApp)context.getApplicationContext();
|
||||
new AbstractTask<Void>(true) {
|
||||
@Override
|
||||
protected Void doInBackground() {
|
||||
updateWidget(app, handler, type, reference);
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleWork(@NonNull Intent intent) {
|
||||
int type = intent.getIntExtra(EXTRA_WIDGET_TYPE, Widget.TYPE_INVALID);
|
||||
int reference = intent.getIntExtra(EXTRA_WIDGET_REFERENCE, AppWidgetManager.INVALID_APPWIDGET_ID);
|
||||
IApp app = (IApp)getApplicationContext();
|
||||
updateWidget(app, handler, type, reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the data contained in the widget and requests a ui update.
|
||||
*
|
||||
* @param app The app.
|
||||
* @param handler A handler to trigger a refresh.
|
||||
* @param type The type.
|
||||
* @param reference The reference.
|
||||
*/
|
||||
public static void updateWidget(IApp app, Handler handler, int type, int reference) {
|
||||
if (type == Widget.TYPE_INVALID || reference == AppWidgetManager.INVALID_APPWIDGET_ID) {
|
||||
Log.d(TAG, "Received an invalid request for type " + type + " and reference " + reference + ".");
|
||||
return;
|
||||
}
|
||||
IApp app = (IApp)getApplicationContext();
|
||||
WidgetDatabase database = app.getWidgetRepository().getDatabase();
|
||||
WidgetAccessor accessor = database.getAccessor();
|
||||
List<Widget> widgets = accessor.get(type, reference);
|
||||
@@ -129,7 +158,7 @@ public class WidgetService extends JobIntentService {
|
||||
if (w != null) {
|
||||
handler.post(()-> {
|
||||
ForecastWidgetProvider provider = new ForecastWidgetProvider();
|
||||
provider.updateWidget(getApplicationContext(), w);
|
||||
provider.updateWidget(app.getContext(), w);
|
||||
});
|
||||
}
|
||||
} else if (type == Widget.TYPE_MEASURE) {
|
||||
@@ -167,7 +196,7 @@ public class WidgetService extends JobIntentService {
|
||||
if (w != null) {
|
||||
handler.post(()-> {
|
||||
MeasureWidgetProvider provider = new MeasureWidgetProvider();
|
||||
provider.updateWidget(getApplicationContext(), w);
|
||||
provider.updateWidget(app.getContext(), w);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#ff0000"
|
||||
android:centerColor="#00aa00"
|
||||
android:startColor="#0000ff"
|
||||
android:type="linear" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94L13,1h-2v2.06c-1.13,0.12 -2.19,0.46 -3.16,0.97l1.5,1.5C10.16,5.19 11.06,5 12,5c3.87,0 7,3.13 7,7 0,0.94 -0.19,1.84 -0.52,2.65l1.5,1.5c0.5,-0.96 0.84,-2.02 0.97,-3.15L23,13v-2h-2.06zM3,4.27l2.04,2.04C3.97,7.62 3.25,9.23 3.06,11L1,11v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94L11,23h2v-2.06c1.77,-0.2 3.38,-0.91 4.69,-1.98L19.73,21 21,19.73 4.27,3 3,4.27zM16.27,17.54C15.09,18.45 13.61,19 12,19c-3.87,0 -7,-3.13 -7,-7 0,-1.61 0.55,-3.09 1.46,-4.27l9.81,9.81z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
|
||||
</vector>
|
||||
@@ -8,7 +8,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/layout_coordinator">
|
||||
|
||||
<fragment
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/navigation_app"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<data>
|
||||
<variable
|
||||
name="model"
|
||||
type="com.mowesta.android.app.model.AdvertiseViewModel" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header"
|
||||
android:background="@color/accent"
|
||||
tools:targetApi="21"
|
||||
android:elevation="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Space
|
||||
android:layout_width="@dimen/space_medium"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:contentDescription="@null"
|
||||
android:layout_width="48dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
app:tint="@color/fg_accent"
|
||||
app:srcCompat="@drawable/ic_info_normal_24"/>
|
||||
|
||||
<TextView
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="@dimen/space_medium"
|
||||
android:layout_marginEnd="@dimen/space_medium"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:text="@string/advertise_header"
|
||||
android:textColor="@color/fg_accent"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageButton
|
||||
android:contentDescription="@string/button_close"
|
||||
android:layout_width="48dp"
|
||||
app:tint="@color/fg_accent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{ () -> model.close() }"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
|
||||
app:srcCompat="@drawable/ic_close_normal_24" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="@{ () -> model.open() }"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp">
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:use_controller="false"
|
||||
app:resize_mode="zoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
<TextView
|
||||
android:text="@string/advertise_title"
|
||||
android:id="@+id/ad_title"
|
||||
android:textAppearance="?attr/textAppearanceBody1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:padding="8dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/advertise_more"
|
||||
android:textAppearance="?attr/textAppearanceBody1"
|
||||
android:layout_centerInParent="true"
|
||||
android:paddingTop="50dp"
|
||||
android:gravity="center"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/advertise_description"
|
||||
android:id="@+id/ad_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:textAppearance="?attr/textAppearanceBody2"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="model"
|
||||
type="com.mowesta.android.app.model.ColorViewModel" />
|
||||
</data>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/bg_color"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:paddingStart="1dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingTop="1dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_cloudy_normal_24"
|
||||
app:tint="@color/black" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/color_result_image"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_cloudy_normal_24"
|
||||
app:tint="@color/white" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/color_result_text"
|
||||
style="@style/TextAppearance.MaterialComponents.Headline4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@color/black"
|
||||
android:shadowDx="1"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="2"
|
||||
android:text="@string/color_dialog_example"
|
||||
android:textColor="@color/white"
|
||||
app:autoSizeMaxTextSize="@dimen/max_font_headline"
|
||||
app:autoSizeMinTextSize="@dimen/min_font_headline"
|
||||
app:autoSizeTextType="uniform" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.slider.Slider
|
||||
android:id="@+id/color_slider_red"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:contentDescription="@string/color_dialog_red"
|
||||
android:stepSize="1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="255"
|
||||
app:thumbColor="#FF0000"
|
||||
app:tickVisible="false"
|
||||
app:trackColor="#CC0000" />
|
||||
|
||||
<com.google.android.material.slider.Slider
|
||||
android:id="@+id/color_slider_green"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:contentDescription="@string/color_dialog_green"
|
||||
android:stepSize="1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="255"
|
||||
app:thumbColor="#009900"
|
||||
app:tickVisible="false"
|
||||
app:trackColor="#008800" />
|
||||
|
||||
<com.google.android.material.slider.Slider
|
||||
android:id="@+id/color_slider_blue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:contentDescription="@string/color_dialog_blue"
|
||||
android:stepSize="1"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="255"
|
||||
app:thumbColor="#0000FF"
|
||||
app:tickVisible="false"
|
||||
app:trackColor="#0000CC" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primary"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_cancel"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@android:string/cancel"
|
||||
app:backgroundTint="@color/primaryDark" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_ok"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@android:string/ok"
|
||||
app:backgroundTint="@color/accent" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<ImageButton
|
||||
android:contentDescription="@string/button_close"
|
||||
android:layout_width="48dp"
|
||||
android:tint="@color/fg_accent"
|
||||
app:tint="@color/fg_accent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{ () -> closeListener.run() }"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
|
||||
|
||||
@@ -49,11 +49,23 @@
|
||||
android:layout_width="match_parent"/>
|
||||
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/button_color"
|
||||
android:contentDescription="@string/color_dialog_open"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
app:backgroundTint="@color/primary"
|
||||
app:tint="@color/white"
|
||||
app:srcCompat="@drawable/ic_palette_normal_24"
|
||||
android:onClick="@{ () -> model.onColor() }"/>
|
||||
|
||||
<include layout="@layout/view_progress"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:background="@color/primary"
|
||||
android:orientation="horizontal"
|
||||
|
||||
@@ -92,6 +92,19 @@
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/button_color"
|
||||
android:contentDescription="@string/color_dialog_open"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
app:backgroundTint="@color/primary"
|
||||
app:tint="@color/white"
|
||||
app:srcCompat="@drawable/ic_palette_normal_24"
|
||||
android:onClick="@{ () -> model.onColor() }"/>
|
||||
|
||||
|
||||
<include layout="@layout/view_progress"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="56dp"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:text="@string/setup_title"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<ImageButton
|
||||
android:id="@+id/video_zoom"
|
||||
android:background="@drawable/ripple_accent_round"
|
||||
android:tint="@color/accent"
|
||||
app:tint="@color/accent"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true"
|
||||
@@ -54,7 +54,7 @@
|
||||
<ImageButton
|
||||
android:id="@+id/video_scale"
|
||||
android:background="@drawable/ripple_accent_round"
|
||||
android:tint="@color/accent"
|
||||
app:tint="@color/accent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toEndOf="@+id/video_zoom"
|
||||
android:layout_margin="8dp"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:contentDescription="@null"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
@@ -41,8 +42,7 @@
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:src="@drawable/ic_day_sunny_normal_24"
|
||||
weatherIcon="@{model.condition}"
|
||||
android:textSize="40dp"/>
|
||||
weatherIcon="@{model.condition}"/>
|
||||
<LinearLayout
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
@@ -142,6 +142,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="4dp">
|
||||
<ImageView
|
||||
android:contentDescription="@null"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceBody1"
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="4dp">
|
||||
<ImageView
|
||||
android:contentDescription="@null"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitCenter"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="left"
|
||||
android:gravity="start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
|
||||
@@ -87,4 +87,11 @@
|
||||
app:destination="@id/navigation_core" />
|
||||
</fragment>
|
||||
|
||||
<action
|
||||
android:id="@+id/action_core"
|
||||
app:popUpTo="@id/destination_splash"
|
||||
app:popUpToInclusive="true"
|
||||
app:launchSingleTop="true"
|
||||
app:destination="@id/navigation_core" />
|
||||
|
||||
</navigation>
|
||||
@@ -77,11 +77,17 @@
|
||||
android:id="@+id/destination_connect"
|
||||
tools:layout="@layout/fragment_connect"
|
||||
android:name="com.mowesta.android.app.fragment.ConnectFragment" />
|
||||
<fragment
|
||||
android:id="@+id/destination_review"
|
||||
android:name="com.mowesta.android.app.fragment.TermsFragment"
|
||||
android:label="@string/navigation_terms"
|
||||
android:layout="@layout/fragment_terms" />
|
||||
<include app:graph="@navigation/navigation_drawer" />
|
||||
<action
|
||||
android:id="@+id/action_drawer"
|
||||
app:popUpTo="@id/destination_drawer"
|
||||
app:popUpToInclusive="true"
|
||||
app:launchSingleTop="true"
|
||||
app:enterAnim="@anim/slide_in_right"
|
||||
app:exitAnim="@anim/slide_out_left"
|
||||
app:destination="@id/destination_drawer" />
|
||||
|
||||
@@ -13,10 +13,14 @@
|
||||
<string name="button_save">Speichern</string>
|
||||
<string name="button_close">Schließen</string>
|
||||
<string name="button_login">Einrichten</string>
|
||||
<string name="button_yes">Ja</string>
|
||||
<string name="button_no">Nein</string>
|
||||
<string name="message_no_browser">Dein Webbrowser konnte nicht geöffnet werden.</string>
|
||||
<string name="message_no_permission">Der App fehlt eine notwendige Berechtigung.</string>
|
||||
<string name="message_permission_title">Fehlende Berechtigung</string>
|
||||
<string name="message_permission_background">Um automatisch Messungen zu erfassen, benötigt MoWeSta die Berechtigung auf den Gerätestandort im Hintergrund zugreifen zu können.</string>
|
||||
<string name="message_permission_foreground">Um den Standort automatisch zu bestimmen, benötigt MoWeSta die Berechtigung auf den Gerätestandort zugreifen zu können.</string>
|
||||
<string name="message_configure_failed">Die Einstellungen konnten nicht geöffnet werden.</string>
|
||||
<string name="button_configure">An-\npassen</string>
|
||||
<string name="button_configure">Einstellungen anpasssen</string>
|
||||
|
||||
<!-- video controls -->
|
||||
<string name="button_fit_screen">Anzeige anpasen</string>
|
||||
@@ -310,4 +314,16 @@
|
||||
<string name="widget_measure_date">Datum</string>
|
||||
<string name="widget_measure_explain">Um die Messungen Deiner Geräte auf Deinem Startbildschirm anzeigen zu können, musst Du Dich leider erst mit Deinem Konto anmelden.</string>
|
||||
|
||||
<string name="color_dialog_open">Farbe anpassen</string>
|
||||
<string name="color_dialog_example">Beispiel</string>
|
||||
<string name="color_dialog_red">Rot</string>
|
||||
<string name="color_dialog_blue">Blau</string>
|
||||
<string name="color_dialog_green">Grün</string>
|
||||
|
||||
<string name="advertise_header">Veranstaltungshinweis</string>
|
||||
<string name="advertise_description">Mach mit beim FAIR Experiment vom 19. August bis zum 3. Oktober in Karlsruhe</string>
|
||||
<string name="advertise_more">Mehr erfahren…</string>
|
||||
<string name="advertise_title">Schlosslichtspiele 2021</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -13,10 +13,14 @@
|
||||
<string name="button_save">Save</string>
|
||||
<string name="button_close">Close</string>
|
||||
<string name="button_login">Setup</string>
|
||||
<string name="button_yes">Yes</string>
|
||||
<string name="button_no">No</string>
|
||||
<string name="message_no_browser">Unable to open your web browser.</string>
|
||||
<string name="message_no_permission">The app is missing a required permission.</string>
|
||||
<string name="message_permission_title">Missing Permission</string>
|
||||
<string name="message_permission_background">To automatically collect measurements, MoWeSta needs your permission to locate your device in the background.</string>
|
||||
<string name="message_permission_foreground">To automatically set the location, MoWeSta needs your permission to locate your device.</string>
|
||||
<string name="message_configure_failed">Could not open the app settings.</string>
|
||||
<string name="button_configure">Con-\nfigure</string>
|
||||
<string name="button_configure">Configure settings</string>
|
||||
|
||||
<!-- video controls -->
|
||||
<string name="button_fit_screen">Match screen</string>
|
||||
@@ -315,4 +319,14 @@
|
||||
<string name="widget_measure_date">Date</string>
|
||||
<string name="widget_measure_explain">To display the measurements of your devices on your home screen, you have to set up your account.</string>
|
||||
|
||||
<string name="color_dialog_open">Adjust color</string>
|
||||
<string name="color_dialog_example">Example</string>
|
||||
<string name="color_dialog_red">Red</string>
|
||||
<string name="color_dialog_blue">Blue</string>
|
||||
<string name="color_dialog_green">Green</string>
|
||||
|
||||
<string name="advertise_header">Event note</string>
|
||||
<string name="advertise_description">Join the FAIR Experiment from August 19th to October 3rd in Karlsruhe</string>
|
||||
<string name="advertise_more">Read more…</string>
|
||||
<string name="advertise_title">Schlosslichtspiele 2021</string>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 3,
|
||||
"identityHash": "003abf3aca1582de21ffacd272705467",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "widget",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`type` INTEGER NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `ref` INTEGER NOT NULL, `dataId` INTEGER NOT NULL, `dataTime` INTEGER NOT NULL, `dataValue` TEXT, `contentTime` INTEGER NOT NULL, `contentValue` TEXT, `celsius` INTEGER NOT NULL, `si` INTEGER NOT NULL)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "type",
|
||||
"columnName": "type",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "reference",
|
||||
"columnName": "ref",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dataId",
|
||||
"columnName": "dataId",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dataTime",
|
||||
"columnName": "dataTime",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dataValue",
|
||||
"columnName": "dataValue",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "contentTime",
|
||||
"columnName": "contentTime",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "contentValue",
|
||||
"columnName": "contentValue",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "celsius",
|
||||
"columnName": "celsius",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "si",
|
||||
"columnName": "si",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_widget_type_ref",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"type",
|
||||
"ref"
|
||||
],
|
||||
"createSql": "CREATE INDEX IF NOT EXISTS `index_widget_type_ref` ON `${TABLE_NAME}` (`type`, `ref`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": []
|
||||
}
|
||||
],
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '003abf3aca1582de21ffacd272705467')"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 4,
|
||||
"identityHash": "f81e1971cab535638fc49b20bbe3dd81",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "widget",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`type` INTEGER NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `ref` INTEGER NOT NULL, `dataId` INTEGER NOT NULL, `dataTime` INTEGER NOT NULL, `dataValue` TEXT, `contentTime` INTEGER NOT NULL, `contentValue` TEXT, `celsius` INTEGER NOT NULL, `si` INTEGER NOT NULL, `color` INTEGER NOT NULL)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "type",
|
||||
"columnName": "type",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "reference",
|
||||
"columnName": "ref",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dataId",
|
||||
"columnName": "dataId",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dataTime",
|
||||
"columnName": "dataTime",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dataValue",
|
||||
"columnName": "dataValue",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "contentTime",
|
||||
"columnName": "contentTime",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "contentValue",
|
||||
"columnName": "contentValue",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "celsius",
|
||||
"columnName": "celsius",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "si",
|
||||
"columnName": "si",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "color",
|
||||
"columnName": "color",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_widget_type_ref",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"type",
|
||||
"ref"
|
||||
],
|
||||
"createSql": "CREATE INDEX IF NOT EXISTS `index_widget_type_ref` ON `${TABLE_NAME}` (`type`, `ref`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": []
|
||||
}
|
||||
],
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f81e1971cab535638fc49b20bbe3dd81')"
|
||||
]
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'org.hidetake.swagger.generator' version '2.18.1'
|
||||
id 'org.hidetake.swagger.generator' version '2.18.2'
|
||||
}
|
||||
|
||||
description = "Mowesta Android Feign"
|
||||
@@ -10,15 +10,15 @@ description = "Mowesta Android Feign"
|
||||
versionJackson = "2.9.10"
|
||||
|
||||
dependencies {
|
||||
compile "de.grundid.opendatalab:geojson-jackson:${versionGeojson}"
|
||||
compile "io.swagger:swagger-annotations:${versionSwagger}"
|
||||
compile "com.fasterxml.jackson.core:jackson-core:${versionJackson}"
|
||||
compile "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
|
||||
compile "com.fasterxml.jackson.core:jackson-databind:${versionJackson}"
|
||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:${versionJackson}"
|
||||
compile "javax.annotation:javax.annotation-api:${versionAnnotation}"
|
||||
compile "io.github.openfeign:feign-core:9.4.0"
|
||||
compile "io.github.openfeign:feign-jackson:9.4.0"
|
||||
api "de.grundid.opendatalab:geojson-jackson:${versionGeojson}"
|
||||
api "io.swagger:swagger-annotations:${versionSwagger}"
|
||||
api "com.fasterxml.jackson.core:jackson-core:${versionJackson}"
|
||||
api "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
|
||||
api "com.fasterxml.jackson.core:jackson-databind:${versionJackson}"
|
||||
api "com.fasterxml.jackson.datatype:jackson-datatype-joda:${versionJackson}"
|
||||
api "javax.annotation:javax.annotation-api:${versionAnnotation}"
|
||||
api "io.github.openfeign:feign-core:9.4.0"
|
||||
api "io.github.openfeign:feign-jackson:9.4.0"
|
||||
compileOnly "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1"
|
||||
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.9'
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ public class ApiClient {
|
||||
})
|
||||
.encoder(new JacksonEncoder(objectMapper))
|
||||
.decoder(new JacksonDecoder(objectMapper));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ApiClient(String[] authNames) {
|
||||
|
||||
@@ -10,13 +10,11 @@ description = "Mowesta Android SDK"
|
||||
project.version = "unspecified"
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
targetSdkVersion 30
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
@@ -41,19 +39,14 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
api project(":android-feign")
|
||||
|
||||
implementation "androidx.appcompat:appcompat:${versionAndroidXAppcompat}"
|
||||
|
||||
implementation "androidx.preference:preference:${versionAndroidXPreference}"
|
||||
|
||||
implementation "androidx.room:room-runtime:${versionAndroidXRoom}"
|
||||
annotationProcessor "androidx.room:room-compiler:${versionAndroidXRoom}"
|
||||
testImplementation "androidx.room:room-testing:${versionAndroidXRoom}"
|
||||
|
||||
testImplementation "junit:junit:${versionJunit}"
|
||||
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
|
||||
testImplementation "androidx.test:core:${versionAndroidXTest}"
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
}
|
||||
@@ -557,7 +557,7 @@ public abstract class SdkService extends Service {
|
||||
* Performs the cleanup for the measurement task.
|
||||
*/
|
||||
private void cleanupMeasure() {
|
||||
measureTask.cancel(true);
|
||||
measureTask.cancel();
|
||||
measureTask = null;
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ public abstract class SdkService extends Service {
|
||||
* Cancels the cache lookup task.
|
||||
*/
|
||||
private void cleanupCache() {
|
||||
lookupTask.cancel(true);
|
||||
lookupTask.cancel();
|
||||
lookupTask = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* The base class for tasks. This is a drop in replacement for Android's async task,
|
||||
* which is now deprecated.
|
||||
*
|
||||
* @param <Result>
|
||||
*/
|
||||
public abstract class AbstractTask<Result> {
|
||||
|
||||
/**
|
||||
* The log tag of the task.
|
||||
*/
|
||||
private static final String TAG = "Task";
|
||||
|
||||
/**
|
||||
* The executor to execute a couple of tasks in parallel. We limit this to
|
||||
* 4 threads to avoid excessive sever loads.
|
||||
*/
|
||||
public static ExecutorService POOL_EXECUTOR = Executors.newFixedThreadPool(4);
|
||||
|
||||
/**
|
||||
* The executor used to run tasks sequentially. This is used to ensure that
|
||||
* tasks requiring a specific order will respect the scheduling order.
|
||||
*/
|
||||
public static ExecutorService SERIAL_EXECUTOR = Executors.newSingleThreadExecutor();
|
||||
|
||||
private static int counter = 0;
|
||||
|
||||
/**
|
||||
* A flag to indicate whether the execution will take place on the pooled
|
||||
* or on a serial executor.
|
||||
*/
|
||||
private final boolean pooled;
|
||||
|
||||
/**
|
||||
* The flag to determine whether the task is canceled.
|
||||
*/
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* A flag to prevent the duplicate task execution.
|
||||
*/
|
||||
private boolean executed;
|
||||
|
||||
/**
|
||||
* The handler to perform execution
|
||||
*/
|
||||
protected final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* Creates a new task executed on a serial executor.
|
||||
*/
|
||||
public AbstractTask() {
|
||||
this.pooled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new task that is running on a serial executor (false
|
||||
* or thred pool executor (true).
|
||||
*
|
||||
* @param pooled True to run the task on a thread pool, false to
|
||||
* run it on a serial executor.
|
||||
*/
|
||||
public AbstractTask(boolean pooled) {
|
||||
this.pooled = pooled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the execution will take place on a pool (true)
|
||||
* or on a serial executor (false).
|
||||
*
|
||||
* @return True for pooled execution, false for serial execution.
|
||||
*/
|
||||
public boolean isPooled() {
|
||||
return pooled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task on the executor.
|
||||
*/
|
||||
public void execute() {
|
||||
int c;
|
||||
synchronized (this) {
|
||||
counter += 1;
|
||||
c = counter;
|
||||
if (executed) throw new RuntimeException("Cannot execute task twice.");
|
||||
executed = true;
|
||||
}
|
||||
ExecutorService target = pooled?POOL_EXECUTOR:SERIAL_EXECUTOR;
|
||||
try {
|
||||
Log.v(TAG, "Schedule " + c + " (" + pooled + ")");
|
||||
target.execute(() -> {
|
||||
try {
|
||||
Log.v(TAG, "Running " + c);
|
||||
Result r = doInBackground();
|
||||
handler.post(() -> {
|
||||
try {
|
||||
onPostExecute(r);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Unexpected exception while executing post execute.", e);
|
||||
}
|
||||
});
|
||||
Log.v(TAG, "Completed " + c);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Unexpected exception while executing in background.", e);
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
Log.d(TAG, "Scheduling of task failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the canceled flag on the task, if not set already and
|
||||
* notifies the monitor associated with this object.
|
||||
*/
|
||||
public void cancel() {
|
||||
synchronized (this) {
|
||||
cancelled = true;
|
||||
this.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the task is canceled.
|
||||
*
|
||||
* @return True to cancel.
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
synchronized (this) {
|
||||
return cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The method that will be called on a background thread.
|
||||
*
|
||||
* @return The result value.
|
||||
*/
|
||||
protected abstract Result doInBackground();
|
||||
|
||||
/**
|
||||
* The method that wil be called.
|
||||
*
|
||||
* @param result The result.
|
||||
*/
|
||||
protected void onPostExecute(Result result) { }
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -14,7 +13,7 @@ import com.mowesta.android.sdk.database.BufferDatabase;
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class BufferTask extends AsyncTask<Void, Void, Void> {
|
||||
public class BufferTask extends AbstractTask<Void> {
|
||||
|
||||
/**
|
||||
* A listener that is called when the buffering is complete.
|
||||
@@ -58,20 +57,14 @@ public class BufferTask extends AsyncTask<Void, Void, Void> {
|
||||
* @param listener The listener to signal the completion.
|
||||
*/
|
||||
public BufferTask(@NonNull SdkRepository repository, @NonNull Measurement measurement, @NonNull OnCompletionListener listener) {
|
||||
super(true);
|
||||
this.repository = repository;
|
||||
this.measurement = measurement;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task on a thread pool.
|
||||
*/
|
||||
public void execute() {
|
||||
executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected Void doInBackground() {
|
||||
Log.d(TAG, "Buffering measurement in database.");
|
||||
BufferDatabase.Accessor database = repository.getBufferDatabase().getAccessor();
|
||||
database.insertMeasurement(measurement);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -16,7 +15,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class CacheTask extends AsyncTask<Void, Void, Void> {
|
||||
public class CacheTask extends AbstractTask<Void> {
|
||||
|
||||
/**
|
||||
* The log tag.
|
||||
@@ -46,21 +45,15 @@ public class CacheTask extends AsyncTask<Void, Void, Void> {
|
||||
* @param networks The networks.
|
||||
*/
|
||||
public CacheTask(@NonNull SdkRepository repository, @NonNull LocationEntity location, @NonNull List<NetworkEntity> networks) {
|
||||
super(true);
|
||||
this.repository = repository;
|
||||
this.location = location;
|
||||
this.networks = networks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task on the thread pool executor.
|
||||
*/
|
||||
public void execute() {
|
||||
executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected Void doInBackground() {
|
||||
try {
|
||||
Log.d(TAG, "Adding location " + location.getLongitude() + ", " + location.getLatitude() + " to cache.");
|
||||
repository.getCacheDatabase().getAccessor().insertLocation(location, networks);
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mowesta.android.sdk.SdkRepository;
|
||||
import com.mowesta.android.sdk.database.LocationEntity;
|
||||
import com.mowesta.android.sdk.database.NetworkEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A task that clears the location cache and optionally the buffer database.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class ClearTask extends AsyncTask<Void, Void, Void> {
|
||||
public class ClearTask extends AbstractTask<Void> {
|
||||
|
||||
/**
|
||||
* An interface to synchronize with the task completion.
|
||||
@@ -57,21 +52,15 @@ public class ClearTask extends AsyncTask<Void, Void, Void> {
|
||||
* @param completionListener The optional completion listener.
|
||||
*/
|
||||
public ClearTask(@NonNull SdkRepository repository, boolean withMeasurements, @Nullable OnCompletionListener completionListener) {
|
||||
super(false);
|
||||
this.repository = repository;
|
||||
this.completionListener = completionListener;
|
||||
this.measurements = withMeasurements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the task on the thread pool executor.
|
||||
*/
|
||||
public void execute() {
|
||||
executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected Void doInBackground() {
|
||||
Log.d(TAG, "Clearing the cache database.");
|
||||
repository.getCacheDatabase().getAccessor().clearAll();
|
||||
if (measurements) {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mowesta.android.sdk.SdkRepository;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -14,7 +11,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class ExpireTask extends AsyncTask<Void, Void, Void> {
|
||||
public class ExpireTask extends AbstractTask<Void> {
|
||||
|
||||
/**
|
||||
* The log tag.
|
||||
@@ -32,18 +29,12 @@ public class ExpireTask extends AsyncTask<Void, Void, Void> {
|
||||
* @param repository The repository.
|
||||
*/
|
||||
public ExpireTask(@NonNull SdkRepository repository) {
|
||||
super(true);
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the task on the thread pool.
|
||||
*/
|
||||
public void execute() {
|
||||
executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected Void doInBackground() {
|
||||
long now = System.currentTimeMillis();
|
||||
long expiration = repository.getConstants().MAXIMUM_CACHE_AGE;
|
||||
Log.d(TAG, "Expiring locations older than " + expiration + ".");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -20,7 +19,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class LookupTask extends AsyncTask<Void, Void, LocationEntity> {
|
||||
public class LookupTask extends AbstractTask<LocationEntity> {
|
||||
|
||||
/**
|
||||
* A listener to get the result.
|
||||
@@ -66,20 +65,15 @@ public class LookupTask extends AsyncTask<Void, Void, LocationEntity> {
|
||||
* @param listener The listener to get the result.
|
||||
*/
|
||||
public LookupTask(@NonNull SdkRepository repository, @NonNull List<NetworkEntity> networks, @NonNull OnCompletionListener listener) {
|
||||
super(true);
|
||||
this.repository = repository;
|
||||
this.networks = networks;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the task on the thread pool.
|
||||
*/
|
||||
public void execute() {
|
||||
executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LocationEntity doInBackground(Void... voids) {
|
||||
protected LocationEntity doInBackground() {
|
||||
Log.d(TAG, "Searching for cached location with " + networks.size() + " networks.");
|
||||
CacheDatabase.Accessor database = repository.getCacheDatabase().getAccessor();
|
||||
SdkConstants constants = repository.getConstants();
|
||||
|
||||
@@ -8,14 +8,11 @@ import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -38,7 +35,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
public class MeasureTask extends AbstractTask<Void> {
|
||||
|
||||
/**
|
||||
* A listener to receive the result.
|
||||
@@ -128,6 +125,7 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
* @param timeout The timeout.
|
||||
*/
|
||||
public MeasureTask(@NonNull Context context, long timeout, @NonNull OnCompletionListener listener) {
|
||||
super(true);
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
this.timeout = timeout;
|
||||
@@ -139,9 +137,7 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
public void execute() {
|
||||
start = SystemClock.elapsedRealtime();
|
||||
readBattery();
|
||||
System.out.println("Battery");
|
||||
readScreen();
|
||||
System.out.println("Screen");
|
||||
// add sensor listeners
|
||||
SensorManager manager = (SensorManager)context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
|
||||
if (manager != null) {
|
||||
@@ -149,8 +145,7 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
registerSensor(manager, Sensor.TYPE_PRESSURE, "SENSOR_PRESSURE");
|
||||
registerSensor(manager, Sensor.TYPE_RELATIVE_HUMIDITY, "SENSOR_HUMIDITY");
|
||||
}
|
||||
System.out.println("Manager");
|
||||
this.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
super.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +244,7 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected Void doInBackground() {
|
||||
// read files in background thread since io may take some time
|
||||
List<Double> cpuFrequency = readCpuData(CPU_FREQUENCY);
|
||||
List<Double> cpuTemperature = readCpuData(CPU_TEMPERATURE);
|
||||
@@ -277,6 +272,14 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
super.cancel();
|
||||
synchronized (running) {
|
||||
running.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a double array to a string.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mowesta.android.sdk.task;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -24,7 +23,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class UploadTask extends AsyncTask<Void, Void, Void> {
|
||||
public class UploadTask extends AbstractTask<Void> {
|
||||
|
||||
/**
|
||||
* The task that performs the upload of measurement data.
|
||||
@@ -63,6 +62,7 @@ public class UploadTask extends AsyncTask<Void, Void, Void> {
|
||||
* @param client The api client to use.
|
||||
*/
|
||||
public UploadTask(@NonNull SdkRepository repository, @NonNull DefaultApi client) {
|
||||
super(true);
|
||||
this.repository = repository;
|
||||
this.client = client;
|
||||
}
|
||||
@@ -81,14 +81,14 @@ public class UploadTask extends AsyncTask<Void, Void, Void> {
|
||||
wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, TAG);
|
||||
if (wifiLock != null) wifiLock.acquire();
|
||||
repository.setUploading(true);
|
||||
super.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
super.execute();
|
||||
} else {
|
||||
Log.d(TAG, "Ignoring upload trigger, since upload is running already.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
protected Void doInBackground() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
BufferDatabase.Accessor database = repository.getBufferDatabase().getAccessor();
|
||||
|
||||
@@ -0,0 +1,480 @@
|
||||
#define ARDUINOJSON_USE_LONG_LONG 1
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <EEPROM.h>
|
||||
#include "Adafruit_Sensor.h"
|
||||
#include "Adafruit_BME280.h"
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
// Hardware setup
|
||||
#define BUTTON_PIN D5
|
||||
#define VOLTAGE_PIN A0
|
||||
#define VOLTAGE_MULTIPLIER 11
|
||||
#define VOLTAGE_DIVIDER 255.0
|
||||
#define EEPROM_SIZE 512
|
||||
#define BUTTON_OUT D7
|
||||
#define BME_OUT D6
|
||||
#define VOLTAGE_OUT D8
|
||||
|
||||
//Credentials for the Access Point
|
||||
#define WLAN_AP_SSID "MoWeSta - WiFi"
|
||||
#define WLAN_AP_PASSWORD "mowesta123456wifi"
|
||||
|
||||
// API-URL where measurements will be uploaded to
|
||||
#define MOWESTA_UPLOAD_URL "https://www.mowesta.com/api/devices/current/measurements/now"
|
||||
// #define MOWESTA_UPLOAD_URL "https://beta.mowesta.com/api/devices/current/measurements/now"
|
||||
#define MOWESTA_SOFTWARE_VERSION 2
|
||||
|
||||
// memory for json document
|
||||
#define JSON_BUFFER_SIZE 1000
|
||||
|
||||
// deep sleep period between measurements (us = 1e-6)
|
||||
#define DEEP_SLEEP_PERIOD 600000000
|
||||
// timeout to wait for the wifi connection in ms
|
||||
#define TIMEOUT_WIFI 20000
|
||||
// timeout to wait for the ntp sync in ms
|
||||
#define TIMEOUT_NTP 20000
|
||||
// timeout to wait for the setup data in sec
|
||||
#define TIMEOUT_READ 40
|
||||
|
||||
// Let's encrypt root cert (valid until June 4, 2035)
|
||||
const char certificate_anchors[] PROGMEM = R"EOF(
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
||||
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
||||
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
||||
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
||||
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
||||
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
||||
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
||||
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
|
||||
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
|
||||
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
|
||||
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
|
||||
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
|
||||
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
|
||||
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
|
||||
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
|
||||
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
|
||||
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
||||
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
||||
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
||||
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
||||
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
||||
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
||||
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
||||
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
||||
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
||||
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
||||
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
||||
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
||||
-----END CERTIFICATE-----
|
||||
)EOF";
|
||||
X509List certificates(certificate_anchors);
|
||||
|
||||
// Access point config
|
||||
IPAddress ip_address_local(192, 168, 4, 1);
|
||||
IPAddress ip_address_gateway(192, 168, 4, 1);
|
||||
IPAddress ip_subnet_mask(255, 255, 255, 0);
|
||||
WiFiServer wifi_server(8080);
|
||||
|
||||
// Variables set to data values received from the app
|
||||
String* setting_wlan_ssid;
|
||||
String* setting_wlan_password;
|
||||
String* setting_device_id;
|
||||
String* setting_device_token;
|
||||
String* setting_longitude;
|
||||
String* setting_latitude;
|
||||
|
||||
// Flag to store mode
|
||||
bool mode_setup = false;
|
||||
|
||||
// Store boot time for timeout
|
||||
long time_boot;
|
||||
|
||||
// Sensor to gather measurements
|
||||
Adafruit_BME280 sensor_bme;
|
||||
|
||||
// eeprom reading and writing
|
||||
void eeprom_write_string(int* add, String* data);
|
||||
String* eeprom_read_string(int* add);
|
||||
|
||||
// settings reading, writing, printing and validation
|
||||
void settings_read();
|
||||
void settings_write();
|
||||
void settings_print();
|
||||
bool settings_valid();
|
||||
|
||||
|
||||
// device setup via mobile app or netcat
|
||||
bool setup_process_connection(WiFiClient*);
|
||||
bool setup_process_data(String);
|
||||
|
||||
// measurement and upload
|
||||
void measurement_capture();
|
||||
|
||||
void setup() {
|
||||
//Open serial port to display data and set baudrate
|
||||
Serial.begin(115200);
|
||||
// Wait for serial port to be initialized
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
|
||||
// power the voltage divider
|
||||
pinMode(VOLTAGE_OUT, OUTPUT);
|
||||
digitalWrite(VOLTAGE_OUT, LOW);
|
||||
// power the bme sensor
|
||||
pinMode(BME_OUT, OUTPUT);
|
||||
digitalWrite(BME_OUT, LOW);
|
||||
// power the button
|
||||
pinMode(BUTTON_OUT, OUTPUT);
|
||||
digitalWrite(BUTTON_OUT, LOW);
|
||||
|
||||
// Initialize EEPROM with complete size
|
||||
// Configure the button to enter setup
|
||||
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||
// Configure the LED to indicate setup
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
// Read the settings from eeprom
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
settings_read();
|
||||
// Check if button is pressed to enter setup
|
||||
mode_setup = (digitalRead(BUTTON_PIN) == LOW);
|
||||
time_boot = millis();
|
||||
if (mode_setup) {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
Serial.println("Entering setup mode.");
|
||||
WiFi.softAPConfig(ip_address_local, ip_address_gateway, ip_subnet_mask);
|
||||
WiFi.softAP(WLAN_AP_SSID, WLAN_AP_PASSWORD);
|
||||
IPAddress ip_address = WiFi.softAPIP();
|
||||
Serial.print("IP address is: '");
|
||||
Serial.print(ip_address);
|
||||
Serial.println("'");
|
||||
wifi_server.begin();
|
||||
} else if (settings_valid()){
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
Serial.print("Connecting to WiFi network '");
|
||||
Serial.print(*setting_wlan_ssid);
|
||||
Serial.println("'");
|
||||
WiFi.begin(setting_wlan_ssid->c_str(), setting_wlan_password->c_str());
|
||||
} else {
|
||||
Serial.println("Invalid settings, setup required.");
|
||||
settings_print();
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (mode_setup) {
|
||||
// setup mode, keeps handling incoming clients until successful setup
|
||||
WiFiClient client = wifi_server.available();
|
||||
if (client) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
if (setup_process_connection(&client)) {
|
||||
WiFi.softAPdisconnect(true);
|
||||
delay(5000);
|
||||
ESP.restart();
|
||||
} else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
}
|
||||
} else if (settings_valid()) {
|
||||
// measurement mode, captures and uploads a measurement when wifi is up
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
if (sensor_bme.begin(0x76)) {
|
||||
measurement_capture();
|
||||
} else {
|
||||
Serial.println("Failed to activate sensor.");
|
||||
}
|
||||
WiFi.disconnect();
|
||||
delay(1000);
|
||||
Serial.end();
|
||||
ESP.deepSleep(DEEP_SLEEP_PERIOD);
|
||||
} else {
|
||||
// check for excessive waiting time
|
||||
long time_now = millis();
|
||||
long time_delta = (time_now > time_boot) ? (time_now - time_boot) : time_boot - time_now;
|
||||
if (time_delta > TIMEOUT_WIFI) {
|
||||
Serial.println("Failed to activate wifi.");
|
||||
WiFi.disconnect();
|
||||
delay(1000);
|
||||
Serial.end();
|
||||
ESP.deepSleep(DEEP_SLEEP_PERIOD);
|
||||
}
|
||||
delay(500);
|
||||
}
|
||||
} else {
|
||||
// blink to indicate missing config
|
||||
for(int i = 0; i < 10; i++){
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
delay(50);
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
delay(50);
|
||||
}
|
||||
Serial.end();
|
||||
ESP.deepSleep(DEEP_SLEEP_PERIOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Writes a String in EEPROM memory starting at a defined address.
|
||||
*
|
||||
* @param add In/out parameter with the address.
|
||||
* @param data The string to write.
|
||||
*/
|
||||
void eeprom_write_string(int* add, String* data) {
|
||||
int s = data->length();
|
||||
if (*add + s + 1 < EEPROM_SIZE) {
|
||||
for (int i = 0; i < s; i++) {
|
||||
EEPROM.write(*add + i, (*data)[i]);
|
||||
}
|
||||
EEPROM.write(*add + s, '\0');
|
||||
}
|
||||
*add += s + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a String from EEPROM memory starting at a defined address.
|
||||
* Reads until a terminating null character.
|
||||
*
|
||||
* @param add In/out parameter with the address.
|
||||
* @return A pointer to the string.
|
||||
*/
|
||||
String* eeprom_read_string(int* add) {
|
||||
char data[EEPROM_SIZE + 1];
|
||||
int limit = EEPROM_SIZE - *add;
|
||||
limit = limit < 0 ? 0 : limit;
|
||||
int len = 0;
|
||||
unsigned char k;
|
||||
if (limit > 0) {
|
||||
k = EEPROM.read(*add);
|
||||
while (k != '\0' && len < limit)
|
||||
{
|
||||
k = EEPROM.read(*add + len);
|
||||
data[len] = k;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
data[len] = '\0';
|
||||
*add += len;
|
||||
return new String(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the settings from the eeprom to memory.
|
||||
*/
|
||||
void settings_read() {
|
||||
int address = 0;
|
||||
setting_wlan_ssid = eeprom_read_string(&address);
|
||||
setting_wlan_password = eeprom_read_string(&address);
|
||||
setting_device_id = eeprom_read_string(&address);
|
||||
setting_device_token = eeprom_read_string(&address);
|
||||
setting_longitude = eeprom_read_string(&address);
|
||||
setting_latitude = eeprom_read_string(&address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the settings from memory to the eeprom.
|
||||
*/
|
||||
void settings_write() {
|
||||
int address = 0;
|
||||
eeprom_write_string(&address, setting_wlan_ssid);
|
||||
eeprom_write_string(&address, setting_wlan_password);
|
||||
eeprom_write_string(&address, setting_device_id);
|
||||
eeprom_write_string(&address, setting_device_token);
|
||||
eeprom_write_string(&address, setting_longitude);
|
||||
eeprom_write_string(&address, setting_latitude);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the settings onto the serial console.
|
||||
*/
|
||||
void settings_print() {
|
||||
Serial.print("WLAN SSID: ");
|
||||
Serial.println(*setting_wlan_ssid);
|
||||
Serial.print("WLAN Password: ");
|
||||
Serial.println(*setting_wlan_password);
|
||||
Serial.print("Device ID: ");
|
||||
Serial.println(*setting_device_id);
|
||||
Serial.print("Device Token: ");
|
||||
Serial.println(*setting_device_token);
|
||||
Serial.print("Longitude: ");
|
||||
Serial.println(*setting_longitude);
|
||||
Serial.print("Latitude: ");
|
||||
Serial.println(*setting_latitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the settings are valid. This is
|
||||
* done by making sure that every string has a non-zero length.
|
||||
*
|
||||
* @return True if the settings are valid, false otherwise.
|
||||
*/
|
||||
bool settings_valid() {
|
||||
return setting_wlan_ssid->length() > 0 &&
|
||||
setting_wlan_password->length() > 0 &&
|
||||
setting_device_id->length() > 0 &&
|
||||
setting_device_token->length() > 0 &&
|
||||
setting_longitude->length() > 0 &&
|
||||
setting_latitude->length() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the client data and stores the relevant information in flash memory.
|
||||
* It is assumed that the client data is in json format.
|
||||
*
|
||||
* @param data The data received from the client.
|
||||
* @return True if the data seems ok and has been stored to flash, false otherwise.
|
||||
*/
|
||||
bool setup_process_data(String data) {
|
||||
StaticJsonDocument<JSON_BUFFER_SIZE> doc; //Memory pool
|
||||
Serial.print("Received settings: ");
|
||||
Serial.println(data);
|
||||
DeserializationError error = deserializeJson(doc, data);
|
||||
if (error) {
|
||||
Serial.print("Deserialization failed with code ");
|
||||
Serial.println(error.c_str());
|
||||
return false;
|
||||
} else {
|
||||
delete setting_wlan_ssid;
|
||||
delete setting_wlan_password;
|
||||
delete setting_device_id;
|
||||
delete setting_device_token;
|
||||
delete setting_longitude;
|
||||
delete setting_latitude;
|
||||
setting_wlan_ssid = new String(doc["ssid"]);
|
||||
setting_wlan_password = new String(doc["password"]);
|
||||
setting_device_id = new String(doc["id"]);
|
||||
setting_device_token = new String(doc["token"]);
|
||||
setting_longitude = new String(doc["longitude"]);
|
||||
setting_latitude = new String(doc["latitude"]);
|
||||
settings_print();
|
||||
if (settings_valid()) {
|
||||
Serial.println("Storing valid settings.");
|
||||
settings_write();
|
||||
return true;
|
||||
} else {
|
||||
Serial.println("Ignoring invalid settings.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs the setup data exchange with the app and returns
|
||||
* whether the arduino has successfully received a new configuration.
|
||||
*
|
||||
* @param client The wifi client that represents the connection.
|
||||
* @return True if the setup data has been retrieved successfully.
|
||||
*/
|
||||
bool setup_process_connection(WiFiClient *client) {
|
||||
Serial.println("Client connection established.");
|
||||
String data = "";
|
||||
bool didRead = true;
|
||||
client->setTimeout(TIMEOUT_READ);
|
||||
while (client->connected() && didRead) {
|
||||
String chunk = client->readStringUntil('\n');
|
||||
didRead = chunk.length() > 0; // if line is empty, break immediately
|
||||
data += chunk;
|
||||
}
|
||||
if (data.length() > 0) {
|
||||
if(setup_process_data(data)) {
|
||||
client->println("Success\n"); // Notify client
|
||||
client->flush();
|
||||
// Wait for client to close connection, since we will
|
||||
// be disabling the accesspoint directly afterwards
|
||||
while (client->connected());
|
||||
client->stop();
|
||||
Serial.println("Success, client disconnected.");
|
||||
return true;
|
||||
} else {
|
||||
client->println("Error\n"); //Notify client
|
||||
client->flush();
|
||||
client->stop();
|
||||
Serial.println("Error, client disconnected.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
client->println("Timeout\n"); //Notify client
|
||||
client->flush();
|
||||
client->stop();
|
||||
Serial.println("Timeout, client disconnected.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Synchronizes the time with an ntp server, captures a measurement,
|
||||
* generates a json document and uploads it to the mowesta backend.
|
||||
*/
|
||||
void measurement_capture() {
|
||||
WiFiClientSecure wifi;
|
||||
HTTPClient http;
|
||||
StaticJsonDocument<JSON_BUFFER_SIZE> doc;
|
||||
|
||||
// set trusted root certificates and perform ntp time sync for https
|
||||
configTime(0, 0, "time2-1.uni-duisburg-essen.de", "time2-3.uni-duisburg-essen.de", "pool.ntp.org");
|
||||
Serial.print("Waiting for NTP time sync: ");
|
||||
time_t now = time(nullptr);
|
||||
// check that time is after January 1st, 2021
|
||||
int max_wait = TIMEOUT_NTP;
|
||||
while (now < 1606694400) {
|
||||
if (max_wait < 0) {
|
||||
Serial.println("Timeout");
|
||||
return;
|
||||
}
|
||||
delay(500);
|
||||
max_wait -= 500;
|
||||
now = time(nullptr);
|
||||
}
|
||||
Serial.println(now);
|
||||
wifi.setTrustAnchors(&certificates);
|
||||
|
||||
// create json document for upload
|
||||
doc["id"] = 0;
|
||||
doc["creationTime"] = 0;
|
||||
doc["modificationTime"] = 0;
|
||||
doc["deleted"] = "false";
|
||||
JsonObject coordinate = doc.createNestedObject("coordinate");
|
||||
coordinate["latitude"] = setting_latitude->toDouble();
|
||||
coordinate["longitude"] = setting_longitude->toDouble();
|
||||
doc["time"] = now * 1000;
|
||||
doc["device"] = atol(setting_device_id->c_str());
|
||||
doc["version"] = MOWESTA_SOFTWARE_VERSION;
|
||||
doc["temperature"] = (char*)0;
|
||||
doc["pressure"] = (char*)0;
|
||||
doc["humidity"] = (char*)0;
|
||||
JsonObject data = doc.createNestedObject("data");
|
||||
data["SENSOR_TEMPERATURE"] = String(sensor_bme.readTemperature());
|
||||
data["SENSOR_PRESSURE"] = String(sensor_bme.readPressure() / 100);
|
||||
data["SENSOR_HUMIDITY"] = String(sensor_bme.readHumidity());
|
||||
data["BATTERY_VOLTAGE"] = String((analogRead(VOLTAGE_PIN) / VOLTAGE_DIVIDER) * VOLTAGE_MULTIPLIER);
|
||||
|
||||
// print measurement
|
||||
serializeJsonPretty(doc, Serial);
|
||||
Serial.println();
|
||||
|
||||
// upload measurement
|
||||
String body;
|
||||
serializeJson(doc, body);
|
||||
http.begin(wifi, MOWESTA_UPLOAD_URL);
|
||||
http.addHeader("Accept", "application/json");
|
||||
http.addHeader("Authorization", "Bearer " + *setting_device_token);
|
||||
http.addHeader("Content-Type", "application/json");
|
||||
int code = http.POST(body);
|
||||
if (code / 100 == 2) {
|
||||
Serial.println("Upload successful.");
|
||||
} else {
|
||||
Serial.print("Upload failed: ");
|
||||
Serial.println(code);
|
||||
}
|
||||
http.end();
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
#define ARDUINOJSON_USE_LONG_LONG 1
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <EEPROM.h>
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
// Hardware setup
|
||||
#define BUTTON_PIN D5
|
||||
#define VOLTAGE_PIN A0
|
||||
#define VOLTAGE_MULTIPLIER 11
|
||||
#define VOLTAGE_DIVIDER 255.0
|
||||
#define EEPROM_SIZE 512
|
||||
#define BUTTON_OUT D7
|
||||
#define EXTERNAL_OUT D8
|
||||
|
||||
//Credentials for the Access Point
|
||||
#define WLAN_AP_SSID "MoWeSta - WiFi"
|
||||
#define WLAN_AP_PASSWORD "mowesta123456wifi"
|
||||
|
||||
// API-URL where measurements will be uploaded to
|
||||
//#define MOWESTA_UPLOAD_URL "https://www.mowesta.com/api/devices/current/measurements/now"
|
||||
#define MOWESTA_UPLOAD_URL "https://beta.mowesta.com/api/devices/current/measurements/now"
|
||||
#define MOWESTA_SOFTWARE_VERSION 2
|
||||
|
||||
// memory for json document
|
||||
#define JSON_BUFFER_SIZE 1000
|
||||
|
||||
// deep sleep period between measurements (us = 1e-6)
|
||||
#define DEEP_SLEEP_PERIOD 600000000
|
||||
// timeout to wait for the wifi connection in ms
|
||||
#define TIMEOUT_WIFI 20000
|
||||
// timeout to wait for the ntp sync in ms
|
||||
#define TIMEOUT_NTP 20000
|
||||
// timeout to wait for the setup data in sec
|
||||
#define TIMEOUT_READ 40
|
||||
|
||||
// Let's encrypt root cert (valid until June 4, 2035)
|
||||
const char certificate_anchors[] PROGMEM = R"EOF(
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
||||
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
||||
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
||||
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
||||
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
||||
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
||||
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
||||
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
|
||||
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
|
||||
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
|
||||
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
|
||||
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
|
||||
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
|
||||
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
|
||||
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
|
||||
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
|
||||
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
||||
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
||||
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
||||
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
||||
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
||||
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
||||
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
||||
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
||||
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
||||
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
||||
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
||||
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
||||
-----END CERTIFICATE-----
|
||||
)EOF";
|
||||
X509List certificates(certificate_anchors);
|
||||
|
||||
// Access point config
|
||||
IPAddress ip_address_local(192, 168, 4, 1);
|
||||
IPAddress ip_address_gateway(192, 168, 4, 1);
|
||||
IPAddress ip_subnet_mask(255, 255, 255, 0);
|
||||
WiFiServer wifi_server(8080);
|
||||
|
||||
// Variables set to data values received from the app
|
||||
String* setting_wlan_ssid;
|
||||
String* setting_wlan_password;
|
||||
String* setting_device_id;
|
||||
String* setting_device_token;
|
||||
String* setting_longitude;
|
||||
String* setting_latitude;
|
||||
|
||||
// Flag to store mode
|
||||
bool mode_setup = false;
|
||||
|
||||
// Store boot time for timeout
|
||||
long time_boot;
|
||||
|
||||
// Sensor to gather measurements
|
||||
Adafruit_BMP280 sensor_bmp;
|
||||
|
||||
// eeprom reading and writing
|
||||
void eeprom_write_string(int* add, String* data);
|
||||
String* eeprom_read_string(int* add);
|
||||
|
||||
// settings reading, writing, printing and validation
|
||||
void settings_read();
|
||||
void settings_write();
|
||||
void settings_print();
|
||||
bool settings_valid();
|
||||
|
||||
|
||||
// device setup via mobile app or netcat
|
||||
bool setup_process_connection(WiFiClient*);
|
||||
bool setup_process_data(String);
|
||||
|
||||
// measurement and upload
|
||||
void measurement_capture();
|
||||
|
||||
void setup() {
|
||||
//Open serial port to display data and set baudrate
|
||||
Serial.begin(115200);
|
||||
// Wait for serial port to be initialized
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
// power the button, voltage divider and sensor
|
||||
pinMode(BUTTON_OUT, OUTPUT);
|
||||
digitalWrite(BUTTON_OUT, LOW);
|
||||
pinMode(EXTERNAL_OUT, OUTPUT);
|
||||
digitalWrite(EXTERNAL_OUT, LOW);
|
||||
// Initialize EEPROM with complete size
|
||||
// Configure the button to enter setup
|
||||
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||
// Configure the LED to indicate setup
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
// Read the settings from eeprom
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
settings_read();
|
||||
// Check if button is pressed to enter setup
|
||||
mode_setup = (digitalRead(BUTTON_PIN) == LOW);
|
||||
time_boot = millis();
|
||||
if (mode_setup) {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
Serial.println("Entering setup mode.");
|
||||
WiFi.softAPConfig(ip_address_local, ip_address_gateway, ip_subnet_mask);
|
||||
WiFi.softAP(WLAN_AP_SSID, WLAN_AP_PASSWORD);
|
||||
IPAddress ip_address = WiFi.softAPIP();
|
||||
Serial.print("IP address is: '");
|
||||
Serial.print(ip_address);
|
||||
Serial.println("'");
|
||||
wifi_server.begin();
|
||||
} else if (settings_valid()){
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
Serial.print("Connecting to WiFi network '");
|
||||
Serial.print(*setting_wlan_ssid);
|
||||
Serial.println("'");
|
||||
WiFi.begin(setting_wlan_ssid->c_str(), setting_wlan_password->c_str());
|
||||
} else {
|
||||
Serial.println("Invalid settings, setup required.");
|
||||
settings_print();
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (mode_setup) {
|
||||
// setup mode, keeps handling incoming clients until successful setup
|
||||
WiFiClient client = wifi_server.available();
|
||||
if (client) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
if (setup_process_connection(&client)) {
|
||||
WiFi.softAPdisconnect(true);
|
||||
delay(5000);
|
||||
ESP.restart();
|
||||
} else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
}
|
||||
} else if (settings_valid()) {
|
||||
// measurement mode, captures and uploads a measurement when wifi is up
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
if (sensor_bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID)) {
|
||||
// Setup with default settings from datasheet.
|
||||
sensor_bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, // Operating Mode.
|
||||
Adafruit_BMP280::SAMPLING_X2, // Temp. oversampling
|
||||
Adafruit_BMP280::SAMPLING_X16, // Pressure oversampling
|
||||
Adafruit_BMP280::FILTER_X16, // Filtering.
|
||||
Adafruit_BMP280::STANDBY_MS_500); // Standby time.
|
||||
measurement_capture();
|
||||
} else {
|
||||
Serial.println("Failed to activate sensor.");
|
||||
}
|
||||
WiFi.disconnect();
|
||||
delay(1000);
|
||||
Serial.end();
|
||||
ESP.deepSleep(DEEP_SLEEP_PERIOD);
|
||||
} else {
|
||||
// check for excessive waiting time
|
||||
long time_now = millis();
|
||||
long time_delta = (time_now > time_boot) ? (time_now - time_boot) : time_boot - time_now;
|
||||
if (time_delta > TIMEOUT_WIFI) {
|
||||
Serial.println("Failed to activate wifi.");
|
||||
WiFi.disconnect();
|
||||
delay(1000);
|
||||
Serial.end();
|
||||
ESP.deepSleep(DEEP_SLEEP_PERIOD);
|
||||
}
|
||||
delay(500);
|
||||
}
|
||||
} else {
|
||||
// blink to indicate missing config
|
||||
for(int i = 0; i < 10; i++){
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
delay(50);
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
delay(50);
|
||||
}
|
||||
Serial.end();
|
||||
ESP.deepSleep(DEEP_SLEEP_PERIOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Writes a String in EEPROM memory starting at a defined address.
|
||||
*
|
||||
* @param add In/out parameter with the address.
|
||||
* @param data The string to write.
|
||||
*/
|
||||
void eeprom_write_string(int* add, String* data) {
|
||||
int s = data->length();
|
||||
if (*add + s + 1 < EEPROM_SIZE) {
|
||||
for (int i = 0; i < s; i++) {
|
||||
EEPROM.write(*add + i, (*data)[i]);
|
||||
}
|
||||
EEPROM.write(*add + s, '\0');
|
||||
}
|
||||
*add += s + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a String from EEPROM memory starting at a defined address.
|
||||
* Reads until a terminating null character.
|
||||
*
|
||||
* @param add In/out parameter with the address.
|
||||
* @return A pointer to the string.
|
||||
*/
|
||||
String* eeprom_read_string(int* add) {
|
||||
char data[EEPROM_SIZE + 1];
|
||||
int limit = EEPROM_SIZE - *add;
|
||||
limit = limit < 0 ? 0 : limit;
|
||||
int len = 0;
|
||||
unsigned char k;
|
||||
if (limit > 0) {
|
||||
k = EEPROM.read(*add);
|
||||
while (k != '\0' && len < limit)
|
||||
{
|
||||
k = EEPROM.read(*add + len);
|
||||
data[len] = k;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
data[len] = '\0';
|
||||
*add += len;
|
||||
return new String(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the settings from the eeprom to memory.
|
||||
*/
|
||||
void settings_read() {
|
||||
int address = 0;
|
||||
setting_wlan_ssid = eeprom_read_string(&address);
|
||||
setting_wlan_password = eeprom_read_string(&address);
|
||||
setting_device_id = eeprom_read_string(&address);
|
||||
setting_device_token = eeprom_read_string(&address);
|
||||
setting_longitude = eeprom_read_string(&address);
|
||||
setting_latitude = eeprom_read_string(&address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the settings from memory to the eeprom.
|
||||
*/
|
||||
void settings_write() {
|
||||
int address = 0;
|
||||
eeprom_write_string(&address, setting_wlan_ssid);
|
||||
eeprom_write_string(&address, setting_wlan_password);
|
||||
eeprom_write_string(&address, setting_device_id);
|
||||
eeprom_write_string(&address, setting_device_token);
|
||||
eeprom_write_string(&address, setting_longitude);
|
||||
eeprom_write_string(&address, setting_latitude);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the settings onto the serial console.
|
||||
*/
|
||||
void settings_print() {
|
||||
Serial.print("WLAN SSID: ");
|
||||
Serial.println(*setting_wlan_ssid);
|
||||
Serial.print("WLAN Password: ");
|
||||
Serial.println(*setting_wlan_password);
|
||||
Serial.print("Device ID: ");
|
||||
Serial.println(*setting_device_id);
|
||||
Serial.print("Device Token: ");
|
||||
Serial.println(*setting_device_token);
|
||||
Serial.print("Longitude: ");
|
||||
Serial.println(*setting_longitude);
|
||||
Serial.print("Latitude: ");
|
||||
Serial.println(*setting_latitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the settings are valid. This is
|
||||
* done by making sure that every string has a non-zero length.
|
||||
*
|
||||
* @return True if the settings are valid, false otherwise.
|
||||
*/
|
||||
bool settings_valid() {
|
||||
return setting_wlan_ssid->length() > 0 &&
|
||||
setting_wlan_password->length() > 0 &&
|
||||
setting_device_id->length() > 0 &&
|
||||
setting_device_token->length() > 0 &&
|
||||
setting_longitude->length() > 0 &&
|
||||
setting_latitude->length() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the client data and stores the relevant information in flash memory.
|
||||
* It is assumed that the client data is in json format.
|
||||
*
|
||||
* @param data The data received from the client.
|
||||
* @return True if the data seems ok and has been stored to flash, false otherwise.
|
||||
*/
|
||||
bool setup_process_data(String data) {
|
||||
StaticJsonDocument<JSON_BUFFER_SIZE> doc; //Memory pool
|
||||
Serial.print("Received settings: ");
|
||||
Serial.println(data);
|
||||
DeserializationError error = deserializeJson(doc, data);
|
||||
if (error) {
|
||||
Serial.print("Deserialization failed with code ");
|
||||
Serial.println(error.c_str());
|
||||
return false;
|
||||
} else {
|
||||
delete setting_wlan_ssid;
|
||||
delete setting_wlan_password;
|
||||
delete setting_device_id;
|
||||
delete setting_device_token;
|
||||
delete setting_longitude;
|
||||
delete setting_latitude;
|
||||
setting_wlan_ssid = new String(doc["ssid"]);
|
||||
setting_wlan_password = new String(doc["password"]);
|
||||
setting_device_id = new String(doc["id"]);
|
||||
setting_device_token = new String(doc["token"]);
|
||||
setting_longitude = new String(doc["longitude"]);
|
||||
setting_latitude = new String(doc["latitude"]);
|
||||
settings_print();
|
||||
if (settings_valid()) {
|
||||
Serial.println("Storing valid settings.");
|
||||
settings_write();
|
||||
return true;
|
||||
} else {
|
||||
Serial.println("Ignoring invalid settings.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs the setup data exchange with the app and returns
|
||||
* whether the arduino has successfully received a new configuration.
|
||||
*
|
||||
* @param client The wifi client that represents the connection.
|
||||
* @return True if the setup data has been retrieved successfully.
|
||||
*/
|
||||
bool setup_process_connection(WiFiClient *client) {
|
||||
Serial.println("Client connection established.");
|
||||
String data = "";
|
||||
bool didRead = true;
|
||||
client->setTimeout(TIMEOUT_READ);
|
||||
while (client->connected() && didRead) {
|
||||
String chunk = client->readStringUntil('\n');
|
||||
didRead = chunk.length() > 0; // if line is empty, break immediately
|
||||
data += chunk;
|
||||
}
|
||||
if (data.length() > 0) {
|
||||
if(setup_process_data(data)) {
|
||||
client->println("Success\n"); // Notify client
|
||||
client->flush();
|
||||
// Wait for client to close connection, since we will
|
||||
// be disabling the accesspoint directly afterwards
|
||||
while (client->connected());
|
||||
client->stop();
|
||||
Serial.println("Success, client disconnected.");
|
||||
return true;
|
||||
} else {
|
||||
client->println("Error\n"); //Notify client
|
||||
client->flush();
|
||||
client->stop();
|
||||
Serial.println("Error, client disconnected.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
client->println("Timeout\n"); //Notify client
|
||||
client->flush();
|
||||
client->stop();
|
||||
Serial.println("Timeout, client disconnected.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Synchronizes the time with an ntp server, captures a measurement,
|
||||
* generates a json document and uploads it to the mowesta backend.
|
||||
*/
|
||||
void measurement_capture() {
|
||||
WiFiClientSecure wifi;
|
||||
HTTPClient http;
|
||||
StaticJsonDocument<JSON_BUFFER_SIZE> doc;
|
||||
sensors_event_t temperature_event, pressure_event;
|
||||
|
||||
// set trusted root certificates and perform ntp time sync for https
|
||||
configTime(0, 0, "time2-1.uni-duisburg-essen.de", "time2-3.uni-duisburg-essen.de", "pool.ntp.org");
|
||||
Serial.print("Waiting for NTP time sync: ");
|
||||
time_t now = time(nullptr);
|
||||
// check that time is after January 1st, 2021
|
||||
int max_wait = TIMEOUT_NTP;
|
||||
while (now < 1606694400) {
|
||||
if (max_wait < 0) {
|
||||
Serial.println("Timeout");
|
||||
return;
|
||||
}
|
||||
delay(500);
|
||||
max_wait -= 500;
|
||||
now = time(nullptr);
|
||||
}
|
||||
Serial.println(now);
|
||||
wifi.setTrustAnchors(&certificates);
|
||||
|
||||
// capture sensor data
|
||||
sensor_bmp.getTemperatureSensor()->getEvent(&temperature_event);
|
||||
sensor_bmp.getPressureSensor()->getEvent(&pressure_event);
|
||||
|
||||
// create json document for upload
|
||||
doc["id"] = 0;
|
||||
doc["creationTime"] = 0;
|
||||
doc["modificationTime"] = 0;
|
||||
doc["deleted"] = "false";
|
||||
JsonObject coordinate = doc.createNestedObject("coordinate");
|
||||
coordinate["latitude"] = setting_latitude->toDouble();
|
||||
coordinate["longitude"] = setting_longitude->toDouble();
|
||||
doc["time"] = now * 1000;
|
||||
doc["device"] = atol(setting_device_id->c_str());
|
||||
doc["version"] = MOWESTA_SOFTWARE_VERSION;
|
||||
doc["temperature"] = (char*)0;
|
||||
doc["pressure"] = (char*)0;
|
||||
doc["humidity"] = (char*)0;
|
||||
JsonObject data = doc.createNestedObject("data");
|
||||
data["SENSOR_TEMPERATURE"] = String(temperature_event.temperature);
|
||||
data["SENSOR_PRESSURE"] = String(pressure_event.pressure);
|
||||
data["BATTERY_VOLTAGE"] = String((analogRead(VOLTAGE_PIN) / VOLTAGE_DIVIDER) * VOLTAGE_MULTIPLIER);
|
||||
|
||||
// print measurement
|
||||
serializeJsonPretty(doc, Serial);
|
||||
Serial.println();
|
||||
|
||||
// upload measurement
|
||||
String body;
|
||||
serializeJson(doc, body);
|
||||
http.begin(wifi, MOWESTA_UPLOAD_URL);
|
||||
http.addHeader("Accept", "application/json");
|
||||
http.addHeader("Authorization", "Bearer " + *setting_device_token);
|
||||
http.addHeader("Content-Type", "application/json");
|
||||
int code = http.POST(body);
|
||||
if (code / 100 == 2) {
|
||||
Serial.println("Upload successful.");
|
||||
} else {
|
||||
Serial.print("Upload failed: ");
|
||||
Serial.println(code);
|
||||
}
|
||||
http.end();
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,744 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generiert durch Microsoft Visio, SVG Export circuit.svg Zeichenblatt-1 -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events"
|
||||
xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="5.89497in" height="3.47772in"
|
||||
viewBox="0 0 424.438 250.396" xml:space="preserve" color-interpolation-filters="sRGB" class="st12">
|
||||
<v:documentProperties v:langID="1031" v:metric="true" v:viewMarkup="false"/>
|
||||
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
.st1 {fill:#000000}
|
||||
.st2 {stroke:#000000;stroke-linecap:butt;stroke-width:1.47402}
|
||||
.st3 {fill:#000000;font-family:Calibri;font-size:0.75em}
|
||||
.st4 {font-size:0.777771em}
|
||||
.st5 {fill:#ffffff;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:1}
|
||||
.st6 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:1}
|
||||
.st7 {fill:#000000;font-family:Calibri;font-size:0.666664em}
|
||||
.st8 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.75}
|
||||
.st9 {stroke:#000000;stroke-linecap:butt;stroke-width:2.21102}
|
||||
.st10 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.75}
|
||||
.st11 {fill:#000000;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:6.375}
|
||||
.st12 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
|
||||
]]>
|
||||
</style>
|
||||
|
||||
<g v:mID="0" v:index="1" v:groupContext="foregroundPage">
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ResistorCount" v:prompt="" v:val="VT0(3):26"/>
|
||||
<v:ud v:nameU="SPSTCount" v:prompt="" v:val="VT0(3):26"/>
|
||||
</v:userDefs>
|
||||
<title>Zeichenblatt-1</title>
|
||||
<v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394"
|
||||
v:shadowOffsetY="-8.50394"/>
|
||||
<v:layer v:name="Elektrisch" v:index="0"/>
|
||||
<v:layer v:name="Verbinder" v:index="1"/>
|
||||
<g id="group100-1" transform="translate(327.685,-184.252)" v:mID="100" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Label" v:lbl="Beschriftung" v:type="0" v:format="@" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="1031" v:val="VT4()"/>
|
||||
<v:cp v:nameU="Slider_Position" v:lbl="Reglerposition (0-1)" v:type="2" v:langID="1031" v:val="VT0(0.5):26"/>
|
||||
<v:cp v:nameU="Label" v:lbl="" v:prompt="" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="0" v:cal="0" v:val="VT4(R1 1MΩ)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="Form" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="SubType" v:val="VT0(0):26"/>
|
||||
<v:ud v:nameU="visDescription" v:val="VT4(Stellt einen festen oder variablen Widerstand dar.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4()"/>
|
||||
<v:ud v:nameU="SolSH" v:prompt="" v:val="VT4({2EE3C7D2-E26E-4B72-9E9C-5170DDBF261A})"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4(R1)"/>
|
||||
</v:userDefs>
|
||||
<title>Widerstand</title>
|
||||
<desc>1MΩ</desc>
|
||||
<g id="shape101-2" v:mID="101" v:groupContext="shape" v:layerMember="0" transform="translate(-2.79265,2.58283)">
|
||||
<title>Tabelle.101</title>
|
||||
</g>
|
||||
<g id="shape102-4" v:mID="102" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.102</title>
|
||||
<path d="M8.84 234.18 L8.84 229.76 L28.01 229.76 L28.01 234.18 L5.9 234.18 L5.9 226.81 L30.95 226.81 L30.95 237.13
|
||||
L5.9 237.13 L5.9 234.18 L8.84 234.18 Z" class="st1"/>
|
||||
<path d="M36.85 231.97 L29.48 231.97" class="st2"/>
|
||||
<path d="M7.37 231.97 L0 231.97" class="st2"/>
|
||||
</g>
|
||||
<g id="shape100-8" v:mID="100" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="34.0157"/>
|
||||
<v:textRect cx="18.4252" cy="253.585" width="18.45" height="24.8036"/>
|
||||
<text x="13.7" y="250.29" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>R1<v:newlineChar/><tspan
|
||||
x="11.33" dy="1.671em" class="st4">1M</tspan><tspan class="st4">Ω</tspan></text> </g>
|
||||
</g>
|
||||
<g id="group103-12" transform="translate(381.543,-184.252)" v:mID="103" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Label" v:lbl="Beschriftung" v:type="0" v:format="@" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="1031" v:val="VT4()"/>
|
||||
<v:cp v:nameU="Slider_Position" v:lbl="Reglerposition (0-1)" v:type="2" v:langID="1031" v:val="VT0(0.5):26"/>
|
||||
<v:cp v:nameU="Label" v:lbl="" v:prompt="" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="0" v:cal="0" v:val="VT4(R2 100kΩ)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="Form" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="SubType" v:val="VT0(0):26"/>
|
||||
<v:ud v:nameU="visDescription" v:val="VT4(Stellt einen festen oder variablen Widerstand dar.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4()"/>
|
||||
<v:ud v:nameU="SolSH" v:prompt="" v:val="VT4({2EE3C7D2-E26E-4B72-9E9C-5170DDBF261A})"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4(R2)"/>
|
||||
</v:userDefs>
|
||||
<title>Widerstand.103</title>
|
||||
<desc>100kΩ</desc>
|
||||
<g id="shape104-13" v:mID="104" v:groupContext="shape" v:layerMember="0" transform="translate(-2.79265,2.58283)">
|
||||
<title>Tabelle.104</title>
|
||||
</g>
|
||||
<g id="shape105-15" v:mID="105" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.105</title>
|
||||
<path d="M8.84 234.18 L8.84 229.76 L28.01 229.76 L28.01 234.18 L5.9 234.18 L5.9 226.81 L30.95 226.81 L30.95 237.13
|
||||
L5.9 237.13 L5.9 234.18 L8.84 234.18 Z" class="st1"/>
|
||||
<path d="M36.85 231.97 L29.48 231.97" class="st2"/>
|
||||
<path d="M7.37 231.97 L0 231.97" class="st2"/>
|
||||
</g>
|
||||
<g id="shape103-19" v:mID="103" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="34.0157"/>
|
||||
<v:textRect cx="18.4252" cy="253.585" width="22.74" height="24.8036"/>
|
||||
<text x="13.7" y="250.29" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>R2<v:newlineChar/><tspan
|
||||
x="9.19" dy="1.671em" class="st4">100k</tspan><tspan class="st4">Ω</tspan></text> </g>
|
||||
</g>
|
||||
<g id="group34-23" transform="translate(141.307,-94.4882)" v:mID="34" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Input" v:lbl="Anzahl der Eingänge" v:type="1" v:format="0;1;2;3;4" v:sortKey="2" v:langID="1031"
|
||||
v:val="VT4(4)"/>
|
||||
<v:cp v:nameU="Output" v:lbl="Anzahl der Ausgänge" v:type="1" v:format="0;1;2;3;4" v:sortKey="3" v:langID="1031"
|
||||
v:val="VT4(4)"/>
|
||||
<v:cp v:nameU="Type" v:lbl="Abschnitt" v:type="1" v:format="Oben;Basis;Mitte;Vollständig" v:sortKey="1"
|
||||
v:langID="1031" v:val="VT4(Mitte)"/>
|
||||
<v:cp v:nameU="Top" v:lbl="Anzahl der oberen Pins" v:type="1" v:format="0;1;2" v:sortKey="4" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
<v:cp v:nameU="Bot" v:lbl="Anzahl der Basispins" v:type="1" v:format="0;1;2" v:sortKey="5" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="Ratio" v:val="VT0(0.2):26"/>
|
||||
<v:ud v:nameU="Top" v:val="VT4(Oben)"/>
|
||||
<v:ud v:nameU="Base" v:val="VT4(Basis)"/>
|
||||
<v:ud v:nameU="Middle" v:val="VT4(Mitte)"/>
|
||||
<v:ud v:nameU="Complete" v:val="VT4(Vollständig)"/>
|
||||
<v:ud v:nameU="Type" v:val="VT0(2):26"/>
|
||||
<v:ud v:nameU="visDescription" v:val="VT4(Abschnitt eines ICs. An anderen Abschnitten anfügen.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<title>4X Baust. Mitte</title>
|
||||
<desc>ESP8266</desc>
|
||||
<g id="shape35-24" v:mID="35" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.35</title>
|
||||
<rect x="0" y="184.254" width="79.3701" height="66.1417" class="st5"/>
|
||||
</g>
|
||||
<g id="shape36-26" v:mID="36" v:groupContext="shape" v:layerMember="0" transform="translate(-15.874,0)">
|
||||
<title>Tabelle.36</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 192.52 L15.87 192.52" class="st6"/>
|
||||
<path d="M0 209.06 L15.87 209.06" class="st6"/>
|
||||
<path d="M0 225.59 L15.87 225.59" class="st6"/>
|
||||
<path d="M0 242.13 L15.87 242.13" class="st6"/>
|
||||
</g>
|
||||
<g id="shape38-32" v:mID="38" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-57.874)">
|
||||
<title>Tabelle.38</title>
|
||||
<desc>5V</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.7" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>5V</text> </g>
|
||||
<g id="shape40-34" v:mID="40" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-41.3386)">
|
||||
<title>Tabelle.40</title>
|
||||
<desc>G</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="5.48" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>G</text> </g>
|
||||
<g id="shape41-36" v:mID="41" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-24.8032)">
|
||||
<title>Tabelle.41</title>
|
||||
<desc>D4</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D4</text> </g>
|
||||
<g id="shape43-38" v:mID="43" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-8.26772)">
|
||||
<title>Tabelle.43</title>
|
||||
<desc>D3</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D3</text> </g>
|
||||
<g id="shape49-40" v:mID="49" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-57.874)">
|
||||
<title>Tabelle.49</title>
|
||||
<desc>3V3</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8.23039" cy="244.594" width="16.47" height="11.6036"/>
|
||||
<text x="1.91" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>3V3</text> </g>
|
||||
<g id="shape50-42" v:mID="50" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-41.3386)">
|
||||
<title>Tabelle.50</title>
|
||||
<desc>D8</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D8</text> </g>
|
||||
<g id="shape51-44" v:mID="51" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-24.8032)">
|
||||
<title>Tabelle.51</title>
|
||||
<desc>D7</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D7</text> </g>
|
||||
<g id="shape52-46" v:mID="52" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-8.26772)">
|
||||
<title>Tabelle.52</title>
|
||||
<desc>D6</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D6</text> </g>
|
||||
<g id="shape53-48" v:mID="53" v:groupContext="shape" v:layerMember="0" transform="translate(301.987,168.38) rotate(90)">
|
||||
<title>Tabelle.53</title>
|
||||
</g>
|
||||
<g id="shape54-50" v:mID="54" v:groupContext="shape" v:layerMember="0" transform="translate(278.176,168.38) rotate(90)">
|
||||
<title>Tabelle.54</title>
|
||||
</g>
|
||||
<g id="shape59-52" v:mID="59" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(301.987,250.396) rotate(90)">
|
||||
<title>Tabelle.59</title>
|
||||
</g>
|
||||
<g id="shape62-54" v:mID="62" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(278.176,250.396) rotate(90)">
|
||||
<title>Tabelle.62</title>
|
||||
</g>
|
||||
<g id="shape65-56" v:mID="65" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,0)">
|
||||
<title>Tabelle.65</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 192.52 L15.87 192.52" class="st6"/>
|
||||
<path d="M0 209.06 L15.87 209.06" class="st6"/>
|
||||
<path d="M0 225.59 L15.87 225.59" class="st6"/>
|
||||
<path d="M0 242.13 L15.87 242.13" class="st6"/>
|
||||
</g>
|
||||
<g id="shape66-62" v:mID="66" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.66</title>
|
||||
<path d="M79.37 250.4 L79.37 184.25" class="st6"/>
|
||||
<path d="M0 184.25 L0 250.4" class="st6"/>
|
||||
</g>
|
||||
<g id="shape34-66" v:mID="34" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="39.685" cy="217.325" width="35.47" height="12.8036"/>
|
||||
<text x="23.97" y="220.03" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>ESP8266</text> </g>
|
||||
</g>
|
||||
<g id="group67-68" transform="translate(141.307,-28.3465)" v:mID="67" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Input" v:lbl="Anzahl der Eingänge" v:type="1" v:format="0;1;2;3;4" v:sortKey="2" v:langID="1031"
|
||||
v:val="VT4(4)"/>
|
||||
<v:cp v:nameU="Output" v:lbl="Anzahl der Ausgänge" v:type="1" v:format="0;1;2;3;4" v:sortKey="3" v:langID="1031"
|
||||
v:val="VT4(4)"/>
|
||||
<v:cp v:nameU="Type" v:lbl="Abschnitt" v:type="1" v:format="Oben;Basis;Mitte;Vollständig" v:sortKey="1"
|
||||
v:langID="1031" v:val="VT4(Mitte)"/>
|
||||
<v:cp v:nameU="Top" v:lbl="Anzahl der oberen Pins" v:type="1" v:format="0;1;2" v:sortKey="4" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
<v:cp v:nameU="Bot" v:lbl="Anzahl der Basispins" v:type="1" v:format="0;1;2" v:sortKey="5" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="Ratio" v:val="VT0(0.2):26"/>
|
||||
<v:ud v:nameU="Top" v:val="VT4(Oben)"/>
|
||||
<v:ud v:nameU="Base" v:val="VT4(Basis)"/>
|
||||
<v:ud v:nameU="Middle" v:val="VT4(Mitte)"/>
|
||||
<v:ud v:nameU="Complete" v:val="VT4(Vollständig)"/>
|
||||
<v:ud v:nameU="Type" v:val="VT0(2):26"/>
|
||||
<v:ud v:nameU="visDescription" v:val="VT4(Abschnitt eines ICs. An anderen Abschnitten anfügen.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<title>4X Baust. Mitte.67</title>
|
||||
<desc>D1 mini</desc>
|
||||
<g id="shape68-69" v:mID="68" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.68</title>
|
||||
<rect x="0" y="184.254" width="79.3701" height="66.1417" class="st5"/>
|
||||
</g>
|
||||
<g id="shape69-71" v:mID="69" v:groupContext="shape" v:layerMember="0" transform="translate(-15.874,0)">
|
||||
<title>Tabelle.69</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 192.52 L15.87 192.52" class="st6"/>
|
||||
<path d="M0 209.06 L15.87 209.06" class="st6"/>
|
||||
<path d="M0 225.59 L15.87 225.59" class="st6"/>
|
||||
<path d="M0 242.13 L15.87 242.13" class="st6"/>
|
||||
</g>
|
||||
<g id="shape71-77" v:mID="71" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-57.874)">
|
||||
<title>Tabelle.71</title>
|
||||
<desc>D2</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D2</text> </g>
|
||||
<g id="shape73-79" v:mID="73" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-41.3386)">
|
||||
<title>Tabelle.73</title>
|
||||
<desc>D1</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D1</text> </g>
|
||||
<g id="shape74-81" v:mID="74" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-24.8032)">
|
||||
<title>Tabelle.74</title>
|
||||
<desc>RX</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.75" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>RX</text> </g>
|
||||
<g id="shape76-83" v:mID="76" v:groupContext="shape" v:layerMember="0" transform="translate(-16,-8.26772)">
|
||||
<title>Tabelle.76</title>
|
||||
<desc>TX</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.97" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>TX</text> </g>
|
||||
<g id="shape82-85" v:mID="82" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-57.874)">
|
||||
<title>Tabelle.82</title>
|
||||
<desc>D5</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D5</text> </g>
|
||||
<g id="shape83-87" v:mID="83" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-41.3386)">
|
||||
<title>Tabelle.83</title>
|
||||
<desc>D0</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.51" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D0</text> </g>
|
||||
<g id="shape84-89" v:mID="84" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-24.8032)">
|
||||
<title>Tabelle.84</title>
|
||||
<desc>A0</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="3.66" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>A0</text> </g>
|
||||
<g id="shape85-91" v:mID="85" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,-8.26772)">
|
||||
<title>Tabelle.85</title>
|
||||
<desc>RST</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="2.04" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>RST</text> </g>
|
||||
<g id="shape86-93" v:mID="86" v:groupContext="shape" v:layerMember="0" transform="translate(301.987,168.38) rotate(90)">
|
||||
<title>Tabelle.86</title>
|
||||
</g>
|
||||
<g id="shape87-95" v:mID="87" v:groupContext="shape" v:layerMember="0" transform="translate(278.176,168.38) rotate(90)">
|
||||
<title>Tabelle.87</title>
|
||||
</g>
|
||||
<g id="shape92-97" v:mID="92" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(301.987,250.396) rotate(90)">
|
||||
<title>Tabelle.92</title>
|
||||
</g>
|
||||
<g id="shape95-99" v:mID="95" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(278.176,250.396) rotate(90)">
|
||||
<title>Tabelle.95</title>
|
||||
</g>
|
||||
<g id="shape98-101" v:mID="98" v:groupContext="shape" v:layerMember="0" transform="translate(79.3701,0)">
|
||||
<title>Tabelle.98</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 192.52 L15.87 192.52" class="st6"/>
|
||||
<path d="M0 209.06 L15.87 209.06" class="st6"/>
|
||||
<path d="M0 225.59 L15.87 225.59" class="st6"/>
|
||||
<path d="M0 242.13 L15.87 242.13" class="st6"/>
|
||||
</g>
|
||||
<g id="shape99-107" v:mID="99" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.99</title>
|
||||
<path d="M79.37 250.4 L79.37 184.25" class="st6"/>
|
||||
<path d="M0 184.25 L0 250.4" class="st6"/>
|
||||
</g>
|
||||
<g id="shape67-111" v:mID="67" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="39.685" cy="217.325" width="32.23" height="12.8036"/>
|
||||
<text x="25.59" y="220.03" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>D1 mini</text> </g>
|
||||
</g>
|
||||
<g id="shape115-113" v:mID="115" v:groupContext="shape" v:layerMember="1" transform="translate(370.205,-202.769)">
|
||||
<title>Dynamischer Verbinder.115</title>
|
||||
<path d="M0 250.4 L0 400.02 L-55.75 400.02 A2.3622 2.3622 -180 0 0 -60.47 400.02 L-133.65 400.02" class="st8"/>
|
||||
</g>
|
||||
<g id="group153-116" transform="translate(172.488,-225.354)" v:mID="153" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Input" v:lbl="Anzahl der Eingänge" v:type="1" v:format="0;1" v:sortKey="2" v:langID="1031"
|
||||
v:val="VT4(1)"/>
|
||||
<v:cp v:nameU="Output" v:lbl="Anzahl der Ausgänge" v:type="1" v:format="0;1" v:sortKey="3" v:langID="1031"
|
||||
v:val="VT4(1)"/>
|
||||
<v:cp v:nameU="Type" v:lbl="Abschnitt" v:type="1" v:format="Oben;Basis;Mitte;Vollständig" v:sortKey="1"
|
||||
v:langID="1031" v:val="VT4(Basis)"/>
|
||||
<v:cp v:nameU="Top" v:lbl="Anzahl der oberen Pins" v:type="1" v:format="0;1;2" v:sortKey="4" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
<v:cp v:nameU="Bot" v:lbl="Anzahl der Basispins" v:type="1" v:format="0;1;2" v:sortKey="5" v:langID="1031"
|
||||
v:val="VT4(1)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="Ratio" v:val="VT0(0.2):26"/>
|
||||
<v:ud v:nameU="Top" v:val="VT4(Oben)"/>
|
||||
<v:ud v:nameU="Base" v:val="VT4(Basis)"/>
|
||||
<v:ud v:nameU="Middle" v:val="VT4(Mitte)"/>
|
||||
<v:ud v:nameU="Complete" v:val="VT4(Vollständig)"/>
|
||||
<v:ud v:nameU="Type" v:val="VT0(1):26"/>
|
||||
<v:ud v:nameU="visDescription" v:val="VT4(Abschnitt eines ICs. An anderen Abschnitten anfügen.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<title>1X Baust. Basis</title>
|
||||
<g id="shape154-117" v:mID="154" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.154</title>
|
||||
<rect x="0" y="241.892" width="63.0709" height="8.50394" class="st5"/>
|
||||
</g>
|
||||
<g id="shape155-119" v:mID="155" v:groupContext="shape" v:layerMember="0" transform="translate(-12.6142,-4.25197)">
|
||||
<title>Tabelle.155</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 250.4 L12.61 250.4" class="st6"/>
|
||||
</g>
|
||||
<g id="shape156-122" v:mID="156" v:groupContext="shape" v:layerMember="0" transform="translate(-2.54076E-12,2.14983)">
|
||||
<title>Tabelle.156</title>
|
||||
<desc>VIN</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="9" cy="243.994" width="18" height="12.8036"/>
|
||||
<text x="2.41" y="246.69" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>VIN</text> </g>
|
||||
<g id="shape157-124" v:mID="157" v:groupContext="shape" v:layerMember="0" transform="translate(-18,-4.25197)">
|
||||
<title>Tabelle.157</title>
|
||||
<desc>1</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="9" cy="243.994" width="18" height="12.8036"/>
|
||||
<text x="6.72" y="246.69" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>1</text> </g>
|
||||
<g id="shape158-126" v:mID="158" v:groupContext="shape" v:layerMember="0" transform="translate(63.0709,-4.25197)">
|
||||
<title>Tabelle.158</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 250.4 L12.61 250.4" class="st6"/>
|
||||
</g>
|
||||
<g id="shape159-129" v:mID="159" v:groupContext="shape" v:layerMember="0" transform="translate(42.9135,2.14983)">
|
||||
<title>Tabelle.159</title>
|
||||
<desc>OUT</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="10.0787" cy="243.994" width="20.16" height="12.8036"/>
|
||||
<text x="2.02" y="246.69" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>OUT</text> </g>
|
||||
<g id="shape160-131" v:mID="160" v:groupContext="shape" v:layerMember="0" transform="translate(63.0709,-4.25197)">
|
||||
<title>Tabelle.160</title>
|
||||
<desc>2</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="9" cy="243.994" width="18" height="12.8036"/>
|
||||
<text x="6.72" y="246.69" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>2</text> </g>
|
||||
<g id="shape161-133" v:mID="161" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(291.392,229.278) rotate(90)">
|
||||
<title>Tabelle.161</title>
|
||||
</g>
|
||||
<g id="shape162-135" v:mID="162" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(272.471,229.278) rotate(90)">
|
||||
<title>Tabelle.162</title>
|
||||
</g>
|
||||
<g id="shape167-137" v:mID="167" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(281.931,250.396) rotate(90)">
|
||||
<title>Tabelle.167</title>
|
||||
<path d="M0 250.4 L12.61 250.4" class="st6"/>
|
||||
</g>
|
||||
<g id="shape168-140" v:mID="168" v:groupContext="shape" v:layerMember="0" transform="translate(21.0041,1.13687E-13)">
|
||||
<title>Tabelle.168</title>
|
||||
<desc>GND</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="10.5313" cy="243.994" width="21.07" height="12.8036"/>
|
||||
<text x="2.02" y="246.69" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>GND</text> </g>
|
||||
<g id="shape169-142" v:mID="169" v:groupContext="shape" v:layerMember="0" transform="translate(31.5354,12.8036)">
|
||||
<title>Tabelle.169</title>
|
||||
<desc>0</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="9" cy="243.994" width="18" height="12.8036"/>
|
||||
<text x="6.72" y="246.69" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>0</text> </g>
|
||||
<g id="shape170-144" v:mID="170" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(281.931,250.396) rotate(90)">
|
||||
<title>Tabelle.170</title>
|
||||
</g>
|
||||
<g id="shape173-146" v:mID="173" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.173</title>
|
||||
<path d="M0 250.4 L63.07 250.4" class="st6"/>
|
||||
<path d="M63.07 250.4 L63.07 241.89" class="st6"/>
|
||||
<path d="M0 241.89 L0 250.4" class="st6"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="shape178-151" v:mID="178" v:groupContext="shape" v:layerMember="1" transform="translate(249.449,-229.606)">
|
||||
<title>Dynamischer Verbinder.178</title>
|
||||
<path d="M-1.28 250.4 L-1.28 327.64 L-12.9 327.64" class="st8"/>
|
||||
</g>
|
||||
<g id="group187-154" transform="translate(313.512,-68.0315)" v:mID="187" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Label" v:lbl="Label" v:prompt="" v:type="0" v:format="@" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="1031" v:cal="0" v:val="VT4()"/>
|
||||
<v:cp v:nameU="Label" v:lbl="" v:prompt="" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="0" v:cal="0" v:val="VT4(SETUP)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visDescription"
|
||||
v:val="VT4(Stellt einen einpoligen, einseitigen Schalter dar. Klicken Sie mit der rechten Maustaste, um die Positionen für offen und geschlossen festzulegen.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4()"/>
|
||||
<v:ud v:nameU="SolSH" v:prompt="" v:val="VT4({2EE3C7D2-E26E-4B72-9E9C-5170DDBF261A})"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4(SPST1)"/>
|
||||
</v:userDefs>
|
||||
<title>SPST</title>
|
||||
<desc>SETUP</desc>
|
||||
<g id="shape188-155" v:mID="188" v:groupContext="shape" v:layerMember="0" transform="translate(8.84409,-18.4694)">
|
||||
<title>Tabelle.188</title>
|
||||
<path d="M19.16 237.65 L0 250.39" class="st2"/>
|
||||
</g>
|
||||
<g id="shape189-158" v:mID="189" v:groupContext="shape" v:layerMember="0" transform="translate(1.12458E-05,-14.0488)">
|
||||
<title>Tabelle.189</title>
|
||||
<path d="M36.85 245.97 A4.42205 4.42205 0 1 1 28.01 245.97 A4.42205 4.42205 0 1 1 36.85 245.97" class="st9"/>
|
||||
<path d="M8.84 245.97 A4.42205 4.42205 0 1 1 -0 245.97 A4.42205 4.42205 0 1 1 8.84 245.97" class="st9"/>
|
||||
</g>
|
||||
<g id="shape187-162" v:mID="187" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="34.0157"/>
|
||||
<v:textRect cx="18.4252" cy="243.9" width="27.38" height="12.8036"/>
|
||||
<text x="6.76" y="246.6" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>SETUP</text> </g>
|
||||
</g>
|
||||
<g id="group190-164" transform="translate(252.567,-8.52651E-14)" v:mID="190" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Label" v:lbl="Label" v:prompt="" v:type="0" v:format="@" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="1031" v:cal="0" v:val="VT4()"/>
|
||||
<v:cp v:nameU="Label" v:lbl="" v:prompt="" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="0" v:cal="0" v:val="VT4(SLEEP)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visDescription"
|
||||
v:val="VT4(Stellt einen einpoligen, einseitigen Schalter dar. Klicken Sie mit der rechten Maustaste, um die Positionen für offen und geschlossen festzulegen.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4()"/>
|
||||
<v:ud v:nameU="SolSH" v:prompt="" v:val="VT4({2EE3C7D2-E26E-4B72-9E9C-5170DDBF261A})"/>
|
||||
<v:ud v:nameU="Label" v:prompt="" v:val="VT4(SPST2)"/>
|
||||
</v:userDefs>
|
||||
<title>SPST.190</title>
|
||||
<desc>SLEEP</desc>
|
||||
<g id="shape191-165" v:mID="191" v:groupContext="shape" v:layerMember="0" transform="translate(8.84409,-18.4694)">
|
||||
<title>Tabelle.191</title>
|
||||
<path d="M19.16 237.65 L0 250.39" class="st2"/>
|
||||
</g>
|
||||
<g id="shape192-168" v:mID="192" v:groupContext="shape" v:layerMember="0" transform="translate(1.12458E-05,-14.0488)">
|
||||
<title>Tabelle.192</title>
|
||||
<path d="M36.85 245.97 A4.42205 4.42205 0 1 1 28.01 245.97 A4.42205 4.42205 0 1 1 36.85 245.97" class="st9"/>
|
||||
<path d="M8.84 245.97 A4.42205 4.42205 0 1 1 -0 245.97 A4.42205 4.42205 0 1 1 8.84 245.97" class="st9"/>
|
||||
</g>
|
||||
<g id="shape190-172" v:mID="190" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="34.0157"/>
|
||||
<v:textRect cx="18.4252" cy="243.9" width="25.4" height="12.8036"/>
|
||||
<text x="7.75" y="246.6" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>SLEEP</text> </g>
|
||||
</g>
|
||||
<g id="shape193-174" v:mID="193" v:groupContext="shape" v:layerMember="1" transform="translate(159.874,-229.606)">
|
||||
<title>Dynamischer Verbinder.193</title>
|
||||
<path d="M0 250.4 L0 277.23 L85.94 277.23 A2.3622 2.3622 0 0 1 90.66 277.23 L167.81 277.23" class="st8"/>
|
||||
</g>
|
||||
<g id="shape195-177" v:mID="195" v:groupContext="shape" v:layerMember="1" transform="translate(345.94,-86.4567)">
|
||||
<title>Dynamischer Verbinder.195</title>
|
||||
<path d="M0 250.4 L15.05 250.4 L15.05 217.56 L-58.41 217.56 A2.3622 2.3622 -180 0 0 -63.14 217.56 L-108.96 217.56"
|
||||
class="st8"/>
|
||||
</g>
|
||||
<g id="shape196-180" v:mID="196" v:groupContext="shape" v:layerMember="1" transform="translate(236.551,-79.252)">
|
||||
<title>Dynamischer Verbinder.196</title>
|
||||
<path d="M0 243.43 L81.38 243.19" class="st8"/>
|
||||
</g>
|
||||
<g id="shape197-183" v:mID="197" v:groupContext="shape" v:layerMember="1" transform="translate(236.551,-69.685)">
|
||||
<title>Dynamischer Verbinder.197</title>
|
||||
<path d="M0 250.4 L75.54 250.4 L75.54 301.66 L48.44 301.66" class="st8"/>
|
||||
</g>
|
||||
<g id="shape198-186" v:mID="198" v:groupContext="shape" v:layerMember="1" transform="translate(236.551,-36.6142)">
|
||||
<title>Dynamischer Verbinder.198</title>
|
||||
<path d="M0 250.4 L0 268.58 L20.44 268.58" class="st8"/>
|
||||
</g>
|
||||
<g id="group206-189" transform="translate(18,-13.937)" v:mID="206" v:groupContext="group" v:layerMember="0">
|
||||
<v:custProps>
|
||||
<v:cp v:nameU="Input" v:lbl="Anzahl der Eingänge" v:type="1" v:format="0;1;2;3;4" v:sortKey="2" v:langID="1031"
|
||||
v:val="VT4(4)"/>
|
||||
<v:cp v:nameU="Output" v:lbl="Anzahl der Ausgänge" v:type="1" v:format="0;1;2;3;4" v:sortKey="3" v:langID="1031"
|
||||
v:val="VT4(4)"/>
|
||||
<v:cp v:nameU="Type" v:lbl="Abschnitt" v:type="1" v:format="Oben;Basis;Mitte;Vollständig" v:sortKey="1"
|
||||
v:langID="1031" v:val="VT4(Mitte)"/>
|
||||
<v:cp v:nameU="Top" v:lbl="Anzahl der oberen Pins" v:type="1" v:format="0;1;2" v:sortKey="4" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
<v:cp v:nameU="Bot" v:lbl="Anzahl der Basispins" v:type="1" v:format="0;1;2" v:sortKey="5" v:langID="1031"
|
||||
v:val="VT4(0)"/>
|
||||
<v:cp v:nameU="Input" v:lbl="" v:prompt="" v:type="0" v:format="" v:sortKey="" v:invis="false" v:ask="false"
|
||||
v:langID="0" v:cal="0" v:val="VT4(0)"/>
|
||||
</v:custProps>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="Ratio" v:val="VT0(0.2):26"/>
|
||||
<v:ud v:nameU="Top" v:val="VT4(Oben)"/>
|
||||
<v:ud v:nameU="Base" v:val="VT4(Basis)"/>
|
||||
<v:ud v:nameU="Middle" v:val="VT4(Mitte)"/>
|
||||
<v:ud v:nameU="Complete" v:val="VT4(Vollständig)"/>
|
||||
<v:ud v:nameU="Type" v:val="VT0(2):26"/>
|
||||
<v:ud v:nameU="visDescription" v:val="VT4(Abschnitt eines ICs. An anderen Abschnitten anfügen.)"/>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<title>4X Baust. Mitte.206</title>
|
||||
<desc>BME280</desc>
|
||||
<g id="shape207-190" v:mID="207" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.207</title>
|
||||
<rect x="0" y="201.971" width="58.1102" height="48.4252" class="st5"/>
|
||||
</g>
|
||||
<g id="shape208-192" v:mID="208" v:groupContext="shape" v:layerMember="0" transform="translate(-11.622,0)">
|
||||
<title>Tabelle.208</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
</g>
|
||||
<g id="shape221-194" v:mID="221" v:groupContext="shape" v:layerMember="0" transform="translate(58.1102,-42.372)">
|
||||
<title>Tabelle.221</title>
|
||||
<desc>VIN</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="2.14" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>VIN</text> </g>
|
||||
<g id="shape222-196" v:mID="222" v:groupContext="shape" v:layerMember="0" transform="translate(58.1102,-30.2657)">
|
||||
<title>Tabelle.222</title>
|
||||
<desc>GND</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="9.47253" cy="244.594" width="18.95" height="11.6036"/>
|
||||
<text x="1.91" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>GND</text> </g>
|
||||
<g id="shape223-198" v:mID="223" v:groupContext="shape" v:layerMember="0" transform="translate(58.1102,-18.1594)">
|
||||
<title>Tabelle.223</title>
|
||||
<desc>SDA</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8.51933" cy="244.594" width="17.04" height="11.6036"/>
|
||||
<text x="1.91" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>SDA</text> </g>
|
||||
<g id="shape224-200" v:mID="224" v:groupContext="shape" v:layerMember="0" transform="translate(58.1102,-6.05315)">
|
||||
<title>Tabelle.224</title>
|
||||
<desc>SCL</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="8" cy="244.594" width="16" height="11.6036"/>
|
||||
<text x="2.35" y="246.99" class="st7" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>SCL</text> </g>
|
||||
<g id="shape225-202" v:mID="225" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(288.168,190.349) rotate(90)">
|
||||
<title>Tabelle.225</title>
|
||||
</g>
|
||||
<g id="shape226-204" v:mID="226" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(270.735,190.349) rotate(90)">
|
||||
<title>Tabelle.226</title>
|
||||
</g>
|
||||
<g id="shape231-206" v:mID="231" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(288.168,250.396) rotate(90)">
|
||||
<title>Tabelle.231</title>
|
||||
</g>
|
||||
<g id="shape234-208" v:mID="234" v:groupContext="shape" v:layerMember="0"
|
||||
transform="translate(270.735,250.396) rotate(90)">
|
||||
<title>Tabelle.234</title>
|
||||
</g>
|
||||
<g id="shape237-210" v:mID="237" v:groupContext="shape" v:layerMember="0" transform="translate(58.1102,0)">
|
||||
<title>Tabelle.237</title>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="ArmWidth"/>
|
||||
</v:userDefs>
|
||||
<path d="M0 208.02 L11.62 208.02" class="st6"/>
|
||||
<path d="M0 220.13 L11.62 220.13" class="st6"/>
|
||||
<path d="M0 232.24 L11.62 232.24" class="st6"/>
|
||||
<path d="M0 244.34 L11.62 244.34" class="st6"/>
|
||||
</g>
|
||||
<g id="shape238-216" v:mID="238" v:groupContext="shape" v:layerMember="0">
|
||||
<title>Tabelle.238</title>
|
||||
<path d="M58.11 250.4 L58.11 201.97" class="st6"/>
|
||||
<path d="M0 201.97 L0 250.4" class="st6"/>
|
||||
</g>
|
||||
<g id="shape206-220" v:mID="206" v:groupContext="groupContent" v:layerMember="0">
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="29.0551" cy="226.183" width="34.71" height="12.8036"/>
|
||||
<text x="13.72" y="228.88" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>BME280</text> </g>
|
||||
</g>
|
||||
<g id="shape239-222" v:mID="239" v:groupContext="shape" v:layerMember="1" transform="translate(87.7323,-44.2028)">
|
||||
<title>Dynamischer Verbinder.239</title>
|
||||
<path d="M0 250.4 L16.02 250.4 L16.02 121.69 L158.08 121.69 A2.3622 2.3622 0 1 1 162.8 121.69 L197.43 121.69 L197.43
|
||||
191.84 L148.82 191.84" class="st8"/>
|
||||
</g>
|
||||
<g id="shape241-225" v:mID="241" v:groupContext="shape" v:layerMember="1" transform="translate(87.7323,-32.0965)">
|
||||
<title>Dynamischer Verbinder.241</title>
|
||||
<path d="M0 250.4 L24.52 250.4 L24.52 196.27 L37.7 196.27" class="st8"/>
|
||||
</g>
|
||||
<g id="shape242-228" v:mID="242" v:groupContext="shape" v:layerMember="1" transform="translate(87.7323,-19.9902)">
|
||||
<title>Dynamischer Verbinder.242</title>
|
||||
<path d="M0 250.4 L34.16 250.4 L34.16 200.7 L37.7 200.7" class="st8"/>
|
||||
</g>
|
||||
<g id="shape256-231" v:mID="256" v:groupContext="shape" transform="translate(167.094,-240.996)">
|
||||
<title>Tabelle.256</title>
|
||||
<desc>LMO78</desc>
|
||||
<v:textBlock v:margins="rect(1,1,1,1)" v:tabSpace="42.5197"/>
|
||||
<v:textRect cx="37" cy="246.396" width="74.01" height="8"/>
|
||||
<rect x="0" y="242.396" width="74" height="8" class="st10"/>
|
||||
<text x="23.72" y="249.1" class="st3" v:langID="1031"><v:paragraph v:horizAlign="1"/><v:tabList/>LMO78</text> </g>
|
||||
<g id="group257-234" transform="translate(35.3622,-222.066)" v:mID="257" v:groupContext="group">
|
||||
<title>Volle Batterie</title>
|
||||
<g id="shape258-235" v:mID="258" v:groupContext="shape">
|
||||
<title>Tabelle.258</title>
|
||||
<path d="M22.64 248.51 L22.64 237.2 L1.84 237.2 L1.84 248.51 L22.64 248.51 ZM25.71 240.03 C26.38 240.03 26.93 240.59
|
||||
26.93 241.28 L26.93 244.43 C26.93 245.12 26.38 245.68 25.71 245.68 L24.48 245.68 L24.48 249.14 C24.48
|
||||
249.83 23.93 250.4 23.26 250.4 L1.22 250.4 C0.55 250.4 0 249.83 0 249.14 L0 236.57 C0 235.88 0.55 235.32
|
||||
1.22 235.32 L23.26 235.32 C23.93 235.32 24.48 235.88 24.48 236.57 L24.48 240.03 L25.71 240.03 Z"
|
||||
class="st11"/>
|
||||
</g>
|
||||
<g id="shape259-237" v:mID="259" v:groupContext="shape" transform="translate(3.06013,-3.14173)">
|
||||
<title>Tabelle.259</title>
|
||||
<rect x="0" y="241.599" width="18.3608" height="8.79685" class="st11"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="group260-239" transform="translate(64.4173,-222.066)" v:mID="260" v:groupContext="group">
|
||||
<title>Volle Batterie.260</title>
|
||||
<g id="shape261-240" v:mID="261" v:groupContext="shape">
|
||||
<title>Tabelle.261</title>
|
||||
<path d="M22.64 248.51 L22.64 237.2 L1.84 237.2 L1.84 248.51 L22.64 248.51 ZM25.71 240.03 C26.38 240.03 26.93 240.59
|
||||
26.93 241.28 L26.93 244.43 C26.93 245.12 26.38 245.68 25.71 245.68 L24.48 245.68 L24.48 249.14 C24.48
|
||||
249.83 23.93 250.4 23.26 250.4 L1.22 250.4 C0.55 250.4 0 249.83 0 249.14 L0 236.57 C0 235.88 0.55 235.32
|
||||
1.22 235.32 L23.26 235.32 C23.93 235.32 24.48 235.88 24.48 236.57 L24.48 240.03 L25.71 240.03 Z"
|
||||
class="st11"/>
|
||||
</g>
|
||||
<g id="shape262-242" v:mID="262" v:groupContext="shape" transform="translate(3.06013,-3.14173)">
|
||||
<title>Tabelle.262</title>
|
||||
<rect x="0" y="241.599" width="18.3608" height="8.79685" class="st11"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="group263-244" transform="translate(93.4724,-222.066)" v:mID="263" v:groupContext="group">
|
||||
<title>Volle Batterie.263</title>
|
||||
<g id="shape264-245" v:mID="264" v:groupContext="shape">
|
||||
<title>Tabelle.264</title>
|
||||
<path d="M22.64 248.51 L22.64 237.2 L1.84 237.2 L1.84 248.51 L22.64 248.51 ZM25.71 240.03 C26.38 240.03 26.93 240.59
|
||||
26.93 241.28 L26.93 244.43 C26.93 245.12 26.38 245.68 25.71 245.68 L24.48 245.68 L24.48 249.14 C24.48
|
||||
249.83 23.93 250.4 23.26 250.4 L1.22 250.4 C0.55 250.4 0 249.83 0 249.14 L0 236.57 C0 235.88 0.55 235.32
|
||||
1.22 235.32 L23.26 235.32 C23.93 235.32 24.48 235.88 24.48 236.57 L24.48 240.03 L25.71 240.03 Z"
|
||||
class="st11"/>
|
||||
</g>
|
||||
<g id="shape265-247" v:mID="265" v:groupContext="shape" transform="translate(3.06013,-3.14173)">
|
||||
<title>Tabelle.265</title>
|
||||
<rect x="0" y="241.599" width="18.3608" height="8.79685" class="st11"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="group266-249" transform="translate(122.528,-222.066)" v:mID="266" v:groupContext="group">
|
||||
<title>Volle Batterie.266</title>
|
||||
<g id="shape267-250" v:mID="267" v:groupContext="shape">
|
||||
<title>Tabelle.267</title>
|
||||
<path d="M22.64 248.51 L22.64 237.2 L1.84 237.2 L1.84 248.51 L22.64 248.51 ZM25.71 240.03 C26.38 240.03 26.93 240.59
|
||||
26.93 241.28 L26.93 244.43 C26.93 245.12 26.38 245.68 25.71 245.68 L24.48 245.68 L24.48 249.14 C24.48
|
||||
249.83 23.93 250.4 23.26 250.4 L1.22 250.4 C0.55 250.4 0 249.83 0 249.14 L0 236.57 C0 235.88 0.55 235.32
|
||||
1.22 235.32 L23.26 235.32 C23.93 235.32 24.48 235.88 24.48 236.57 L24.48 240.03 L25.71 240.03 Z"
|
||||
class="st11"/>
|
||||
</g>
|
||||
<g id="shape268-252" v:mID="268" v:groupContext="shape" transform="translate(3.06013,-3.14173)">
|
||||
<title>Tabelle.268</title>
|
||||
<rect x="0" y="241.599" width="18.3608" height="8.79685" class="st11"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="shape272-254" v:mID="272" v:groupContext="shape" v:layerMember="1" transform="translate(22.3937,-229.606)">
|
||||
<title>Dynamischer Verbinder</title>
|
||||
<path d="M0 250.4 L0 267.26 L135.12 267.26 A2.3622 2.3622 0 1 1 139.84 267.26 L181.63 267.26" class="st8"/>
|
||||
</g>
|
||||
<g id="shape273-257" v:mID="273" v:groupContext="shape" v:layerMember="1" transform="translate(418.394,-202.769)">
|
||||
<title>Dynamischer Verbinder.273</title>
|
||||
<path d="M0 250.4 L5.67 250.4 L5.67 317.34 L-45.83 317.34 A2.3622 2.3622 -180 0 0 -50.55 317.34 L-130.87 317.34 A2.3622
|
||||
2.3622 -180 0 0 -135.59 317.34 L-181.84 317.34" class="st8"/>
|
||||
</g>
|
||||
<g id="shape275-260" v:mID="275" v:groupContext="shape" v:layerMember="1" transform="translate(87.7323,-56.3091)">
|
||||
<title>Dynamischer Verbinder.275</title>
|
||||
<path d="M0 250.4 L7.51 250.4 L7.51 118.2 L160.44 118.2" class="st8"/>
|
||||
</g>
|
||||
<g id="shape277-263" v:mID="277" v:groupContext="shape" v:layerMember="1" transform="translate(364.535,-195.683)">
|
||||
<title>Dynamischer Verbinder.277</title>
|
||||
<path d="M0 243.31 L17.01 243.31" class="st8"/>
|
||||
</g>
|
||||
<g id="shape278-266" v:mID="278" v:groupContext="shape" v:layerMember="1" transform="translate(147.579,-222.52)">
|
||||
<title>Dynamischer Verbinder.278</title>
|
||||
<path d="M1.88 243.31 L12.3 243.31" class="st8"/>
|
||||
</g>
|
||||
<g id="shape279-269" v:mID="279" v:groupContext="shape" v:layerMember="1" transform="translate(35.9646,-222.52)">
|
||||
<title>Dynamischer Verbinder.279</title>
|
||||
<path d="M-0.6 243.31 L-13.57 243.31" class="st8"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user