本文整理汇总了C++中ControllerPtr::set_led方法的典型用法代码示例。如果您正苦于以下问题:C++ ControllerPtr::set_led方法的具体用法?C++ ControllerPtr::set_led怎么用?C++ ControllerPtr::set_led使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControllerPtr
的用法示例。
在下文中一共展示了ControllerPtr::set_led方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
XboxdrvDaemon::connect(ControllerSlotPtr slot, ControllerPtr controller)
{
log_info("connecting slot to thread");
try
{
// set the LED status
if (slot->get_led_status() == -1)
{
controller->set_led(static_cast<uint8_t>(2 + (slot->get_id() % 4)));
}
else
{
controller->set_led(static_cast<uint8_t>(slot->get_led_status()));
}
}
catch(const std::exception& err)
{
log_error("failed to set led: " << err.what());
}
slot->connect(controller);
on_connect(slot);
log_info("controller connected: "
<< controller->get_usbpath() << " "
<< controller->get_usbid() << " "
<< "'" << controller->get_name() << "'");
log_info("launched Controller for " << controller->get_usbpath()
<< " in slot " << slot->get_id() << ", free slots: "
<< get_free_slot_count() << "/" << m_controller_slots.size());
}
示例2:
void
XboxdrvMain::init_controller(const ControllerPtr& controller)
{
m_jsdev_number = UInput::find_jsdev_number();
m_evdev_number = UInput::find_evdev_number();
if (m_opts.get_controller_slot().get_led_status() == -1)
{
controller->set_led(static_cast<uint8_t>(2 + m_jsdev_number % 4));
}
else
{
controller->set_led(static_cast<uint8_t>(m_opts.get_controller_slot().get_led_status()));
}
if (m_opts.rumble_l != -1 && m_opts.rumble_r != -1)
{ // Only set rumble when explicitly requested
controller->set_rumble(static_cast<uint8_t>(m_opts.rumble_l),
static_cast<uint8_t>(m_opts.rumble_r));
}
}