Skip to content

核心概念 ​

使用流程 ​

  1. 获取 DeviceManager 单例:hal::DeviceManager::instance()
  2. 查询可用设备:get_all_device_name_list() / get_device_name_list(type)
  3. 获取具体设备:get_device(type, name)
  4. 转换为具体类型指针:std::dynamic_pointer_cast<hal::DigitalIO>(dev)
  5. 执行设备操作:set_output() / get_input() 等

设备抽象基类 ​

所有设备继承自 Device 基类,提供:

  • valid() — 设备是否可用
  • get_device_type() — 设备类型
  • get_device_name() — 设备名称
🤖 AI 助手 / 自动化工具:先读 《Agent 开发指引》 与 《生成前信息采集清单》;机器可读入口 /llms.txt;本页纯文本版:把网址中的 .html 换成 .md