File size: 3,357 Bytes
da3e674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@echo off
REM ============================================================
REM  ORION Note10 — Ein-Klick ADB-Verbindung
REM ============================================================
REM  Ports:
REM    8022  SSH (Termux)
REM    5001  DDGK-Agent (Flask)
REM    8001  Sensor-Server
REM ============================================================

echo.
echo ============================================
echo   ORION Note10 — ADB Verbindung
echo ============================================
echo.

REM --- 1. ADB verfuegbarkeit pruefen ---
where adb >nul 2>&1
if %ERRORLEVEL% neq 0 (
    echo [FEHLER] ADB nicht gefunden. Installiere mit:
    echo   winget install Google.PlatformTools
    echo.
    pause
    exit /b 1
)
echo [OK] ADB gefunden.
echo.

REM --- 2. Geraete-Liste ---
echo --- Verbundene Geraete ---
adb devices
echo.

REM --- 3. Geraet vorhanden? ---
adb devices | findstr /R "[0-9a-zA-Z].*device$" >nul 2>&1
if %ERRORLEVEL% neq 0 (
    echo [FEHLER] Kein Note10 verbunden.
    echo   1. USB-Kabel anschliessen
    echo   2. Auf dem Handy "USB-Debugging zulassen" tippen
    echo   3. Dieses Script erneut ausfuehren
    echo.
    echo   Alternativ — Wireless ADB (einmalig USB noetig):
    echo     adb tcpip 5555
    echo     adb connect ^<NOTE10_IP^>:5555
    echo.
    pause
    exit /b 1
)
echo [OK] Note10 erkannt.
echo.

REM --- 4. Alte Forwards loeschen (sauberer Start) ---
echo --- Alte Forwards loeschen ... ---
for /f "tokens=2" %%a in ('adb forward --list 2^>nul ^| findstr "tcp:"') do (
    for /f "tokens=1" %%p in ("%%a") do (
        for /f "tokens=3" %%f in ("%%a") do (
            adb forward --remove %%p >nul 2>&1
        )
    )
)

REM --- 5. Port Forwards setzen ---
echo --- Setze Port Forwards ---

adb forward tcp:8022 tcp:8022
if %ERRORLEVEL% equ 0 (echo   [OK] 8022 - SSH/Termux) else (echo   [!!] 8022 - FEHLER)

adb forward tcp:5001 tcp:5001
if %ERRORLEVEL% equ 0 (echo   [OK] 5001 - DDGK-Agent) else (echo   [!!] 5001 - FEHLER)

adb forward tcp:8001 tcp:8001
if %ERRORLEVEL% equ 0 (echo   [OK] 8001 - Sensor-Server) else (echo   [!!] 8001 - FEHLER)

echo.

REM --- 6. Forward-Liste bestaetigen ---
echo --- Aktive Forwards ---
adb forward --list
echo.

REM --- 7. Health-Checks ---
echo --- Health-Checks (3s Timeout) ---

curl -s -m 3 http://localhost:5001/health >nul 2>&1
if %ERRORLEVEL% equ 0 (
    echo   [OK] DDGK-Agent  (Port 5001) antwortet
) else (
    echo   [!!] DDGK-Agent  (Port 5001) — nicht erreichbar
    echo         Starte auf dem Note10: python ddgk_note10_agent.py
)

curl -s -m 3 http://localhost:8001/ping >nul 2>&1
if %ERRORLEVEL% equ 0 (
    echo   [OK] Sensor-Server (Port 8001) antwortet
) else (
    echo   [!!] Sensor-Server (Port 8001) — nicht erreichbar
    echo         Starte auf dem Note10: python note10_start_sensor.py
)

curl -s -m 3 -o nul -w "%%{http_code}" http://localhost:8022 2>nul | findstr "200" >nul 2>&1
if %ERRORLEVEL% equ 0 (
    echo   [OK] SSH/Termux    (Port 8022) antwortet
) else (
    echo   [~~] SSH/Termux    (Port 8022) — SSH antwortet nicht auf HTTP (erwartet)
)

echo.
echo ============================================
echo   Verbindung hergestellt.
echo   SSH:  ssh -p 8022 u0_a322@localhost
echo   DDGK: http://localhost:5001/health
echo   Sensor: http://localhost:8001/ping
echo ============================================
echo.
pause