震动反馈
检查 haptics 能力,设置左右强度并在退出前清除。
当前版本 · 1.4.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() 返回最近确认状态。设备停止、断线或关闭后状态失效,latest() 返回空 std::optional;SDK 不发布虚构的零值 Sample,恢复时也不会自动重放断线前的震动指令。设备仍连接时,程序正常结束前应调用 clear() 让物理输出归零。