---
applyTo: "MainShell/Hardware/**/*.cs,MainShell/DeviceMaintance/**/*.cs,MainShell/Manual/**/*.cs,MainShell/ToolBox/**/*.cs"
---

# Hardware and IO Instructions

## Hardware Access Rules
- Reuse HardwareManager as the primary hardware entry point
- Do not invent parallel hardware access layers unless explicitly requested
- Keep hardware naming and organization consistent with existing project patterns

## 中文说明
硬件访问规则：
- 统一通过 `HardwareManager` 作为主要硬件入口
- 不要平行新建另一套硬件访问层
- 硬件命名和组织方式保持与现有项目一致

## Axis Naming Rules
All axis names should be defined as constants in the existing axis naming class.

Naming pattern:
- Axis_ prefix
- Examples:
  - Axis_SZ
  - Axis_PHS_X1
  - Axis_WS_X3
  - Axis_Stage_Y3

If a new axis is introduced, define a constant in the existing axis name holder.

## 中文说明
轴名规则：
- 所有轴名都应在现有轴名定义类中声明为常量
- 命名统一使用 `Axis_` 前缀
- 如果新增轴，必须补充常量定义，不要在业务代码中硬编码字符串轴名

## IO Rules
- IO point definitions are loaded from CSV configuration
- Reuse DeviceIoPointDefinition and existing IO grouping structures
- Preserve support for simulated IO states if relevant
- Keep IO service/model/event naming device-oriented

Use:
- DeviceIoMonitorService
- DeviceIoSnapshot
- DeviceCylinderService

Avoid logistics-specific names unless the domain explicitly requires them:
- ConveyorIoService
- LoaderIoMonitor

## 中文说明
IO 规则：
- IO 点定义通过 CSV 配置加载
- 复用现有 `DeviceIoPointDefinition` 和 IO 分组结构
- 如已有模拟 IO 状态机制，应保持兼容
- IO 相关命名要采用设备级命名，不要使用过于物流化的命名，除非业务明确需要

## Safety Preference
- Validate device state before critical actions
- Do not assume hardware is ready
- Keep generated code conservative and traceable

## 中文说明
安全原则：
- 关键设备动作前先校验设备状态
- 不要默认硬件已经 ready
- 生成代码时要偏保守、可追踪
