This article describes the parameters in the JSON file where a Thing Specification Language (TSL) model is defined.

Note To demonstrate the full structure of the TSL model, the following example includes all parameters. However, the parameters may vary in actual scenarios. The string that follows each parameter is the description of the parameter. For the scenarios of each parameter, see the parameter description.
{
    "schema": "The URL of the TSL model",
    "profile": {
        "productKey": "The ProductKey of the product"
    },
    "properties": [
        {
            "identifier": "The identifier of the property. The identifier must be unique in a product."
            "name": "The name of the property",
            "accessMode": "The access mode of the property. Valid values: r (read-only) and rw (read-write).",
            "required": "Specifies whether this property is required",
            "dataType": {
                "type": "The data type of the property. Valid values: int, float, double, text, date (UTC timestamp in the string format), bool (0 or 1), enum (integers that are defined in the same way as the data of the bool type), struct (a struct that can include the previous seven data types. "specs": [{}] is used to describe the included objects), and array (an array that can include the int, double, float, text, and struct data types).",
                "specs": {
                    "min": "The minimum value. This parameter is available only for properties of the int, float, or double type.",
                    "max": "The maximum value. This parameter is available only for properties of the int, float, or double type.",
                    "unit": "Optional. The unit of the property. This parameter is available only for properties of the int, float, or double type.",
                    "unitName": "The name of the unit. This parameter is available only for properties of the int, float, or double type.",
                    "size": "The number of elements in the array. Maximum value: 512. This parameter is available only for properties of the array type.",
                    "step": "The step size. This parameter is unavailable for properties of the text or enum type.",
                    "length": "The data length. Maximum value: 10240. This parameter is available only for properties of the text type.",
                    "0": "The value of 0. This value is available only for properties of the bool type.",
                    "1": "The value of 1. This value is available only for properties of the bool type.",
                    "item": {
                        "type": "The type of the array element. This parameter is available only for properties of the array type.",
                    }
                }
            }
        }
    ],
    "events": [
        {
            "identifier": "The identifier of the event. The identifier must be unique in a product. The value post indicates the event of property submission."
            "name": "The name of the event",
            "desc": "The description of the event",
            "type": "The type of the event. Valid values: info, alert, and error.",
            "required": "Specifies whether this event is required",
            "outputData": [
                {
                    "identifier": "The unique identifier of the parameter",
                    "name": "The name of the parameter",
                    "dataType": {
                        "type": "The data type of the parameter. Valid values: int, float, double, text, date (UTC timestamp in the string format), bool (0 or 1), enum (integers that are defined in the same way as the data of the bool type), struct (a struct that can include the previous seven data types. "specs": [{}] is used to describe the included objects), and array (an array that can include the int, double, float, text, and struct data types).",
                        "specs": {
                            "min": "The minimum value. This parameter is available only for event parameters of the int, float, or double type.",
                            "max": "The maximum value. This parameter is available only for event parameters of the int, float, or double type.",
                            "unit": "Optional. The unit of the parameter. This parameter is available only for event parameters of the int, float, or double type.",
                            "unitName": "The name of the unit. This parameter is available only for event parameters of the int, float, or double type.",
                            "size": "The number of elements in the array. Maximum value: 512. This parameter is available only for event parameters of the array type.",
                            "step": "The step size. This parameter is unavailable for event parameters of the text or enum type.",
                            "length": "The data length. Maximum value: 10240. This parameter is available only for event parameters of the text type.",
                            "0": "The value of 0. This value is available only for event parameters of the bool type.",
                            "1": "The value of 1. This value is available only for event parameters of the bool type.",
                            "item": {
                                "type": "The type of the array element. This parameter is available only for event parameters of the array type.",
                            }
                        }
                    }
                }
            ],
            "method": "The method that is generated based on the event identifier"
        }
    ],
    "services": [
        {
            "identifier": "The identifier of the service. The identifier must be unique in a product. The set and get services are pre-defined based on the accessMode parameter of a property.",
            "name": "The name of the service",
            "desc": "The description of the service",
            "required": "Specifies whether this service is required",
            "callType": "The call type of the service. Valid values: async (asynchronous call) and sync (synchronous call)",
            "inputData": [
                {
                    "identifier": "The unique identifier of the input parameter",
                    "name": "The name of the input parameter",
                    "dataType": {
                        "type": "The data type of the input parameter. Valid values: int, float, double, text, date (UTC timestamp in the string format), bool (0 or 1), enum (integers that are defined in the same way as the data of the bool type), struct (a struct that can include the previous seven data types. "specs": [{}] is used to describe the included objects), and array (an array that can include the int, double, float, text, and struct data types).",
                        "specs": {
                            "min": "The minimum value. This parameter is available only for input parameters of the int, float, or double type.",
                            "max": "The maximum value. This parameter is available only for input parameters of the int, float, or double type.",
                            "unit": "Optional. The unit of the input parameter. This parameter is available only for input parameters of the int, float, or double type.",
                            "unitName": "The name of the unit. This parameter is available only for input parameters of the int, float, or double type.",
                            "size": "The number of elements in the array. Maximum value: 512. This parameter is available only for input parameters of the array type.",
                            "step": "The step size. This parameter is unavailable for input parameters of the text or enum type.",
                            "length": "The data length. Maximum value: 10240. This parameter is available only for input parameters of the text type.",
                            "0": "The value of 0. This value is available only for input parameters of the bool type.",
                            "1": "The value of 1. This value is available only for input parameters of the bool type.",
                            "item": {
                                "type": "The type of the array element. This parameter is available only for input parameters of the array type.",
                                }
                            }
                        }
                    }
                }
            ],
            "outputData": [
                {
                    "identifier": "The unique identifier of the output parameter",
                    "name": "The name of the output parameter",
                    "dataType": {
                        "type": "The data type of the output parameter. Valid values: int, float, double, text, date (UTC timestamp in the string format), bool (0 or 1), enum (integers that are defined in the same way as the data of the bool type), struct (a struct that can include the previous seven data types. "specs": [{}] is used to describe the included objects), and array (an array that can include the int, double, float, text, and struct data types).",
                        "specs": {
                            "min": "The minimum value. This parameter is available only for output parameters of the int, float, or double type.",
                            "max": "The maximum value. This parameter is available only for output parameters of the int, float, or double type.",
                            "unit": "Optional. The unit of the output parameter. This parameter is available only for output parameters of the int, float, or double type.",
                            "unitName": "The name of the unit. This parameter is available only for output parameters of the int, float, or double type.",
                            "size": "The number of elements in the array. Maximum value: 512. This parameter is available only for output parameters of the int, float, or double type.",
                            "step": "The step size. This parameter is unavailable for output parameters of the text or enum type.",
                            "length": "The data length. Maximum value: 10240. This parameter is available only for output parameters of the text type.",
                            "0": "The value of 0. This value is available only for output parameters of the bool type.",
                            "1": "The value of 1. This value is available only for output parameters of the bool type.",
                            "item": {
                                "type": "The type of the array element. This parameter is available only for output parameters of the array type.",
                            }
                        }
                    }
                }
            ],
            "method": "The method that is generated based on the service identifier"
        }
    ],
    // The TSL model in a custom module have the following parameters: 
    "functionBlockId": "The unique identifier of the custom module",
    "functionBlockName": "The name of the custom module"

    // If a custom module is created in the product, the TSL model in the default module has the functionBlocks parameter, which indicates the details about the custom module. 
    "functionBlocks": [
    {
      "functionBlockId": "The unique identifier of the custom module",
      "functionBlockName": "The name of the custom module"
      "productKey": "The ProductKey of the product"
    }
  ]
}

