From d794c54c13c181d090e3fbdea358863900f40435 Mon Sep 17 00:00:00 2001 From: Marcello Martina Date: Mon, 18 Dec 2023 17:57:19 +0100 Subject: [PATCH 1/9] feat(sparkplug): added Sparkplug B Protobuf Payload support and utility classes Signed-off-by: Marcello Martina --- .../META-INF/MANIFEST.MF | 6 +- .../pom.xml | 13 + .../protobuf-gen.sh | 2 + .../SparkplugBProtobufPayloadBuilder.java | 175 + .../mqtt/message/SparkplugTopics.java | 61 + .../message/protobuf/SparkplugBProto.java | 20961 ++++++++++++++++ .../mqtt/message/protobuf/sparkplug_b.proto | 224 + .../META-INF/MANIFEST.MF | 10 +- .../SparkplugBProtobufPayloadBuilderTest.java | 314 + 9 files changed, 21761 insertions(+), 5 deletions(-) create mode 100755 kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/protobuf-gen.sh create mode 100644 kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugBProtobufPayloadBuilder.java create mode 100644 kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugTopics.java create mode 100644 kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/SparkplugBProto.java create mode 100644 kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/sparkplug_b.proto create mode 100644 kura/test/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider.test/src/test/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/test/SparkplugBProtobufPayloadBuilderTest.java diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF index 82e0c7fe795..cec57846539 100644 --- a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF @@ -4,8 +4,8 @@ Bundle-Name: Sparkplug MQTT Cloud Connection Provider Bundle-SymbolicName: org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider Bundle-Version: 1.0.0.qualifier Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: org.eclipse.kura;version="[1.0,2.0)", - org.eclipse.kura.configuration;version="[1.1,2.0)", +Import-Package: com.google.protobuf;version="[3.19,4.0]", + org.eclipse.kura;version="[1.0,2.0)", org.eclipse.kura.cloud;version="[1.1,2.0)", org.eclipse.kura.cloudconnection;version="[1.0,1.1)", org.eclipse.kura.cloudconnection.factory;version="[1.0,1.1)", @@ -14,9 +14,11 @@ Import-Package: org.eclipse.kura;version="[1.0,2.0)", org.eclipse.kura.cloudconnection.publisher;version="[1.0,1.1)", org.eclipse.kura.cloudconnection.subscriber;version="[1.0,1.1)", org.eclipse.kura.cloudconnection.subscriber.listener;version="[1.0,2.0)", + org.eclipse.kura.configuration;version="[1.1,2.0)", org.eclipse.kura.data;version="[1.0,2.0)", org.eclipse.kura.data.listener;version="[1.0,2.0)", org.eclipse.kura.data.transport.listener;version="[1.0,2.0)", + org.eclipse.kura.type;version="[1.1,2.0)", org.osgi.framework;version="1.8.0", org.osgi.service.component;version="1.2.0", org.osgi.service.event;version="1.3.1", diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml index 1fd93645075..8a86fca8f5d 100644 --- a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml @@ -30,6 +30,19 @@ ${project.basedir}/../test/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider.test/target/site/jacoco-aggregate/jacoco.xml + **/protobuf/* + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + **/protobuf/* + + + + diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/protobuf-gen.sh b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/protobuf-gen.sh new file mode 100755 index 00000000000..6a690fd6df0 --- /dev/null +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/protobuf-gen.sh @@ -0,0 +1,2 @@ +#!/bin/bash +protoc --proto_path=src/main/java --java_out=src/main/java src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/sparkplug_b.proto \ No newline at end of file diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugBProtobufPayloadBuilder.java b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugBProtobufPayloadBuilder.java new file mode 100644 index 00000000000..9a57f64c426 --- /dev/null +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugBProtobufPayloadBuilder.java @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2023 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ +package org.eclipse.kura.cloudconnection.sparkplug.mqtt.message; + +import java.math.BigInteger; +import java.util.Date; + +import org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.DataType; +import org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.Payload; +import org.eclipse.kura.type.TypedValue; + +import com.google.protobuf.ByteString; + +public class SparkplugBProtobufPayloadBuilder { + + public static final String BDSEQ_METRIC_NAME = "bdSeq"; + + private Payload.Builder payloadBuilder = Payload.newBuilder(); + + public SparkplugBProtobufPayloadBuilder withMetric(String name, Object value, DataType dataType, long timestamp) { + Payload.Metric.Builder metricBuilder = Payload.Metric.newBuilder(); + metricBuilder.setName(name); + metricBuilder.setDatatype(dataType.getNumber()); + metricBuilder.setTimestamp(timestamp); + + switch (dataType) { + case Boolean: + metricBuilder.setBooleanValue((Boolean) value); + break; + case Bytes: + metricBuilder.setBytesValue(ByteString.copyFrom((byte[]) value)); + break; + case Double: + metricBuilder.setDoubleValue((Double) value); + break; + case Float: + metricBuilder.setFloatValue((Float) value); + break; + case Int8: + metricBuilder.setIntValue((Byte) value); + break; + case Int16: + metricBuilder.setIntValue((Short) value); + break; + case Int32: + metricBuilder.setIntValue((Integer) value); + break; + case Int64: + metricBuilder.setLongValue((Long) value); + break; + case String: + case Text: + case UUID: + metricBuilder.setStringValue((String) value); + break; + case DateTime: + metricBuilder.setLongValue(((Date) value).getTime()); + break; + case UInt8: + metricBuilder.setIntValue(Short.toUnsignedInt((Short) value)); + break; + case UInt16: + metricBuilder.setIntValue((int) Integer.toUnsignedLong((Integer) value)); + break; + case UInt32: + metricBuilder.setLongValue(Long.parseUnsignedLong(Long.toUnsignedString((Long) value))); + break; + case UInt64: + metricBuilder.setLongValue(((BigInteger) value).longValue()); + break; + case DataSet: + case Template: + case PropertySet: + case PropertySetList: + case File: + case BooleanArray: + case DateTimeArray: + case UInt8Array: + case UInt64Array: + case UInt32Array: + case UInt16Array: + case StringArray: + case Int8Array: + case Int64Array: + case Int32Array: + case Int16Array: + case FloatArray: + case DoubleArray: + case Unknown: + default: + throw new UnsupportedOperationException("DataType " + dataType.toString() + " not implemented"); + } + + this.payloadBuilder.addMetrics(metricBuilder.build()); + + return this; + } + + public SparkplugBProtobufPayloadBuilder withMetric(String name, TypedValue value, long timestamp) { + DataType sparkplugDataType; + + switch (value.getType()) { + case BOOLEAN: + sparkplugDataType = DataType.Boolean; + break; + case BYTE_ARRAY: + sparkplugDataType = DataType.Bytes; + break; + case DOUBLE: + sparkplugDataType = DataType.Double; + break; + case FLOAT: + sparkplugDataType = DataType.Float; + break; + case INTEGER: + sparkplugDataType = DataType.Int32; + break; + case LONG: + sparkplugDataType = DataType.Int64; + break; + case STRING: + sparkplugDataType = DataType.String; + break; + default: + sparkplugDataType = DataType.Unknown; + break; + } + + return this.withMetric(name, value.getValue(), sparkplugDataType, timestamp); + } + + public SparkplugBProtobufPayloadBuilder withMetric(String name, TypedValue value) { + return this.withMetric(name, value, new Date().getTime()); + } + + public SparkplugBProtobufPayloadBuilder withBdSeq(long bdSeq, long timestamp) { + Payload.Metric.Builder bdSeqMetric = Payload.Metric.newBuilder(); + bdSeqMetric.setName(BDSEQ_METRIC_NAME); + bdSeqMetric.setLongValue(bdSeq); + bdSeqMetric.setDatatype(DataType.Int64.getNumber()); + bdSeqMetric.setTimestamp(timestamp); + + this.payloadBuilder.addMetrics(bdSeqMetric.build()); + return this; + } + + public SparkplugBProtobufPayloadBuilder withSeq(long seq) { + this.payloadBuilder.setSeq(seq); + return this; + } + + public SparkplugBProtobufPayloadBuilder withTimestamp(long timestamp) { + this.payloadBuilder.setTimestamp(timestamp); + return this; + } + + public Payload buildPayload() { + return this.payloadBuilder.build(); + } + + public byte[] build() { + return this.buildPayload().toByteArray(); + } + +} diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugTopics.java b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugTopics.java new file mode 100644 index 00000000000..85595f32c64 --- /dev/null +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/SparkplugTopics.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2023 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ +package org.eclipse.kura.cloudconnection.sparkplug.mqtt.message; + + +public class SparkplugTopics { + + private SparkplugTopics() { + } + + private static final String NAMESPACE = "spBv1.0"; + + // Edge Node topics + + public static String getNodeBirthTopic(String groupId, String nodeId) { + return String.format("%s/%s/NBIRTH/%s", NAMESPACE, groupId, nodeId); + } + + public static String getNodeDeathTopic(String groupId, String nodeId) { + return String.format("%s/%s/NDEATH/%s", NAMESPACE, groupId, nodeId); + } + + public static String getNodeCommandTopic(String groupId, String nodeId) { + return String.format("%s/%s/NCMD/%s", NAMESPACE, groupId, nodeId); + } + + // Device topics + + public static String getDeviceBirthTopic(String groupId, String nodeId, String deviceId) { + return String.format("%s/%s/DBIRTH/%s/%s", NAMESPACE, groupId, nodeId, deviceId); + } + + public static String getDeviceDeathTopic(String groupId, String nodeId, String deviceId) { + return String.format("%s/%s/DDEATH/%s/%s", NAMESPACE, groupId, nodeId, deviceId); + } + + public static String getDeviceDataTopic(String groupId, String nodeId, String deviceId) { + return String.format("%s/%s/DDATA/%s/%s", NAMESPACE, groupId, nodeId, deviceId); + } + + public static String getDeviceCommandTopic(String groupId, String nodeId, String deviceId) { + return String.format("%s/%s/DCMD/%s/%s", NAMESPACE, groupId, nodeId, deviceId); + } + + // Host Application topics + + public static String getStateTopic(String hostId) { + return String.format("%s/STATE/%s", NAMESPACE, hostId); + } + +} diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/SparkplugBProto.java b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/SparkplugBProto.java new file mode 100644 index 00000000000..eba505759b7 --- /dev/null +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/src/main/java/org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/SparkplugBProto.java @@ -0,0 +1,20961 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: org/eclipse/kura/cloudconnection/sparkplug/mqtt/message/protobuf/sparkplug_b.proto + +package org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf; + +public final class SparkplugBProto { + private SparkplugBProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + *
+   * Indexes of Data Types
+   * 
+ * + * Protobuf enum {@code org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.DataType} + */ + public enum DataType + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
+     * Unknown placeholder for future expansion.
+     * 
+ * + * Unknown = 0; + */ + Unknown(0), + /** + *
+     * Basic Types
+     * 
+ * + * Int8 = 1; + */ + Int8(1), + /** + * Int16 = 2; + */ + Int16(2), + /** + * Int32 = 3; + */ + Int32(3), + /** + * Int64 = 4; + */ + Int64(4), + /** + * UInt8 = 5; + */ + UInt8(5), + /** + * UInt16 = 6; + */ + UInt16(6), + /** + * UInt32 = 7; + */ + UInt32(7), + /** + * UInt64 = 8; + */ + UInt64(8), + /** + * Float = 9; + */ + Float(9), + /** + * Double = 10; + */ + Double(10), + /** + * Boolean = 11; + */ + Boolean(11), + /** + * String = 12; + */ + String(12), + /** + * DateTime = 13; + */ + DateTime(13), + /** + * Text = 14; + */ + Text(14), + /** + *
+     * Additional Metric Types
+     * 
+ * + * UUID = 15; + */ + UUID(15), + /** + * DataSet = 16; + */ + DataSet(16), + /** + * Bytes = 17; + */ + Bytes(17), + /** + * File = 18; + */ + File(18), + /** + * Template = 19; + */ + Template(19), + /** + *
+     * Additional PropertyValue Types
+     * 
+ * + * PropertySet = 20; + */ + PropertySet(20), + /** + * PropertySetList = 21; + */ + PropertySetList(21), + /** + *
+     * Array Types
+     * 
+ * + * Int8Array = 22; + */ + Int8Array(22), + /** + * Int16Array = 23; + */ + Int16Array(23), + /** + * Int32Array = 24; + */ + Int32Array(24), + /** + * Int64Array = 25; + */ + Int64Array(25), + /** + * UInt8Array = 26; + */ + UInt8Array(26), + /** + * UInt16Array = 27; + */ + UInt16Array(27), + /** + * UInt32Array = 28; + */ + UInt32Array(28), + /** + * UInt64Array = 29; + */ + UInt64Array(29), + /** + * FloatArray = 30; + */ + FloatArray(30), + /** + * DoubleArray = 31; + */ + DoubleArray(31), + /** + * BooleanArray = 32; + */ + BooleanArray(32), + /** + * StringArray = 33; + */ + StringArray(33), + /** + * DateTimeArray = 34; + */ + DateTimeArray(34), + ; + + /** + *
+     * Unknown placeholder for future expansion.
+     * 
+ * + * Unknown = 0; + */ + public static final int Unknown_VALUE = 0; + /** + *
+     * Basic Types
+     * 
+ * + * Int8 = 1; + */ + public static final int Int8_VALUE = 1; + /** + * Int16 = 2; + */ + public static final int Int16_VALUE = 2; + /** + * Int32 = 3; + */ + public static final int Int32_VALUE = 3; + /** + * Int64 = 4; + */ + public static final int Int64_VALUE = 4; + /** + * UInt8 = 5; + */ + public static final int UInt8_VALUE = 5; + /** + * UInt16 = 6; + */ + public static final int UInt16_VALUE = 6; + /** + * UInt32 = 7; + */ + public static final int UInt32_VALUE = 7; + /** + * UInt64 = 8; + */ + public static final int UInt64_VALUE = 8; + /** + * Float = 9; + */ + public static final int Float_VALUE = 9; + /** + * Double = 10; + */ + public static final int Double_VALUE = 10; + /** + * Boolean = 11; + */ + public static final int Boolean_VALUE = 11; + /** + * String = 12; + */ + public static final int String_VALUE = 12; + /** + * DateTime = 13; + */ + public static final int DateTime_VALUE = 13; + /** + * Text = 14; + */ + public static final int Text_VALUE = 14; + /** + *
+     * Additional Metric Types
+     * 
+ * + * UUID = 15; + */ + public static final int UUID_VALUE = 15; + /** + * DataSet = 16; + */ + public static final int DataSet_VALUE = 16; + /** + * Bytes = 17; + */ + public static final int Bytes_VALUE = 17; + /** + * File = 18; + */ + public static final int File_VALUE = 18; + /** + * Template = 19; + */ + public static final int Template_VALUE = 19; + /** + *
+     * Additional PropertyValue Types
+     * 
+ * + * PropertySet = 20; + */ + public static final int PropertySet_VALUE = 20; + /** + * PropertySetList = 21; + */ + public static final int PropertySetList_VALUE = 21; + /** + *
+     * Array Types
+     * 
+ * + * Int8Array = 22; + */ + public static final int Int8Array_VALUE = 22; + /** + * Int16Array = 23; + */ + public static final int Int16Array_VALUE = 23; + /** + * Int32Array = 24; + */ + public static final int Int32Array_VALUE = 24; + /** + * Int64Array = 25; + */ + public static final int Int64Array_VALUE = 25; + /** + * UInt8Array = 26; + */ + public static final int UInt8Array_VALUE = 26; + /** + * UInt16Array = 27; + */ + public static final int UInt16Array_VALUE = 27; + /** + * UInt32Array = 28; + */ + public static final int UInt32Array_VALUE = 28; + /** + * UInt64Array = 29; + */ + public static final int UInt64Array_VALUE = 29; + /** + * FloatArray = 30; + */ + public static final int FloatArray_VALUE = 30; + /** + * DoubleArray = 31; + */ + public static final int DoubleArray_VALUE = 31; + /** + * BooleanArray = 32; + */ + public static final int BooleanArray_VALUE = 32; + /** + * StringArray = 33; + */ + public static final int StringArray_VALUE = 33; + /** + * DateTimeArray = 34; + */ + public static final int DateTimeArray_VALUE = 34; + + + public final int getNumber() { + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DataType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static DataType forNumber(int value) { + switch (value) { + case 0: return Unknown; + case 1: return Int8; + case 2: return Int16; + case 3: return Int32; + case 4: return Int64; + case 5: return UInt8; + case 6: return UInt16; + case 7: return UInt32; + case 8: return UInt64; + case 9: return Float; + case 10: return Double; + case 11: return Boolean; + case 12: return String; + case 13: return DateTime; + case 14: return Text; + case 15: return UUID; + case 16: return DataSet; + case 17: return Bytes; + case 18: return File; + case 19: return Template; + case 20: return PropertySet; + case 21: return PropertySetList; + case 22: return Int8Array; + case 23: return Int16Array; + case 24: return Int32Array; + case 25: return Int64Array; + case 26: return UInt8Array; + case 27: return UInt16Array; + case 28: return UInt32Array; + case 29: return UInt64Array; + case 30: return FloatArray; + case 31: return DoubleArray; + case 32: return BooleanArray; + case 33: return StringArray; + case 34: return DateTimeArray; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + DataType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DataType findValueByNumber(int number) { + return DataType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.getDescriptor().getEnumTypes().get(0); + } + + private static final DataType[] VALUES = values(); + + public static DataType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private DataType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.DataType) + } + + public interface PayloadOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload) + com.google.protobuf.GeneratedMessageV3. + ExtendableMessageOrBuilder { + + /** + *
+     * Timestamp at message sending time
+     * 
+ * + * optional uint64 timestamp = 1; + * @return Whether the timestamp field is set. + */ + boolean hasTimestamp(); + /** + *
+     * Timestamp at message sending time
+     * 
+ * + * optional uint64 timestamp = 1; + * @return The timestamp. + */ + long getTimestamp(); + + /** + *
+     * Repeated forever - no limit in Google Protobufs
+     * 
+ * + * repeated .org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload.Metric metrics = 2; + */ + java.util.List + getMetricsList(); + /** + *
+     * Repeated forever - no limit in Google Protobufs
+     * 
+ * + * repeated .org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload.Metric metrics = 2; + */ + org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.Payload.Metric getMetrics(int index); + /** + *
+     * Repeated forever - no limit in Google Protobufs
+     * 
+ * + * repeated .org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload.Metric metrics = 2; + */ + int getMetricsCount(); + /** + *
+     * Repeated forever - no limit in Google Protobufs
+     * 
+ * + * repeated .org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload.Metric metrics = 2; + */ + java.util.List + getMetricsOrBuilderList(); + /** + *
+     * Repeated forever - no limit in Google Protobufs
+     * 
+ * + * repeated .org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload.Metric metrics = 2; + */ + org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.Payload.MetricOrBuilder getMetricsOrBuilder( + int index); + + /** + *
+     * Sequence number
+     * 
+ * + * optional uint64 seq = 3; + * @return Whether the seq field is set. + */ + boolean hasSeq(); + /** + *
+     * Sequence number
+     * 
+ * + * optional uint64 seq = 3; + * @return The seq. + */ + long getSeq(); + + /** + *
+     * UUID to track message type in terms of schema definitions
+     * 
+ * + * optional string uuid = 4; + * @return Whether the uuid field is set. + */ + boolean hasUuid(); + /** + *
+     * UUID to track message type in terms of schema definitions
+     * 
+ * + * optional string uuid = 4; + * @return The uuid. + */ + java.lang.String getUuid(); + /** + *
+     * UUID to track message type in terms of schema definitions
+     * 
+ * + * optional string uuid = 4; + * @return The bytes for uuid. + */ + com.google.protobuf.ByteString + getUuidBytes(); + + /** + *
+     * To optionally bypass the whole definition above
+     * 
+ * + * optional bytes body = 5; + * @return Whether the body field is set. + */ + boolean hasBody(); + /** + *
+     * To optionally bypass the whole definition above
+     * 
+ * + * optional bytes body = 5; + * @return The body. + */ + com.google.protobuf.ByteString getBody(); + } + /** + * Protobuf type {@code org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload} + */ + public static final class Payload extends + com.google.protobuf.GeneratedMessageV3.ExtendableMessage< + Payload> implements + // @@protoc_insertion_point(message_implements:org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload) + PayloadOrBuilder { + private static final long serialVersionUID = 0L; + // Use Payload.newBuilder() to construct. + private Payload(com.google.protobuf.GeneratedMessageV3.ExtendableBuilder builder) { + super(builder); + } + private Payload() { + metrics_ = java.util.Collections.emptyList(); + uuid_ = ""; + body_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Payload(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.internal_static_org_eclipse_kura_cloudconnection_sparkplug_mqtt_message_protobuf_Payload_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.internal_static_org_eclipse_kura_cloudconnection_sparkplug_mqtt_message_protobuf_Payload_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.Payload.class, org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.SparkplugBProto.Payload.Builder.class); + } + + public interface TemplateOrBuilder extends + // @@protoc_insertion_point(interface_extends:org.eclipse.kura.cloudconnection.sparkplug.mqtt.message.protobuf.Payload.Template) + com.google.protobuf.GeneratedMessageV3. + ExtendableMessageOrBuilder