Sparkplug has its own type system, based on a set of built-in types. The types in Microsoft .NET are different, and all data is represented using an Object type and its derivatives. Conversions between the two are available, but not always fully possible.
In addition, not everything that can be stored in an Object can later be processed by all .NET tools and languages. Microsoft has created so-called Common Language Specification (CLS), which has certain rules and restrictions that, if followed, guarantee cross-language compatibility. Public Connectivity Software components (assemblies) are fully CLS compliant, and that includes the way the data types are converted to and from Sparkplug types.
Rapid Toolkit for Sparkplug converts data from Sparkplug to .NET and vice versa according to following table:
| Sparkplug type | .NET type (Object), in C# notation |
| Boolean | System.Boolean |
| BooleanArray | System.Boolean[] |
| Bytes | System.Byte[] |
| DateTime | System.DateTime (UTC) |
| DateTimeArray | System.DateTime[] (UTC) |
| Double | System.Double |
| DoubleArray | System.Double[] |
| Float | System.Single |
| FloatArray | System.Single[] |
| Int16 | System.Int16 |
| Int16Array | System.Int16[] |
| Int32 | System.Int32 |
| Int32Array | System.Int32[] |
| Int64 | System.Int64 |
| Int64Array | System.Int64[] |
| Int8 | System.Int16 |
| Int8Array | System.Int16[] |
| String | System.String |
| StringArray | System.String[] |
| Text | System.String |
| UInt16 | System.Int32 |
| UInt16Array | System.Int32[] |
| UInt32 | System.Int64 |
| UInt32Array | System.Int64[] |
| UInt64 | System.Decimal |
| UInt64Array | System.Decimal[] |
| UInt8 | System.Byte |
| UInt8Array | System.Byte[] |
| Uuid | System.Guid |
Types that are highlighted do not convert from Sparkplug to their “natural” .NET counterparts, because the corresponding .NET type is not CLS compliant. Instead, a “wider” type that is CLS compliant is chosen.
Types not listed in the above table at all are not supported.
Strings are internally represented in Unicode.
Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.