-
Notifications
You must be signed in to change notification settings - Fork 7
/
KW_CRC_Test.java
50 lines (39 loc) · 1.6 KB
/
KW_CRC_Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Copyright (c) 2016-2023 by the respective copyright holders.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package de.csdev.ebus.cfg;
import static org.junit.Assert.*;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.junit.Before;
import org.junit.Test;
import de.csdev.ebus.command.EBusCommandException;
import de.csdev.ebus.command.EBusCommandRegistry;
import de.csdev.ebus.command.EBusCommandUtils;
import de.csdev.ebus.command.IEBusCommandMethod;
import de.csdev.ebus.command.datatypes.EBusTypeException;
import de.csdev.ebus.configuration.EBusConfigurationReaderExt;
/**
* @author Christian Sowada - Initial contribution
*
*/
public class KW_CRC_Test {
EBusCommandRegistry commandRegistry;
@Before
public void before() throws IOException, EBusConfigurationReaderException {
commandRegistry = new EBusCommandRegistry(EBusConfigurationReaderExt.class, true);
}
@Test
public void testKWCrc() throws EBusTypeException, EBusCommandException {
IEBusCommandMethod commandMethod = commandRegistry.getCommandMethodById("cgb2", "boiler.pressure",
IEBusCommandMethod.Method.GET);
assertNotNull("Unable to get command cgb2.boiler.pressure", commandMethod);
ByteBuffer buffer = EBusCommandUtils.buildMasterTelegram(commandMethod, (byte) 0x00, (byte) 0x04, null);
assertEquals("KW CRC Invalid", 0x77, buffer.get(5));
}
}