Set Digital Input Counters on the Hawk - 0x0103
Table of Contents
Before you start
Ensure you have reviewed:
A full list of API calls can be found at: https://api.oemserver.com/swagger/index.html.
Description
NB: Not available for all device/card firmware versions. It is recommended to update to the latest version. Check release notes for details.
This can be used to set the Digital Input Counter value on the Hawk when used in Pulse Counting applications. i.e. to reset a count back to 0, or to set an initial/offset value.
Request Example
Data Payload:
Offset |
Length |
Data Type |
Description |
0 |
1 |
BYTE |
Change Mask. Only set counts for selected digital inputs
Hawk b0 – Baseboard DIG1 b1 – Reserved b2 – Reserved b3 – Card Digital Input 1 b4 – Card Digital Input 2 b5 – Card Digital Input 3 b6 – Card Digital Input 4 b7 – Card Digital Input 5 |
1 |
1 |
BYTE |
Reserved |
2 |
4 |
UINT32 |
Count of b0 digital input |
6 |
4 |
UINT32 |
Count of b1 digital input |
10 |
4 |
UINT32 |
Count of b2 digital input |
14 |
4 |
UINT32 |
Count of b3 digital input |
18 |
4 |
UINT32 |
Count of b4 digital input |
22 |
4 |
UINT32 |
Count of b5 digital input |
26 |
4 |
UINT32 |
Count of b6 digital input |
30 |
4 |
UINT32 |
Count of b7 digital input |
Example: Set Baseboard Dig In to 400 and Reset Card Dig In 1 to 0.
{
"MessageType":259,
"CANAddress":4294967295,
"Data":[9,0,144,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"ExpiryDateUTC":"2024-11-25T18:25:43.511Z"
}
9 - represents the change mask – Essentially selecting which digital input counters you would like to target with the async.
In this case we are targeting the baseboard Digin (b0) and Card Dig in 1 (b3)
00001001 = 9
0 – Reserved byte
144,1,0,0 – This UINT32 value is made up of 4 bytes. 400 in 32bit binary is 00000000 00000000 00000001 10010000. This can be written as 0,0,1,144. This is big endian, and the async payload structure is little endian.Therefore, it is written as 144,1,0,0.
0,0,0,0 and 0,0,0,0 – These represent the count of b1 and b2. Because we aren’t changing these, we can write whatever we want here, but we do need to write the 8 digits.
0,0,0,0 – This represents the count of b3. Because we are setting it to 0, keep them all zeros.
Confirming Message Processing
The success of the message will be apparent in the next device data upload.