package serialinteraction type SerialMockConnection struct { portPath string } func (sc *SerialMockConnection) ListComports() []string { return []string{"/dev/ttyUSB0", "/dev/ttyUSB1"} } func (sc *SerialMockConnection) GetPortPath() string { return "/dev/ttyUSB0" } func (sc *SerialMockConnection) Connect(portPath string) error { return nil } func (sc *SerialMockConnection) Disconnect() { } func (sc *SerialMockConnection) Write(data []byte) (int, error) { return 10, nil } func (sc *SerialMockConnection) Read(data []byte) (int, error) { msg := "Viele Lustige Daten" data = []byte(msg) return len(msg), nil }