sparkplug_b.proto 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. // Downloaded from: https://github.com/eclipse/tahu/blob/46f25e79f34234e6145d11108660dfd9133ae50d/sparkplug_b/sparkplug_b.proto
  2. //
  3. // License for this file is located in the same directory as this file.
  4. //
  5. // * Copyright (c) 2015, 2018 Cirrus Link Solutions and others
  6. // *
  7. // * This program and the accompanying materials are made available under the
  8. // * terms of the Eclipse Public License 2.0 which is available at
  9. // * http://www.eclipse.org/legal/epl-2.0.
  10. // *
  11. // * SPDX-License-Identifier: EPL-2.0
  12. // *
  13. // * Contributors:
  14. // * Cirrus Link Solutions - initial implementation
  15. //
  16. // To compile:
  17. // cd client_libraries/java
  18. // protoc --proto_path=../../ --java_out=src/main/java ../../sparkplug_b.proto
  19. //
  20. syntax = "proto2";
  21. package org.eclipse.tahu.protobuf;
  22. option java_package = "org.eclipse.tahu.protobuf";
  23. option java_outer_classname = "SparkplugBProto";
  24. enum DataType {
  25. // Indexes of Data Types
  26. // Unknown placeholder for future expansion.
  27. Unknown = 0;
  28. // Basic Types
  29. Int8 = 1;
  30. Int16 = 2;
  31. Int32 = 3;
  32. Int64 = 4;
  33. UInt8 = 5;
  34. UInt16 = 6;
  35. UInt32 = 7;
  36. UInt64 = 8;
  37. Float = 9;
  38. Double = 10;
  39. Boolean = 11;
  40. String = 12;
  41. DateTime = 13;
  42. Text = 14;
  43. // Additional Metric Types
  44. UUID = 15;
  45. DataSet = 16;
  46. Bytes = 17;
  47. File = 18;
  48. Template = 19;
  49. // Additional PropertyValue Types
  50. PropertySet = 20;
  51. PropertySetList = 21;
  52. // Array Types
  53. Int8Array = 22;
  54. Int16Array = 23;
  55. Int32Array = 24;
  56. Int64Array = 25;
  57. UInt8Array = 26;
  58. UInt16Array = 27;
  59. UInt32Array = 28;
  60. UInt64Array = 29;
  61. FloatArray = 30;
  62. DoubleArray = 31;
  63. BooleanArray = 32;
  64. StringArray = 33;
  65. DateTimeArray = 34;
  66. }
  67. message Payload {
  68. message Template {
  69. message Parameter {
  70. optional string name = 1;
  71. optional uint32 type = 2;
  72. oneof value {
  73. uint32 int_value = 3;
  74. uint64 long_value = 4;
  75. float float_value = 5;
  76. double double_value = 6;
  77. bool boolean_value = 7;
  78. string string_value = 8;
  79. ParameterValueExtension extension_value = 9;
  80. }
  81. message ParameterValueExtension {
  82. extensions 1 to max;
  83. }
  84. }
  85. optional string version = 1; // The version of the Template to prevent mismatches
  86. repeated Metric metrics = 2; // Each metric includes a name, datatype, and optionally a value
  87. repeated Parameter parameters = 3;
  88. optional string template_ref = 4; // MUST be a reference to a template definition if this is an instance (i.e. the name of the template definition) - MUST be omitted for template definitions
  89. optional bool is_definition = 5;
  90. extensions 6 to max;
  91. }
  92. message DataSet {
  93. message DataSetValue {
  94. oneof value {
  95. uint32 int_value = 1;
  96. uint64 long_value = 2;
  97. float float_value = 3;
  98. double double_value = 4;
  99. bool boolean_value = 5;
  100. string string_value = 6;
  101. DataSetValueExtension extension_value = 7;
  102. }
  103. message DataSetValueExtension {
  104. extensions 1 to max;
  105. }
  106. }
  107. message Row {
  108. repeated DataSetValue elements = 1;
  109. extensions 2 to max; // For third party extensions
  110. }
  111. optional uint64 num_of_columns = 1;
  112. repeated string columns = 2;
  113. repeated uint32 types = 3;
  114. repeated Row rows = 4;
  115. extensions 5 to max; // For third party extensions
  116. }
  117. message PropertyValue {
  118. optional uint32 type = 1;
  119. optional bool is_null = 2;
  120. oneof value {
  121. uint32 int_value = 3;
  122. uint64 long_value = 4;
  123. float float_value = 5;
  124. double double_value = 6;
  125. bool boolean_value = 7;
  126. string string_value = 8;
  127. PropertySet propertyset_value = 9;
  128. PropertySetList propertysets_value = 10; // List of Property Values
  129. PropertyValueExtension extension_value = 11;
  130. }
  131. message PropertyValueExtension {
  132. extensions 1 to max;
  133. }
  134. }
  135. message PropertySet {
  136. repeated string keys = 1; // Names of the properties
  137. repeated PropertyValue values = 2;
  138. extensions 3 to max;
  139. }
  140. message PropertySetList {
  141. repeated PropertySet propertyset = 1;
  142. extensions 2 to max;
  143. }
  144. message MetaData {
  145. // Bytes specific metadata
  146. optional bool is_multi_part = 1;
  147. // General metadata
  148. optional string content_type = 2; // Content/Media type
  149. optional uint64 size = 3; // File size, String size, Multi-part size, etc
  150. optional uint64 seq = 4; // Sequence number for multi-part messages
  151. // File metadata
  152. optional string file_name = 5; // File name
  153. optional string file_type = 6; // File type (i.e. xml, json, txt, cpp, etc)
  154. optional string md5 = 7; // md5 of data
  155. // Catchalls and future expansion
  156. optional string description = 8; // Could be anything such as json or xml of custom properties
  157. extensions 9 to max;
  158. }
  159. message Metric {
  160. optional string name = 1; // Metric name - should only be included on birth
  161. optional uint64 alias = 2; // Metric alias - tied to name on birth and included in all later DATA messages
  162. optional uint64 timestamp = 3; // Timestamp associated with data acquisition time
  163. optional uint32 datatype = 4; // DataType of the metric/tag value
  164. optional bool is_historical = 5; // If this is historical data and should not update real time tag
  165. optional bool is_transient = 6; // Tells consuming clients such as MQTT Engine to not store this as a tag
  166. optional bool is_null = 7; // If this is null - explicitly say so rather than using -1, false, etc for some datatypes.
  167. optional MetaData metadata = 8; // Metadata for the payload
  168. optional PropertySet properties = 9;
  169. oneof value {
  170. uint32 int_value = 10;
  171. uint64 long_value = 11;
  172. float float_value = 12;
  173. double double_value = 13;
  174. bool boolean_value = 14;
  175. string string_value = 15;
  176. bytes bytes_value = 16; // Bytes, File
  177. DataSet dataset_value = 17;
  178. Template template_value = 18;
  179. MetricValueExtension extension_value = 19;
  180. }
  181. message MetricValueExtension {
  182. extensions 1 to max;
  183. }
  184. }
  185. optional uint64 timestamp = 1; // Timestamp at message sending time
  186. repeated Metric metrics = 2; // Repeated forever - no limit in Google Protobufs
  187. optional uint64 seq = 3; // Sequence number
  188. optional string uuid = 4; // UUID to track message type in terms of schema definitions
  189. optional bytes body = 5; // To optionally bypass the whole definition above
  190. extensions 6 to max; // For third party extensions
  191. }