Introduction to Thing Specification Language
The Thing Specification Language (TSL) refers to a description file provided for the configuration between the end-side and the server, which is used to describe the configuration items supported by the end-side and the constraints corresponding to the configuration items.
Overview
The SenseLink platform supports devices to define the TSL. The data model consisting of the configuration (properties, status) of the actual device facilitates the management of the device through the cloud.
Function Type
Description
Properties
Include parameter naming, parameter types, control types, check rules for each function of the product. Triggered by the device or platform to modify
Status
The status of a peripheral component of the device. The platform only reads but does not write, and only maintains the latest status, such as door magnetism status, thermal imaging system connection status, bluetooth lock battery
TSL
TSL is a JSON format file that is reported by the device when it first accesses SenseLink and is stored in the backend. As you open the details of a device on the web, the web can then dynamically load the TSL and TSL values corresponding to the device. This allows you to ensure consistency between the remote configuration function in the cloud and the local function of the device without upgrading the backend service.
TSL Usage Flow
1.Add TSL to the app and complete the creation based on TSL Data Structure 2.Create the required language pack. For its format, please see TSL internationalization. 3.After completing the development, you can report properties and events on the device, and set properties and invoke services on the cloud, and view the interface call steps Update Process 4.The attributes, events and completed service call data reported from the device will be displayed on the Device Settings tab of Device Details page of the corresponding device in the SenseLink console after passing the data verification.
TSL Structure
TSL is a json file containing "engineVersion", "modelVersion" at the top level: "0.0.1", "deviceType" basic information and related setting status "properties", "status" composition:
Properties
Properties is composed of several modules, each containing multiple set items. Each setting item, also known as fields
element, is a description and function definition for each setting item.
Field is composed of key and value. Key describes the name of the configuration item, and Value is the definition including the optional value, style, status of the configuration item. The following is an explanation of some fields. For more configuration, please see [TSL data structure] (# TSL data structure).
type: required, the type of the configuration item value, which can be int, float, string, boolean and others
ranges: optional, to express the interval of the value when the type is int, float, etc., including min
: minimum value, max
: maximum value, default
: default value.
ui: optional, default as text, used to indicate web/device input control style.
List of available values for ui
:
ui optional values
description
number
number picker
select
drop-down box
checkbox
multi-select box
radio
radio button
date
time picker
text
single-line text input
textarea
multi-line text input
image
image upload and display
options: optional, used when Value is exhaustible (such as wiegand32, wiegand34, and wiegand2602), generally used with select
for ui
.
Status
Refers to the status of a peripheral component of a device. The platform only reads and does not write, and only maintains the latest state. The JSON file contains name
, enable
, and options
, corresponding to the name, display or not, and optional values. For more information, please see [TSL data structure] (# TSL data structure).
TSL Internationalization
Defines the display names of device types, attributes, and status of all TSL in the system on the device/web, and stores them separately by different languages. TSL internationalization is to explain the TSL values and names in layman's terms for the cloud console and reduce the difficulty of operation. Each language pack is composed of files in JSON format, and the corresponding Key is a translation for the corresponding part of the TSL.
Field
Description
deviceTypes
set of device types, e.g.: "deviceType": "spse"
groups
TSL categorization name, translation of name in Properties, e.g.: properties[{"name": "general", ...}]
fields
name of the configuration item, all "name" fields of fields under Properties
values
the value corresponding to the configuration, all values in TSL, including the value in Status
status
the display name of the device peripheral status, the "name" field under Status
common
common translation, e.g. "modelVersion": "Device model version"
For more information on data structure, please see Data structure of language pack.
Appendix
Update Process
Data structure of language pack
An example of the data structure of the language pack is as follows.
TSL Data Structure
An example of the JSON field structure for TSL is as follows:
最終更新