...
Downloading the definition file
Download the zForce® PDU zForce® PDU definition file here Downloads.
Type, Length, Value
All ASN.1 messages are structured by type, length and value:
...
The encoding for tag numbers up to and including 30 (higher code numbers are encoded differently, but those are not used in our protocol):
Bit position reserved for | 8th |
---|
and 7th | 6th | 5th |
---|
4th
3rd
2nd
1st
to 1st | ||||
---|---|---|---|---|
Specific bit value
| Binary |
representation |
---|
XX00 0000 |
00X0 0000 |
0010 0000
0001 0000
0000 1000
0000 0100
0000 0010
0000 0001
Description
Reserved for class tag
Reserved for class tag
Reserved for primitive/sequence
Reserved for tag number
Reserved for tag number
Reserved for tag number
Reserved for tag number
Reserved for tag number
000X XXXX | |||||||||
Decimal representation | 0, 64, 128, 192 | 0 or 32 | 0 to 30 (31 is reserved, see the table below) | ||||||
---|---|---|---|---|---|---|---|---|---|
Hexadecimal representation | 0x00, 0x40, 0x80, 0xC0 | 0x00 or 0x20 | 0x00 to 0x1E (0x1F is reserved, see the table below) | ||||||
Description | Class tag | Primitive/sequence | Tag number |
In short this means that the 8th and 7th bits are reserved to specify the class, and the 6th bit is reserved to show if it is a sequence. Bits 5 to 1 are used to specify the tag number.
Example: The type byte for the command deviceConfiguration
The command as seen in the protocol:
The encoding for tag numbers 31 and higher:
1st byte | 2nd byte | ||||||
---|---|---|---|---|---|---|---|
Bit position reserved for | 8th and 7th | 6th | 5th to 1st | 8th | 7th to 1st | ||
Specific bit value | Binary representation | XX00 0000 | 00X0 0000 | 000X XXXX | 1000 0000 | 0001 1111 to 0111 1111 | |
Decimal representation | 0, 64, 128, 192 | 0 or 32 | 31 | 0 | 31 to 127 | ||
Hexadecimal representation | 0x00, 0x40, 0x80, 0xC0 | 0x00 or 0x20 | 0x1F | 0x00 | 0x1F to 0x7F | ||
Description | Class tag | Primitive/sequence | Special value | Unused (set to 0) | Tag number |
Example: The type byte for the command deviceConfiguration
The command as seen in the protocol:
Code Block | ||||
---|---|---|---|---|
| ||||
deviceConfiguration [APPLICATION 19] | ||||
Code Block | ||||
| ||||
deviceConfiguration [APPLICATION 19] Sequence |
This tells us that the deviceConfiguration is a sequence with the class tag Application and 19 as tag number. The deviceConfiguration type byte looks like this when it is represented as an octet:
...
The decimal value 50 translates to 0x32 in hexadecimal representation and 0011 0010 in binary representation
Bit position | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
---|---|---|---|---|---|---|---|---|
Bit | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
Hexadecimal Value | 0x20 | 0x10 | 0x02 | |||||
Description | If this bit is set the length of the value is 128 bytes or longer | Value | Value | Value | Value | Value | Value | Value |
Example: The length bytes for a value that is 300 bytes long
The length bytes for a value that is 300 bytes long consists of three bytes. The first byte indicates that the following two bytes ((0x01) 0000 0001 (0x2C) 0010 1100) should be added together. The first byte is described in the following table:
Bit position | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
---|---|---|---|---|---|---|---|---|
Bit | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Hexadecimal Value | 0x80 | 0x02 | ||||||
Description | If this bit is set, the length of the value is 128 bytes or longer | Number of length bytes | Number of length bytes | Number of length bytes | Number of length bytes | Number of length bytes | Number of length bytes | Number of length bytes |
The Value Byte(s)
The value byte(s) can be as few as one byte or they can be a whole sequence following the Type Length Value format:
- Integers are represented by one or more bytes. :
- An integer between 0 and 127 is represented by one byte (00 to 7F).
- An integer between 128 and
- 32 767 is represented by two bytes (00 80 to 7F FF).
- An integer between 32 768 and 8 277 607 as three bytes (00 80 00 to 7F FF FF).
- Etc.
- A Boolean only requires one byte, since it is either true or false. The Boolean is either 0x00 or 0xFF.
- An Octet String takes up just as many bytes as the number of octets.
Bit string: the number of bytes needed to represent a bit string depends on the number of bits and is easily explained in code:
Code Block theme Confluence int valueLength = 0; void CalculateValueLength() { valueLength = bitString.Length / 8; if((bitString.Length % 8) != 0) { valueLength++; } }
Anchor RequestResponseNotification RequestResponseNotification
...
Code Block | ||
---|---|---|
| ||
*Device Configuration ASN.1 Protocol* -- Instance specific settings for a device deviceConfiguration [APPLICATION 19] Sequence { -- Set / get the number of touches to be tracked: numberOfTrackedTouches [0] INTEGER (0..255) OPTIONAL, -- Set / get the minimal distance for updating a tracked touch in move state trackingMinDistanceMove [1] INTEGER (0..16383) OPTIONAL, -- Set / get the sub touch active area lowlower bound in X coordinate subTouchActiveArea [2] Sequence { -- Write Request and Read Response only: -- Set / get the sub touch active area low bound in X coordinate lowBoundX [0] INTEGER (0..16383) OPTIONAL, -- Set / get the sub touch active area low bound in Y coordinate lowBoundY [1] INTEGER (0..16383) OPTIONAL, -- Set / get the sub touch active area high bound in X coordinate highBoundX [2] INTEGER (0..16383) OPTIONAL, -- Set / get the sub touch active area high bound in Y coordinate highBoundY [3] INTEGER (0..16383) OPTIONAL, |
...
We want to set the following settings in the sensor module
SubTouchActiveArea:
- LowBoundX: 500
- LowBoundY: 500
- HighBoundX: 2000
- HighBoundY: 2000
settings in the sensor module
SubTouchActiveArea:
- LowBoundX: 500
- LowBoundY: 500
- HighBoundX: 2000
- HighBoundY: 2000
Info | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
The following parameters have new changed names in the zForceProgrammer the WorkBench and the Parameter Overview:
For convenience and backward compatibility purposes the names of the parameters are unchanged in SDK code. |
This is how to do it (the length bytes are represented by XX, and are added in the last step):
Step | What to do | Details | Result | The message |
---|---|---|---|---|
1 | Add the code for a request, since the message will be sent from the host to the sensor module: 0xEE 0xXX | EE XX | EE XX | |
2 | Add the device address 0x40 0x02 0x02 0x00 | See Device Address. | 40 02 02 00 | EE XX 40 02 02 00 |
3 | Add the bytes for deviceConfiguration | The command deviceConfiguration has the class tag Application, tag number 19 and is a sequence. | Binary: 0111 0011 | EE XX 40 02 02 00 73 |
4 | Add the bytes for SubTouchActiveArea | SubTouchActiveArea is a context-specific sequence with tag number 2. | Binary: 1010 0010 | EE XX 40 02 02 00 73 XX A2 XX |
5 | Add the variables inside of SubTouchActiveArea.. | All the variables are context-specific and primitive (binary 1000 0000, hexadecimal 0x80). Depending on which variable that is currently being added, add the specific tag number. | Per variable: | EE XX 40 02 02 00 73 XX A2 XX 80 XX 01 F4 81 XX 01 F4 82 XX 07 D0 83 XX 07 D0 |
6 | Add the length bytes of the message. | Add the number of bytes for each specific part of the message. | - | EE 18 40 02 02 00 73 12 A2 10 80 02 01 F4 81 02 01 F4 82 02 07 D0 83 02 07 D0 |
Panel | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Read More on Software Integration
Read More
|