Files
gstreamerViewer/test_connection.sh
Maik Jurischka 69e2f3ae1d first commit
2025-12-18 16:10:55 +01:00

53 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Test script to verify VizionStreamer connection
SOCKET="/tmp/vizion_control.sock"
echo "=== VizionStreamer Connection Test ==="
echo ""
# Check if socket exists
if [ ! -S "$SOCKET" ]; then
echo "❌ FAIL: Socket not found at $SOCKET"
echo "Please ensure VizionStreamer backend is running."
exit 1
fi
echo "✓ Socket found at $SOCKET"
echo ""
# Test get_status command
echo "Testing get_status command..."
RESPONSE=$(echo '{"command":"get_status"}' | socat - UNIX-CONNECT:$SOCKET 2>/dev/null)
if [ $? -eq 0 ]; then
echo "✓ Connection successful"
echo "Response: $RESPONSE"
echo ""
else
echo "❌ FAIL: Could not connect to socket"
exit 1
fi
# Test get_formats command
echo "Testing get_formats command..."
FORMATS=$(echo '{"command":"get_formats"}' | socat - UNIX-CONNECT:$SOCKET 2>/dev/null)
if [ $? -eq 0 ]; then
echo "✓ get_formats successful"
# Pretty print if python3 is available
if command -v python3 &> /dev/null; then
echo "$FORMATS" | python3 -m json.tool 2>/dev/null || echo "$FORMATS"
else
echo "$FORMATS"
fi
echo ""
else
echo "❌ FAIL: Could not get formats"
exit 1
fi
echo "=== All tests passed! ==="
echo "VizionStreamer backend is ready for use."