dS378
dS378
User Manual v2.19
Binary Command Set – continued.
0x35
Get Analogue inputs (1 byte command returning 14 bytes)
This returns all 7 possible analogue inputs. 14 bytes are returned, 2 for each analogue input.
Byte 1 byte 2
for example:
0x02 0x3E
combined to 0x023E, or 574 decimal for input 1.
Byte 3 byte 4
0x01 0xFB
combined to 0x01FB, or 507 decimal for input 2.
Bytes 5 – 12 follow in a similar way.
Byte 13 byte 14
0x03 0x2C
combined to 0x032C, or 812 decimal for input 7.
If the input is configured as a digital port then the input will be 0 or 1.
0x36 0x01
Get Counters (2 byte command – returning 8 bytes)
This command is used to get the counters. The second byte is the counter number, counter 1
in this case.
The first 4 bytes returned is the current counter value. This 32-bit (4 bytes) value is returned
high byte first. The second group of 4 bytes returned is the capture register for this counter,
also a 32-bit (4 byte) value returned high byte first.
AES binary command set
The AES Binary commands are the same as the Binary commands described above. The only
difference is that they are AES encrypted and always 16 bytes in length. The first bytes are the
same as described in the Binary command set. The last 4 bytes is the Nonce (a random
number) and the bytes in the middle are undefined. The module will decrypt the command,
generate the response and encrypt it before returning it to you.
Your program that controls the module will need to encrypt the commands and then decrypt
the response.
We use AES256 CBC encryption, hence the requirement for a 256 bit (or 32 byte) key. To
complete the security we use a random IV generated by a cryptoghraphically secure random
number generator (ISAAC).
To control the module you will need to send the commands with AES encryption. To help you
with this we have examples in C#, Java and Python. The C# and Java applications are
complete and may be used or modified as you wish.
Copyright
© 2016-2017,
Devantech Ltd.
All rights reserved.
33
www.pishrobot.com