Add Wearable DataBundle prototype

This commit is contained in:
mar-v-in 2015-10-10 19:06:38 +02:00
parent be0f43cc48
commit 02e6ffce4d
5 changed files with 516 additions and 0 deletions

View File

@ -0,0 +1,64 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: protos-repo/databundle.proto
package org.microg.gms.wearable.databundle;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;
import java.util.Collections;
import java.util.List;
import static com.squareup.wire.Message.Label.REPEATED;
public final class DataBundle extends Message {
public static final List<DataBundleEntry> DEFAULT_ENTRIES = Collections.emptyList();
@ProtoField(tag = 1, label = REPEATED, messageType = DataBundleEntry.class)
public final List<DataBundleEntry> entries;
public DataBundle(List<DataBundleEntry> entries) {
this.entries = immutableCopyOf(entries);
}
private DataBundle(Builder builder) {
this(builder.entries);
setBuilder(builder);
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof DataBundle)) return false;
return equals(entries, ((DataBundle) other).entries);
}
@Override
public int hashCode() {
int result = hashCode;
return result != 0 ? result : (hashCode = entries != null ? entries.hashCode() : 1);
}
public static final class Builder extends Message.Builder<DataBundle> {
public List<DataBundleEntry> entries;
public Builder() {
}
public Builder(DataBundle message) {
super(message);
if (message == null) return;
this.entries = copyOf(message.entries);
}
public Builder entries(List<DataBundleEntry> entries) {
this.entries = checkForNulls(entries);
return this;
}
@Override
public DataBundle build() {
return new DataBundle(this);
}
}
}

View File

@ -0,0 +1,80 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: protos-repo/databundle.proto
package org.microg.gms.wearable.databundle;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;
import static com.squareup.wire.Message.Datatype.STRING;
public final class DataBundleEntry extends Message {
public static final String DEFAULT_KEY = "";
@ProtoField(tag = 1, type = STRING)
public final String key;
@ProtoField(tag = 2)
public final DataBundleTypedValue typedValue;
public DataBundleEntry(String key, DataBundleTypedValue typedValue) {
this.key = key;
this.typedValue = typedValue;
}
private DataBundleEntry(Builder builder) {
this(builder.key, builder.typedValue);
setBuilder(builder);
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof DataBundleEntry)) return false;
DataBundleEntry o = (DataBundleEntry) other;
return equals(key, o.key)
&& equals(typedValue, o.typedValue);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = key != null ? key.hashCode() : 0;
result = result * 37 + (typedValue != null ? typedValue.hashCode() : 0);
hashCode = result;
}
return result;
}
public static final class Builder extends Message.Builder<DataBundleEntry> {
public String key;
public DataBundleTypedValue typedValue;
public Builder() {
}
public Builder(DataBundleEntry message) {
super(message);
if (message == null) return;
this.key = message.key;
this.typedValue = message.typedValue;
}
public Builder key(String key) {
this.key = key;
return this;
}
public Builder typedValue(DataBundleTypedValue typedValue) {
this.typedValue = typedValue;
return this;
}
@Override
public DataBundleEntry build() {
return new DataBundleEntry(this);
}
}
}

View File

@ -0,0 +1,80 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: protos-repo/databundle.proto
package org.microg.gms.wearable.databundle;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;
import static com.squareup.wire.Message.Datatype.INT32;
public final class DataBundleTypedValue extends Message {
public static final Integer DEFAULT_TYPE = 0;
@ProtoField(tag = 1, type = INT32)
public final Integer type;
@ProtoField(tag = 2)
public final DataBundleValue value;
public DataBundleTypedValue(Integer type, DataBundleValue value) {
this.type = type;
this.value = value;
}
private DataBundleTypedValue(Builder builder) {
this(builder.type, builder.value);
setBuilder(builder);
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof DataBundleTypedValue)) return false;
DataBundleTypedValue o = (DataBundleTypedValue) other;
return equals(type, o.type)
&& equals(value, o.value);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = type != null ? type.hashCode() : 0;
result = result * 37 + (value != null ? value.hashCode() : 0);
hashCode = result;
}
return result;
}
public static final class Builder extends Message.Builder<DataBundleTypedValue> {
public Integer type;
public DataBundleValue value;
public Builder() {
}
public Builder(DataBundleTypedValue message) {
super(message);
if (message == null) return;
this.type = message.type;
this.value = message.value;
}
public Builder type(Integer type) {
this.type = type;
return this;
}
public Builder value(DataBundleValue value) {
this.value = value;
return this;
}
@Override
public DataBundleTypedValue build() {
return new DataBundleTypedValue(this);
}
}
}

View File

