Skip to main content

System Architecture

The NE503 AIPC (AI IPC) platform is a complete software stack designed for edge AI computing. It adopts a four-layer architecture and supports multiple SoC platforms (Hailo-15 / RKxxx / Jetson) with seamless migration through a hardware abstraction layer. This document provides a detailed overview of each architectural layer, core services, and data flow.

1. Four-Layer Architecture Overview​

LayerResponsibilityTechnology
Application Container LayerThird-party AI applications, model inference pipelinesPython/Go/C++, containerized runtime
Platform Services LayerCamera management, AI inference, container management, event dispatch, device control, API gateway, device discoveryGo microservices + C++ daemons
Hardware Abstraction LayerUnified hardware interface, decoupling platform services from SoCC/C++ function pointer tables (Ops), DMA-BUF zero-copy
Hardware LayerSoC, NPU, ISP, sensors, MCUHailo-15H (current), RKxxx / Jetson (extensible)

2. Platform Services Layer​

The platform services layer consists of multiple microservices that communicate internally via gRPC over Unix Domain Sockets.

2.1 Service Overview​

ServiceLanguageListen AddressResponsibility
ai-runtimeC++unix:///run/aipc/ai-runtime.sockAI model management and inference scheduling, NPU resource allocation, GenAI streaming inference
app-managerGounix:///run/aipc/app-manager.sockContainer application lifecycle management (install/start/stop/uninstall), based on containerd
event-busGounix:///run/aipc/event-bus.sock + TCP 127.0.0.1:50053Publish/subscribe message bus, MQTT-style wildcard matching
device-controlGounix:///run/aipc/device-control.sockHardware peripheral control (light/PTZ/lens/GPIO), MCU UART communication
device-discoveryGounix:///run/aipc/device-discovery.sockNetwork device discovery (CT-Disc protocol), device registration and state management
platform-apiGo:8080HTTP/RESTful API gateway, proxying all backend gRPC services
camera-daemonC++unix:///run/aipc/camera.sock (FD publish) + unix:///run/aipc/camera-control.sock (gRPC control) + /run/aipc/shm/ (SHM)Video capture, dual-channel frame dispatch (FD/SHM), encoding, RTSP streaming

2.2 gRPC API Definitions​

The platform defines all gRPC interfaces through Protocol Buffers files:

Proto FileServiceDescription
inference.protoAI InferenceModel registration, inference, streaming, GenAI session management
app.protoContainer ManagementApp install/lifecycle + container/image/resource management
event.protoEvent BusPublish/subscribe, MQTT-style wildcards, topic statistics
device.protoDevice ControlLight/PTZ/lens (incl. AF0832)/GPIO/environment/alarm/RS485
camera.protoCamera ManagementVideo capture pipeline, RTSP streaming, OSD overlay
lens_hal.protoLens ControlHAL bridge implementation for the lens portion of device.proto
discovery.protoDevice DiscoveryCT-Disc protocol device discovery, monitoring, and scanning

For the complete list of operations per proto, see the corresponding service reference documentation.


3. Hardware Abstraction Layer (HAL)​

3.1 HAL Interface Overview​

HAL headers are organized by component subdirectory under hal_v2/include/:

DirectoryCoverage
media/Video capture, encoding (H.264/H.265), OSD, ISP, audio, profile management
model/Model inference, post-processing (NMS), GenAI (LLM/VLM), visualization, CLIP text encoding
dsp/Crop, scale, format conversion, privacy mask, stabilization
peripheral/MCU communication, GPIO/sensor; device layer includes LED, lens, alarm, RS485, RTC, OTA, etc.
common/Common enums/error codes, HalFrameBuffer frame buffer, basic types, logging

Specific sub-interfaces consumed by each service (e.g., HalInferenceOps, HalPostprocessOps, etc.) are documented in the corresponding service reference pages.

3.2 Core Data Structure: HalFrameBuffer​

HalFrameBuffer is the platform's core frame data carrier, used to pass frame data between video capture, AI inference, encoding, and other modules.

Data encapsulation:

  • Image metadata: dimensions, pixel format, timestamp

  • Memory descriptors: DMA-BUF fd, virtual addresses, stride/size

  • Private data: platform-specific information passed through the priv pointer

  • Memory modes: Supports DMA-BUF (zero-copy) and CPU Memory. The entire video β†’ AI β†’ encoding pipeline shares the same DMA-BUF without memory copying.

  • Lifecycle: Managed through reference counting (hal_frame_buffer_ref / hal_frame_buffer_release).

For the complete struct definition, see the GitHub repository under hal_v2/include/common/.

3.3 Multi-Platform Support​

Current implementations: Hailo-15 (complete) + Stub (complete stub implementation for hardware-free development). RKxxx and Jetson can be supported through the HAL porting guide.


4. Web Console​

The web console is built on React 19 + TypeScript + Vite, providing device management, video monitoring, AI model management, application management, and system monitoring.

Technology StackComponent
FrameworkReact 19 + TypeScript
BuildVite
State ManagementZustand
Data FetchingTanStack Query
UI Componentsshadcn/ui + Radix
TestingVitest

The web console communicates with platform-api via REST API and WebSocket, receiving real-time AI inference results and device events.

Access URL: http://<device-ip>:8080.


5. Key Technical Features​

5.1 Zero-Copy Optimization​

Core mechanisms:

  • HalFrameBuffer passes DMA-BUF file descriptors via dma_fds[], enabling zero-copy throughout the video -> AI -> encoding pipeline
  • Reference counting manages frame lifecycle (hal_frame_buffer_ref / hal_frame_buffer_release)
  • FD passing between AI Runtime and Camera Daemon via SCM_RIGHTS (no memory copy required)

5.2 Event-Driven Architecture​

The Event Bus uses a publish/subscribe pattern with MQTT-style wildcard matching:

PatternDescriptionExample
Exact matchExact topic name matchapp/myapp/status
* Single-level wildcardMatches one levelapp/*/status
** Multi-level wildcardMatches multiple levelsmodel/**/detections

All inference results, container events, and device events generated by services are dispatched through the Event Bus. Third-party applications subscribe to topics of interest using the SDK's EventClient.

5.3 Containerized Application Platform​

  • Based on containerd runtime, OCI standard image deployment
  • Multi-container support (Main + Sub), plugin-based dependency resolution
  • Health check system (Command / HTTP / TCP, exponential backoff strategy)
  • Automatic restart (backoff strategy on failure)

6. System Configuration​

The platform uses YAML configuration files to manage all service parameters. Configuration files are located in the configs/ directory:

Configuration FileServiceCore Configuration
platform-api.yamlplatform-apiServer port, authentication keys, log level
platform/app-manager.yamlapp-managercontainerd connection, security policies, resource limits
platform/event-bus.yamlevent-busSocket path, TCP listener, topic ACL
platform/device-control.yamldevice-controlMCU UART device, lens parameters, automation rules
platform/camera-daemon.yamlcamera-daemonVideo capture, encoding parameters, RTSP configuration
platform/discovery.yamldevice-discoveryCT-Disc protocol parameters
ai/ai-runtime.yamlai-runtimeHAL library paths, model repository, scheduler, auto-inference pipeline
preload.yamlpack-factoryFactory preloading (pre-installed models and applications)
security/seccomp-default.jsonSecurityDefault Seccomp system call allowlist

Installation path: /opt/aipc/ (binaries in bin/, configuration in etc/).