Spaces:
Runtime error
Runtime error
Download docs/dev/start_isup5.py from Atomio/hikvision-isup: direct link, hf CLI and curl.
- Browser
- Download file 2.58 kB
-
https://huggingface.co/spaces/Atomio/hikvision-isup/resolve/main/docs/dev/start_isup5.py
- Command line
-
hf download hf://spaces/Atomio/hikvision-isup/docs/dev/start_isup5.py
-
curl -L -o start_isup5.py https://huggingface.co/spaces/Atomio/hikvision-isup/resolve/main/docs/dev/start_isup5.py
2.58 kB
| #!/usr/bin/env python3 | |
| """ | |
| Hikvision ISUP 5.0 Server Startup Script | |
| Starts both the ISUP 5.0 binary protocol server and web interface | |
| """ | |
| import asyncio | |
| import sys | |
| import signal | |
| import threading | |
| from datetime import datetime | |
| # Import our servers | |
| from app_isup5 import app | |
| from isup5_server import isup_server | |
| import uvicorn | |
| def signal_handler(signum, frame): | |
| """Handle shutdown signals""" | |
| print(f"\nπ Received signal {signum}, shutting down...") | |
| sys.exit(0) | |
| def print_banner(): | |
| """Print startup banner""" | |
| print("=" * 60) | |
| print("π HIKVISION ISUP 5.0 SERVER") | |
| print("=" * 60) | |
| print(f"π Started: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") | |
| print(f"π Protocol: ISUP 5.0 Binary") | |
| print(f"π§ Authentication: EHome Key + Session Key") | |
| print(f"π‘ ISUP Port: 7660 (TCP)") | |
| print(f"π Web Interface: http://localhost:7860") | |
| print(f"π API Docs: http://localhost:7860/docs") | |
| print("=" * 60) | |
| print() | |
| print("π§ DEVICE CONFIGURATION:") | |
| print("Configure your Hikvision device with these settings:") | |
| print(" β’ Platform Access Mode: ISUP") | |
| print(" β’ Protocol Version: 5.0") | |
| print(" β’ Server Address: your-server-ip") | |
| print(" β’ Port: 7660") | |
| print(" β’ Device ID: 255") | |
| print(" β’ EHome Key: hikvision123") | |
| print() | |
| print("π± SUPPORTED DEVICE:") | |
| print(" β’ Model: DS-K1T342MFX") | |
| print(" β’ Serial: DS-K1T342MFX20220310V030305ENJ92377854") | |
| print(" β’ Features: Face Recognition, Temperature, Mask Detection") | |
| print() | |
| print("π§ͺ TESTING:") | |
| print(" β’ Run: python test/isup5_device_simulator.py") | |
| print(" β’ Simulates authentic ISUP 5.0 device behavior") | |
| print() | |
| def main(): | |
| """Main startup function""" | |
| # Set up signal handlers | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| print_banner() | |
| try: | |
| # Start the web server (which will start ISUP server in background) | |
| print("π Starting servers...") | |
| uvicorn.run( | |
| "app_isup5:app", | |
| host="0.0.0.0", | |
| port=7860, | |
| reload=False, # Important: disable reload to prevent ISUP server issues | |
| log_level="info", | |
| access_log=True | |
| ) | |
| except KeyboardInterrupt: | |
| print("\nπ Shutdown requested by user") | |
| except Exception as e: | |
| print(f"β Server error: {e}") | |
| finally: | |
| print("π Server stopped") | |
| if __name__ == "__main__": | |
| main() | |