This section gives a short overview about the different parts of the sensidl language. A Tutorial with pictures and videos can be found here
The specification of your sensor starts with the keyword sensorInterface
followed by a name and an optional description which starts with /**
and ends with */ . After that there can be an optional
identifier marked by the keywords with identifier : and
followed by a String. The Sensor begins with an { and
ends with an }
Example:
sensorInterface
exampleInterface /**This is the Description for the Example
Interface*/ {
// This is a single line comment
/* This is a multi-
line comment*/
// The sensor
contains encoding settings and the data description
}
The sensor has to contain encoding settings and the data description .
The Encoding settings are declared in the following format:
encoding (SENSIDL_BINARY || SENSIDL_JSON) with
(BIG_ENDIAN || LITTLE_ENDIAN) alignment (1..N) BIT (with
identifier : "identifier"))
The identifier is optional. Keywords are bold.
The DataDescription starts with the keyword sensorData
and an optional identifier. After that the dataSets are declared. The
sensorData can contain any number of dataSets.
Example:
sensorData {
dataSet exampleDataSet with
identifier : "1" {
//The DataSet
contains MeasurementData, NonMeasurementData, Lists and Methods
}
}
The DataSet can contain MeasurementData,
NonMeasurementData, Lists
and Methods. Furthermore it can reference to any number of
other dataSets by the Keyword uses after the name of the dataSet.
The format of the DataSet is the following:
dataSet exampleDataSet uses exDataSet1, exDataSet2, exDataSet3 {
//The DataSet contains MeasurementData, NonMeasurementData, Lists and Methods
}
The MeasurementData starts with a name and the declaration which
datatype and which Unit the data has. There is also the option for an
optional identifier and description. Furthermore the data can be
adjusted, either by range by giving a specific interval or by
conversion by scaling or mapping the data. For further information see
Data Adjustment. Furthermore
the getter and setter methods are excludable, that means with the keyword
exclude: getter, setter you can exclude both or only
one of these methods.
The format of the MeasuremntDats is the following:
DataName as DataType in Unit (with identifier :
"identifier"")(adjusted by (with range 0.0;0.0 || with
scaling factor : 0.0 and offset: 0.0 || linear mapping
[0.0;0.0] => [0.0;0.0]))(exclude: getter,
setter)(/**optional description*/)
Keywords are bold and brackets signalize optional arguments. DataName
can be any name given by the user and DataType is a type from the TypeSystem. Unit is a
Unit from the Unit System and "0.0"; can be replaced by
any number.
The NonMeasurementData has a name and a datatype. Also the data
can be a constant and can have a value, an identifier and/or a
description.Furthermore the getter and setter methods are excludable,
that means with the keyword exclude: getter, setter
you can exclude both or only one of these methods.
The format for the NonMeasurementData is the following:
DataName as DataType (constant)(value
= "value")(with identifier : "identifier")(exclude:
getter, setter)(/** optional description*/)
Keywords are bold and brackets signalize optional arguments. DataName can be any name given by the user and DataType is a type from the TypeSystem.
Methods are declared starting with a optional visibility (+ for public, # for
protected, ~ for package and - for private) followed by a name for the method.
Furthermore a Method can contain Parameters with a Parameter Type and a name for
the Parameter. Methods can also have a return type. The Keyword for Methods is
as Method at the end of the Method. ParamterType and ReturnType
can either be from the TypeSystem
or be a DataSet which was declared by the user.
The format for the method is the following:
(+|#|~|-)methodName(ParamaterType1 parameter1, ParameterType2 parameter2, ...):returnType as Method
Lists can also be declared by the user. Therefore the Keyword is
as list of
The format for the method is the following:
listName as List of (UINT8 | INT8 | ...)
Besides the usual getter and setter methods there will be more methods generated for lists. An add Method will be generated which allows to only add one element to the list and a get Method which allows to get only one element from the List will be generated also.