Skip to content

Commit

Permalink
fix wifi bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hajoha committed Aug 9, 2024
1 parent 9565ec8 commit 27281d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import com.influxdb.client.write.events.BackpressureEvent;
import com.influxdb.client.write.events.WriteErrorEvent;
import com.influxdb.client.write.events.WriteRetriableErrorEvent;
import com.influxdb.client.write.events.WriteSuccessEvent;

Expand Down Expand Up @@ -76,6 +77,13 @@ public void open_write_api() {
gv.getLog_status().setColorFilter(Color.argb(255, 0, 255, 0));
}
});
writeApi.listenEvents(WriteErrorEvent.class, value -> {
value.logEvent();
if ( spg.getSharedPreference(SPType.logging_sp).getBoolean("enable_influx", false)) {
gv.getLog_status().setColorFilter(Color.argb(255, 255, 0, 0));
}
});

writeApi.listenEvents(WriteRetriableErrorEvent.class, value -> {
value.logEvent();
if ( spg.getSharedPreference(SPType.logging_sp).getBoolean("enable_influx", false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

import de.fraunhofer.fokus.OpenMobileNetworkToolkit.DataProvider.CellInformation;
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.DataProvider.DataProvider;
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.DataProvider.WifiInformation;
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.InfluxDB2x.InfluxdbConnection;
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.InfluxDB2x.InfluxdbConnections;
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.Preferences.SPType;
Expand Down Expand Up @@ -355,13 +356,16 @@ private ArrayList<Point> getPoints() {
}

if (spg.getSharedPreference(SPType.logging_sp).getBoolean("log_wifi_data", false)) {
Point p = dp.getWifiInformation().getWifiInformationPoint();
if (p.hasFields()) {
p.time(time, WritePrecision.MS);
p.addTags(tags_map);
logPoints.add(p);
} else {
Log.w(TAG, "Point without fields from getWifiInformationPoint");
WifiInformation wifiInformation = dp.getWifiInformation();
if(wifiInformation != null) {
Point p = wifiInformation.getWifiInformationPoint();
if (p.hasFields()) {
p.time(time, WritePrecision.MS);
p.addTags(tags_map);
logPoints.add(p);
} else {
Log.w(TAG, "Point without fields from getWifiInformationPoint");
}
}
}

Expand Down

0 comments on commit 27281d8

Please sign in to comment.