If the node type of a product is gateway sub-device and the gateway connection protocol is Modbus, OPC UA, or custom, you can view the extended information of the TSL model.

For example, the node type of a product is set to gateway sub-device and the gateway connection protocol is set to Modbus. The extended information of the TSL model can be used in Link IoT Edge for sub-devices. For more information, see Modbus drivers.

Example of a Modbus product:

{
  "profile": {
    "productKey": "The ProductKey of the product"
  },
  "properties": [
    {
      "identifier": The identifier of the property. The identifier must be unique in a product.
      "operateType": "The operation type. Valid values: coilStatus, inputStatus, holdingRegister, and inputRegister.",
      "registerAddress": "The register address",
      "originalDataType": {
        "type": "The type of the original data. Valid values: int16, uint16, int32, uint32, int64, uint64, float, double, string, bool, and customized data (hex values in the big-endian format).",
        "specs": {
          "registerCount": "The number of registers. This parameter is available only for the original data of the string or customized data type. ",
          "swap16": "Specifies whether to switch the high byte and low byte in the register. If so, the first and last 8 bits of the 16-bit integer in the register are swapped (byte1byte2 -> byte2byte1). This parameter is available for properties of all data types except for string and bool.",
          "reverseRegister": "Specifies whether to switch the high byte and low byte in the register. If so, the first and last 16 bits of the 32-bit integer in the register are swapped (byte1byte2byte3byte4 -> byte3byte4byte1byte2). This parameter is available for properties of all data types except for string and bool."
        }
      },
      "scaling": "The scaling factor. This parameter is available for properties of all data types except for string and bool."
      "trigger": The method to submit data. Valid values: 1 and 2. The value 1 indicates that data is submitted at a specific time. The value 2 indicates that data changes are submitted.",
      "writeFunctionCode": "The read/write operation. The valid values of this parameter vary based on the value of the operateType parameter. If the operateType parameter is set to coilStatus, the valid values are: 5 (read/write: read 0x01 and write 0x05), 15 (read/write: read 0x01 and write 0x0F), 0 (read-only 0x01), 6 (write-only 0x05), and 15 (write-only 0x0F). If the operateType parameter is set to inputStatus, the valid value is 0 (read-only 0x02). If the operateType parameter is set to holdingRegister, the valid values are: 6 (read/write: read 0x03 and write 0x06), 16 (read/write: read 0x03 and write 0x10), 0 (read-only 0x03), 6 (write-only 0x06), and 16 (write-only 0x10). If the operateType parameter is set to inputRegister, the valid value is 0 (read-only 0x04).",
      "writeOnly": "Specifies whether the permission is write-only. Valid values: 0 and 1. The value 0 indicates that the permission is write-only. The value 1 indicates that the permission is not write-only.",
      "pollingTime": "The collection interval. Unit: milliseconds. You do not need to specify this parameter. The collection intervals of devices are used.",
      "bitMask": "The mask. This parameter is available only for properties of the bool type. Valid values: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768."
    }
  ]
}