mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
Adding battery_level to protobuffers spec.
This commit is contained in:
@@ -50,4 +50,5 @@ message SensorDataSet {
|
||||
optional SensorData heart_rate = 2;
|
||||
optional SensorData cadence = 3;
|
||||
optional SensorData power = 4;
|
||||
optional SensorData battery_level = 5;
|
||||
}
|
||||
@@ -398,10 +398,18 @@ public final class Sensor {
|
||||
public boolean hasPower() { return hasPower; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getPower() { return power_; }
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData battery_level = 5;
|
||||
public static final int BATTERY_LEVEL_FIELD_NUMBER = 5;
|
||||
private boolean hasBatteryLevel;
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData batteryLevel_;
|
||||
public boolean hasBatteryLevel() { return hasBatteryLevel; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getBatteryLevel() { return batteryLevel_; }
|
||||
|
||||
private void initFields() {
|
||||
heartRate_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
cadence_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
power_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
batteryLevel_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
if (hasHeartRate()) {
|
||||
@@ -413,6 +421,9 @@ public final class Sensor {
|
||||
if (hasPower()) {
|
||||
if (!getPower().isInitialized()) return false;
|
||||
}
|
||||
if (hasBatteryLevel()) {
|
||||
if (!getBatteryLevel().isInitialized()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -431,6 +442,9 @@ public final class Sensor {
|
||||
if (hasPower()) {
|
||||
output.writeMessage(4, getPower());
|
||||
}
|
||||
if (hasBatteryLevel()) {
|
||||
output.writeMessage(5, getBatteryLevel());
|
||||
}
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
@@ -455,6 +469,10 @@ public final class Sensor {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(4, getPower());
|
||||
}
|
||||
if (hasBatteryLevel()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(5, getBatteryLevel());
|
||||
}
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
@@ -611,6 +629,9 @@ public final class Sensor {
|
||||
if (other.hasPower()) {
|
||||
mergePower(other.getPower());
|
||||
}
|
||||
if (other.hasBatteryLevel()) {
|
||||
mergeBatteryLevel(other.getBatteryLevel());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -660,6 +681,15 @@ public final class Sensor {
|
||||
setPower(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.Builder subBuilder = com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder();
|
||||
if (hasBatteryLevel()) {
|
||||
subBuilder.mergeFrom(getBatteryLevel());
|
||||
}
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
setBatteryLevel(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -794,6 +824,43 @@ public final class Sensor {
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData battery_level = 5;
|
||||
public boolean hasBatteryLevel() {
|
||||
return result.hasBatteryLevel();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getBatteryLevel() {
|
||||
return result.getBatteryLevel();
|
||||
}
|
||||
public Builder setBatteryLevel(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasBatteryLevel = true;
|
||||
result.batteryLevel_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder setBatteryLevel(com.google.android.apps.mytracks.content.Sensor.SensorData.Builder builderForValue) {
|
||||
result.hasBatteryLevel = true;
|
||||
result.batteryLevel_ = builderForValue.build();
|
||||
return this;
|
||||
}
|
||||
public Builder mergeBatteryLevel(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (result.hasBatteryLevel() &&
|
||||
result.batteryLevel_ != com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance()) {
|
||||
result.batteryLevel_ =
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder(result.batteryLevel_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
result.batteryLevel_ = value;
|
||||
}
|
||||
result.hasBatteryLevel = true;
|
||||
return this;
|
||||
}
|
||||
public Builder clearBatteryLevel() {
|
||||
result.hasBatteryLevel = false;
|
||||
result.batteryLevel_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:com.google.android.apps.mytracks.content.SensorDataSet)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user