Package de.freaklamarsch.systarest.tests
Class FakeSTouchTest
java.lang.Object
de.freaklamarsch.systarest.tests.FakeSTouchTest
class FakeSTouchTest
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
FakeSTouchTest.PcapPacket
-
Field Summary
Fields Modifier and Type Field Description (package private) DeviceTouchSearch.DeviceTouchDeviceInfo
deviceInfo
(package private) byte[]
localIpAddrBytes
(package private) java.util.ArrayList<FakeSTouchTest.PcapPacket>
packetData
-
Constructor Summary
Constructors Constructor Description FakeSTouchTest()
-
Method Summary
Modifier and Type Method Description private FakeSTouchTest.PcapPacket
byteArrayToDatagramPacket(java.util.ArrayList<java.lang.Byte> bytes)
(package private) void
findSystaComfort()
private void
initializeData(java.lang.String testFileName)
readspacketData
from a pcap dumped into a c array header file.private void
initializeData(java.lang.String testFileName, int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)
readspacketData
from a pcap dumped into a c array header file.private void
printByteArrayAsHex(byte[] bytes)
private void
readPCAPDumpHeaderFileIntoByteBufferArray(java.lang.String pcapDumpHeaderFile)
loads pcap dump of the communication flow between the S-Touch app and a compatible device.private void
saveDisplayAsExcalidraw(FakeSTouch stouch, java.lang.String filename)
Save theobjectTree
from the display of the passedFakeSTouch
as excalidraw.png-fileprivate void
saveDisplayAsPNG(FakeSTouch stouch, java.lang.String filename)
Save theobjectTree
from the display of the passedFakeSTouch
as png-fileprivate void
setDeviceInfoFromPacketData(int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)
(package private) void
testCommunication()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
deviceInfo
DeviceTouchSearch.DeviceTouchDeviceInfo deviceInfo -
packetData
java.util.ArrayList<FakeSTouchTest.PcapPacket> packetData -
localIpAddrBytes
byte[] localIpAddrBytes
-
-
Constructor Details
-
FakeSTouchTest
FakeSTouchTest()
-
-
Method Details
-
initializeData
private void initializeData(java.lang.String testFileName)readspacketData
from a pcap dumped into a c array header file. It is assumed that the file starts with the default startup sequence of the S-Touch app searching for a compatible device- Parameters:
testFileName
-
-
initializeData
private void initializeData(java.lang.String testFileName, int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)readspacketData
from a pcap dumped into a c array header file. The capture file should hold packets from the communication startup sequence and you have to provide the indices of these packets- Parameters:
testFileName
-idxDeviceTouchInfoReply
- index of the packet holding the reply with the info string about the communication partneridxPortReply
- index of the packet holding the reply with the port used for communication by the partneridxPasswordReply
- index of the packet holding the reply with the password used for communication by the partner
-
setDeviceInfoFromPacketData
private void setDeviceInfoFromPacketData(int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)- Parameters:
idxDeviceTouchInfoReply
- index of the packet holding the reply with the info string about the communication partneridxPortReply
- index of the packet holding the reply with the port used for communication by the partneridxPasswordReply
- index of the packet holding the reply with the password used for communication by the partner
-
readPCAPDumpHeaderFileIntoByteBufferArray
private void readPCAPDumpHeaderFileIntoByteBufferArray(java.lang.String pcapDumpHeaderFile)loads pcap dump of the communication flow between the S-Touch app and a compatible device. The dump need to be saved as "C" header file holding the packets as hexText bytes in "C" arrays. A hexText byte is the hexadecimal asci text representing the value of the transmitted byte. The size of the ByteBuffer has to match the Hex Stream in the file. No checks are done.- Parameters:
pcapDumpHeaderFile
- path to the file that should be loaded
-
printByteArrayAsHex
private void printByteArrayAsHex(byte[] bytes) -
byteArrayToDatagramPacket
private FakeSTouchTest.PcapPacket byteArrayToDatagramPacket(java.util.ArrayList<java.lang.Byte> bytes) -
findSystaComfort
@Test void findSystaComfort() -
testCommunication
@Test void testCommunication() -
saveDisplayAsExcalidraw
Save theobjectTree
from the display of the passedFakeSTouch
as excalidraw.png-file- Parameters:
stouch
-filename
-
-
saveDisplayAsPNG
Save theobjectTree
from the display of the passedFakeSTouch
as png-file- Parameters:
stouch
-filename
-
-