SDKC++ SDK

震动反馈

检查 haptics 能力,设置左右强度并在退出前清除。

当前版本 · 1.0.0

震动反馈

设置与清除

if (device.get_device_info().capabilities.haptics) {
    exo.start();
    auto haptics = device.haptics();
    qnbot::ExoHaptics value;
    value.left = 60;
    value.right = 40;
    haptics.set(value);
    // ...
    haptics.clear();
}

每侧是 std::optional<std::uint8_t>,有效范围 0…100;set() 至少需要一侧。latest() 返回最近确认状态。设备停止、断线或关闭后状态失效,恢复时不会自动重放。