本文整理汇总了C++中ControllerPtr::get_name方法的典型用法代码示例。如果您正苦于以下问题:C++ ControllerPtr::get_name方法的具体用法?C++ ControllerPtr::get_name怎么用?C++ ControllerPtr::get_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControllerPtr
的用法示例。
在下文中一共展示了ControllerPtr::get_name方法的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: assert
void
XboxdrvDaemon::on_disconnect(ControllerSlotPtr slot)
{
ControllerPtr controller = slot->get_controller();
assert(controller);
log_info("controller disconnected: "
<< controller->get_usbpath() << " "
<< controller->get_usbid() << " "
<< "'" << controller->get_name() << "'");
if (!m_opts.on_disconnect.empty())
{
log_info("launching disconnect script: " << m_opts.on_disconnect);
std::vector<std::string> args;
args.push_back(m_opts.on_disconnect);
args.push_back(controller->get_usbpath());
args.push_back(controller->get_usbid());
args.push_back(controller->get_name());
spawn_exe(args);
}
}