# Supported Data Types
An essential part of defining a new type definition is identifying the properties and variables you want to include. For each, you need to specify at minimum the name and data type. The following covers all possible data types that are supported by the ABB Ability™ Platform.
# Primitive Data Types
# String
String represents an arbitrarily long string. Use it if you want to store text values, for example, names, serial numbers, dates.
# Example type definition
"serialNumber": {
"description": "Serial number of the robot.",
"dataType": "string",
"isMandatory": true
}
# Example Payload
"value": "QGT76DWHW98DHEYSJA"
# Integer
Integer represents an integer value. Use it for numerical values that do not require decimal places, for example, the count of some event occurrences or the number of online devices being online, etc.
The integer type represents 32-bit signed integers with values that range from negative 2,147,483,648 to positive 2,147,483,647.
# Example Type Definition
"oilChangeCount": {
"description": "Number of oil changes in the motor.",
"dataType": "integer"
}
# Example Payload
"value": 7
# Number
Number represents a floating-point value. Use it for numerical values that require a decimal place, for example, temperature measurements or a robot's arm position in degrees.
The number type complies with the IEC 60559:1989 (IEEE 754) standard for binary floating-point arithmetic and represents a double-precision 64-bit number with values ranging from negative 1.79769313486232e308 to positive 1.79769313486232e308. Special values (e.g PositiveInfinity, NegativeInfinity, and not a number - NaN) are not supported.
# Example Type Definition
"temperature": {
"description": "Temperature measurement",
"dataType": "number",
"unit": "°C"
}
# Example Payload
"value": 12.489
# Boolean
Boolean represents a binary-state value (true
or false
). Use it for
true/false values, for example, a variable informing if a motor is running, a
property informing if a robot has a camera attached, etc.
# Example Type Definition
"isRunning": {
"description": "Current state of the motor.",
"dataType": "boolean"
}
# Example Payload
"value": true
# Non-primitive Data Types
# Array
Array represents a collection of primitive data type values. Use it for collections of data of the same type, for example, multi-dimensional measurements, a list of tools attached to a robot, etc.
# Example Type Definition
"robotTools": {
"dataType": "array",
"items": "string"
}
# Example Payload
"value": ["camera", "proximity sensor"]
# Map
Map represents an unordered collection of key-value pair elements - it is a dictionary/hashmap/associative array. Keys can be only of type string. Values can be defined as primitive or non-primitive types (e.g., map of arrays or map of maps are both supported). In the holistic view, the content of a map will always be wrapped inside "value". Use it for the dictionary like data structures, for example, information about error codes and their descriptions, configurations of some device, etc. The examples below present how maps look synthetically in Ability Platform's Information Model - they differ from typical JSON key-value pair representation.
# Example Type Definitions
# Map of Strings
"errorCodes" : {
"dataType": "map",
"values": "string"
}
# Map of Arrays of Strings
"tools" : {
"dataType": "map",
"values": {
"dataType": "array",
"items": "string"
}
}
# Map of Maps
Without attributes:
"mainMap" : {
"dataType": "map",
"values": {
"innerProps": {
"dataType": "map",
"values": "string"
}
}
}
With attributes:
"mainMap" : {
"mapLevelAttribute" : ["123", "345"],
"dataType": "map",
"values": {
"innerProps" : {
"anotherMapLevelAttribute" : ["123", "345"],
"dataType" : "map",
"values" : "string"
}
}
}
# Example Payloads
# Map of Strings
"value": {
"089": {
"value": "Communication interface is blocked"
},
"090" : {
"value": "Values cannot be fetched"
}
}
# Map of Arrays of Strings
"value": {
"mode 1": {
"value": ["camera", "proximity sensor"]
},
"mode 2" : {
"value": ["camera", "proximity sensor", "infra red laser"]
}
}
# Map of Maps
The "value" of the map properties can be omitted as long as there are no attributes defined on the map property:
"mainMap" : {
"keyOne" : {
"innerProps" : {
"subKey" : {
"value" : "V1"
}
}
},
"keyTwo" : {
"innerProps" : {
"anotherSubKey" : {
"value" : "abc"
}
}
}
}
In case there are map-level attributes defined in the type:
"mainMap" : {
"mapLevelAttr1" : "123",
"value" : {
"keyOne" : {
"innerProps" : {
"anotherMapLevelAttr" : "123",
"value" : {
"subKey" : {
"value" : "V1"
}
}
}
},
"keyTwo" : {
"innerProps" : {
"anotherMapLevelAttr" : "345",
"value" : {
"anotherSubKey" : {
"value" : "abc"
}
}
}
}
}
}
# Additions
# File
File represents a blob kind of data. This data type can be used only in a method definition to describe a method's input.
# Example Type Definition (Method Declaration)
"updateFirmware": {
"input": {
"dataType": "file"
}
}
# Example Payload (While Calling a Method)
The file needs to exist in tenant specific storage.
"input": {
"file": "firmwareV3.zip"
}
# Enumeration
An enumeration definition can accompany primitive data types. The role of enumeration in a type definition's property or variable declaration is to limit its possible values, for example, defining possible connection methods, defining possible error codes that a device can report, etc.
# Example Type Definition
"communicationProtocol": {
"description": "Interface used for communication with the device.",
"dataType": "string",
"enum": ["modbus", "opc ua"]
}