How ana52070/web_onvif_modbus works
Project type and purpose
• From the file tree and README (“# 测试”), this appears to be an embedded/networked device application written in C.
• It bundles four main functional modules—Command, ModbusTCP, Onvif and Webserver—plus a central main.c that ties them together.
• Purpose: expose and manage hardware/devices (IP camera via ONVIF, industrial I/O via ModbusTCP, local OS commands) through a built-in HTTP server and CLI scripts.
File structure
• Top-level modules:
• Command/Code: low-level OS command wrapper (Command.c/.h)
• ModbusTCP/Code: ModbusTCP master stack (modbusTcp_master.c/.h)
• Onvif/Code: ONVIF/PTZ camera control (camera_manager.c, myptz.c)
• Webserver/Code & Webserver/HTML & Webserver/Config: embedded HTTP server, JSON configs, HTML UI
• Build system: Makefile + Makefile.inc compile each module into .o files, link with main.c.
• Shell scripts (under Command/Sh) for device reboot or test.
• Config files in JSON for IP sets (ipset.json) and tracking settings (track.json).
• Web UI (Browser)
• Embedded HTTP Server
• Application Core (main.c)
• Command Module
• ModbusTCP Module
• Onvif/PTZ Module
• Shell‐script Layer
• Configuration Store (JSON files)
• External Devices: IP Camera, Modbus Devices, OS
• Browser → HTTP Server: HTTP requests (login, reboot, track, ipset)
• HTTP Server → Application Core: API calls or HTML template rendering
• Application Core ↔ Modules:
– ↔ Onvif Module: PTZ commands, status polling
– ↔ ModbusTCP Module: read/write registers
– ↔ Command Module → Shell scripts → OS commands
• Modules → External Devices:
– Onvif → IP Camera via ONVIF protocol
– ModbusTCP → PLCs/sensors via Modbus/TCP
– Shell scripts → Linux reboot, diagnostics
c. Architectural patterns & principles:
• Layered architecture: Presentation (Web UI), Application Core, Module abstractions, External layer
• Modular separation: each protocol/feature in its own codebase for testability
• Config-driven behavior: JSON files decouple runtime settings
• Build pipeline: flat Makefile with per-module compilation
d. Key technologies/frameworks:
• C language modules, Makefile build
• ONVIF open standard (SOAP/HTTP)
• Modbus/TCP (industrial protocol)
• Embedded HTTP (custom HTML templates + JSON config)
• Shell scripting for system commands