@ -0,0 +1,259 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: protos-repo/databundle.proto
package org.microg.gms.wearable.databundle;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;
import java.util.Collections;
import java.util.List;
import okio.ByteString;
import static com.squareup.wire.Message.Datatype.BOOL;
import static com.squareup.wire.Message.Datatype.BYTES;
import static com.squareup.wire.Message.Datatype.DOUBLE;
import static com.squareup.wire.Message.Datatype.FLOAT;
import static com.squareup.wire.Message.Datatype.INT32;
import static com.squareup.wire.Message.Datatype.INT64;
import static com.squareup.wire.Message.Datatype.STRING;
import static com.squareup.wire.Message.Label.REPEATED;
public final class DataBundleValue extends Message {
public static final ByteString DEFAULT_BYTEARRAY = ByteString.EMPTY;
public static final String DEFAULT_STRINGVAL = "";
public static final Double DEFAULT_DOUBLEVAL = 0D;
public static final Float DEFAULT_FLOATVAL = 0F;
public static final Long DEFAULT_LONGVAL = 0L;
public static final Integer DEFAULT_INTVAL = 0;
public static final Integer DEFAULT_BYTEVAL = 0;
public static final Boolean DEFAULT_BOOLEANVAL = false;
public static final List<DataBundleEntry> DEFAULT_MAP = Collections.emptyList();
public static final List<DataBundleTypedValue> DEFAULT_LIST = Collections.emptyList();
public static final List<String> DEFAULT_STRINGARRAY = Collections.emptyList();
public static final List<Long> DEFAULT_LONGARRAY = Collections.emptyList();
public static final Integer DEFAULT_LENGTH = 0;
public static final List<Float> DEFAULT_FLOATARRAY = Collections.emptyList();
@ProtoField(tag = 1, type = BYTES)
public final ByteString byteArray;
@ProtoField(tag = 2, type = STRING)
public final String stringVal;
@ProtoField(tag = 3, type = DOUBLE)
public final Double doubleVal;
@ProtoField(tag = 4, type = FLOAT)
public final Float floatVal;
@ProtoField(tag = 5, type = INT64)
public final Long longVal;
@ProtoField(tag = 6, type = INT32)
public final Integer intVal;
@ProtoField(tag = 7, type = INT32)
public final Integer byteVal;
@ProtoField(tag = 8, type = BOOL)
public final Boolean booleanVal;
@ProtoField(tag = 9, label = REPEATED, messageType = DataBundleEntry.class)
public final List<DataBundleEntry> map;
@ProtoField(tag = 10, label = REPEATED, messageType = DataBundleTypedValue.class)
public final List<DataBundleTypedValue> list;
@ProtoField(tag = 11, type = STRING, label = REPEATED)
public final List<String> stringArray;
@ProtoField(tag = 12, type = INT64, label = REPEATED)
public final List<Long> longArray;
@ProtoField(tag = 13, type = INT32)
public final Integer length;
@ProtoField(tag = 14, type = FLOAT, label = REPEATED)
public final List<Float> floatArray;
public DataBundleValue(ByteString byteArray, String stringVal, Double doubleVal, Float floatVal, Long longVal, Integer intVal, Integer byteVal, Boolean booleanVal, List<DataBundleEntry> map, List<DataBundleTypedValue> list, List<String> stringArray, List<Long> longArray, Integer length, List<Float> floatArray) {
this.byteArray = byteArray;
this.stringVal = stringVal;
this.doubleVal = doubleVal;
this.floatVal = floatVal;
this.longVal = longVal;
this.intVal = intVal;
this.byteVal = byteVal;
this.booleanVal = booleanVal;
this.map = immutableCopyOf(map);
this.list = immutableCopyOf(list);
this.stringArray = immutableCopyOf(stringArray);
this.longArray = immutableCopyOf(longArray);
this.length = length;
this.floatArray = immutableCopyOf(floatArray);
}
private DataBundleValue(Builder builder) {
this(builder.byteArray, builder.stringVal, builder.doubleVal, builder.floatVal, builder.longVal, builder.intVal, builder.byteVal, builder.booleanVal, builder.map, builder.list, builder.stringArray, builder.longArray, builder.length, builder.floatArray);
setBuilder(builder);
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof DataBundleValue)) return false;
DataBundleValue o = (DataBundleValue) other;
return equals(byteArray, o.byteArray)
&& equals(stringVal, o.stringVal)
&& equals(doubleVal, o.doubleVal)
&& equals(floatVal, o.floatVal)
&& equals(longVal, o.longVal)
&& equals(intVal, o.intVal)
&& equals(byteVal, o.byteVal)
&& equals(booleanVal, o.booleanVal)
&& equals(map, o.map)
&& equals(list, o.list)
&& equals(stringArray, o.stringArray)
&& equals(longArray, o.longArray)
&& equals(length, o.length)
&& equals(floatArray, o.floatArray);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = byteArray != null ? byteArray.hashCode() : 0;
result = result * 37 + (stringVal != null ? stringVal.hashCode() : 0);
result = result * 37 + (doubleVal != null ? doubleVal.hashCode() : 0);
result = result * 37 + (floatVal != null ? floatVal.hashCode() : 0);
result = result * 37 + (longVal != null ? longVal.hashCode() : 0);
result = result * 37 + (intVal != null ? intVal.hashCode() : 0);
result = result * 37 + (byteVal != null ? byteVal.hashCode() : 0);
result = result * 37 + (booleanVal != null ? booleanVal.hashCode() : 0);
result = result * 37 + (map != null ? map.hashCode() : 1);
result = result * 37 + (list != null ? list.hashCode() : 1);
result = result * 37 + (stringArray != null ? stringArray.hashCode() : 1);
result = result * 37 + (longArray != null ? longArray.hashCode() : 1);
result = result * 37 + (length != null ? length.hashCode() : 0);
result = result * 37 + (floatArray != null ? floatArray.hashCode() : 1);
hashCode = result;
}
return result;
}
public static final class Builder extends Message.Builder<DataBundleValue> {
public ByteString byteArray;
public String stringVal;
public Double doubleVal;
public Float floatVal;
public Long longVal;
public Integer intVal;
public Integer byteVal;
public Boolean booleanVal;
public List<DataBundleEntry> map;
public List<DataBundleTypedValue> list;
public List<String> stringArray;
public List<Long> longArray;
public Integer length;
public List<Float> floatArray;
public Builder() {
}
public Builder(DataBundleValue message) {
super(message);
if (message == null) return;
this.byteArray = message.byteArray;
this.stringVal = message.stringVal;
this.doubleVal = message.doubleVal;
this.floatVal = message.floatVal;
this.longVal = message.longVal;
this.intVal = message.intVal;
this.byteVal = message.byteVal;
this.booleanVal = message.booleanVal;
this.map = copyOf(message.map);
this.list = copyOf(message.list);
this.stringArray = copyOf(message.stringArray);
this.longArray = copyOf(message.longArray);
this.length = message.length;
this.floatArray = copyOf(message.floatArray);
}
public Builder byteArray(ByteString byteArray) {
this.byteArray = byteArray;
return this;
}
public Builder stringVal(String stringVal) {
this.stringVal = stringVal;
return this;
}
public Builder doubleVal(Double doubleVal) {
this.doubleVal = doubleVal;
return this;
}
public Builder floatVal(Float floatVal) {
this.floatVal = floatVal;
return this;
}
public Builder longVal(Long longVal) {
this.longVal = longVal;
return this;
}
public Builder intVal(Integer intVal) {
this.intVal = intVal;
return this;
}
public Builder byteVal(Integer byteVal) {
this.byteVal = byteVal;
return this;
}
public Builder booleanVal(Boolean booleanVal) {
this.booleanVal = booleanVal;
return this;
}
public Builder map(List<DataBundleEntry> map) {
this.map = checkForNulls(map);
return this;
}
public Builder list(List<DataBundleTypedValue> list) {
this.list = checkForNulls(list);
return this;
}
public Builder stringArray(List<String> stringArray) {
this.stringArray = checkForNulls(stringArray);
return this;
}
public Builder longArray(List<Long> longArray) {
this.longArray = checkForNulls(longArray);
return this;
}
public Builder length(Integer length) {
this.length = length;
return this;
}
public Builder floatArray(List<Float> floatArray) {
this.floatArray = checkForNulls(floatArray);
return this;
}
@Override
public DataBundleValue build() {
return new DataBundleValue(this);
}
}
}

View File

@ -0,0 +1,33 @@
option java_package = "org.microg.gms.wearable.databundle";
option java_outer_classname = "DataBundleProto";
message DataBundle {
repeated DataBundleEntry entries = 1;
}
message DataBundleEntry {
optional string key = 1;
optional DataBundleTypedValue typedValue = 2;
}
message DataBundleTypedValue {
optional int32 type = 1;
optional DataBundleValue value = 2;
}
message DataBundleValue {
optional bytes byteArray = 1;
optional string stringVal = 2;
optional double doubleVal = 3;
optional float floatVal = 4;
optional int64 longVal = 5;
optional int32 intVal = 6;
optional int32 byteVal = 7;
optional bool booleanVal = 8;
repeated DataBundleEntry map = 9;
repeated DataBundleTypedValue list = 10;
repeated string stringArray = 11;
repeated int64 longArray = 12;
optional int32 length = 13;
repeated float floatArray = 14;
}