Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function createFromHex(string $payload, &$position): SensorsData |
||
19 | { |
||
20 | // IO element ID of Event generated -- skip |
||
21 | $position += 2; |
||
22 | |||
23 | $numberOfIoElements = substr($payload, $position, 2); |
||
|
|||
24 | $position += 2; |
||
25 | |||
26 | $numberOfIo1BitElements = substr($payload, $position, 2); |
||
27 | $position += 2; |
||
28 | |||
29 | $position += 2 * hexdec($numberOfIo1BitElements) + 2 * hexdec($numberOfIo1BitElements); |
||
30 | |||
31 | $numberOfIo2BitElements = substr($payload, $position, 2); |
||
32 | $position += 2; |
||
33 | |||
34 | $position += 2 * hexdec($numberOfIo2BitElements) + 4 * hexdec($numberOfIo2BitElements); |
||
35 | |||
36 | $numberOfIo4BitElements = substr($payload, $position, 2); |
||
37 | $position += 2; |
||
38 | |||
39 | $position += 2 * hexdec($numberOfIo4BitElements) + 8 * hexdec($numberOfIo4BitElements); |
||
40 | |||
41 | $numberOfIo8BitElements = substr($payload, $position, 2); |
||
42 | $position += 2; |
||
43 | $position += 2 * hexdec($numberOfIo8BitElements) + 16 * hexdec($numberOfIo8BitElements); |
||
44 | |||
45 | return new SensorsData(); |
||
46 | } |
||
48 |