当前位置: 首页>>代码示例>>C++>>正文


C++ PeripheralPtr::Initialise方法代码示例

本文整理汇总了C++中PeripheralPtr::Initialise方法的典型用法代码示例。如果您正苦于以下问题:C++ PeripheralPtr::Initialise方法的具体用法?C++ PeripheralPtr::Initialise怎么用?C++ PeripheralPtr::Initialise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PeripheralPtr的用法示例。


在下文中一共展示了PeripheralPtr::Initialise方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreatePeripheral

void CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result)
{
  PeripheralPtr peripheral;
  PeripheralScanResult mappedResult = result;
  if (mappedResult.m_busType == PERIPHERAL_BUS_UNKNOWN)
    mappedResult.m_busType = bus.Type();

  /* check whether there's something mapped in peripherals.xml */
  GetMappingForDevice(bus, mappedResult);

  switch(mappedResult.m_mappedType)
  {
  case PERIPHERAL_HID:
    peripheral = PeripheralPtr(new CPeripheralHID(mappedResult, &bus));
    break;

  case PERIPHERAL_NIC:
    peripheral = PeripheralPtr(new CPeripheralNIC(mappedResult, &bus));
    break;

  case PERIPHERAL_DISK:
    peripheral = PeripheralPtr(new CPeripheralDisk(mappedResult, &bus));
    break;

  case PERIPHERAL_NYXBOARD:
    peripheral = PeripheralPtr(new CPeripheralNyxboard(mappedResult, &bus));
    break;

  case PERIPHERAL_TUNER:
    peripheral = PeripheralPtr(new CPeripheralTuner(mappedResult, &bus));
    break;

  case PERIPHERAL_BLUETOOTH:
    peripheral = PeripheralPtr(new CPeripheralBluetooth(mappedResult, &bus));
    break;

  case PERIPHERAL_CEC:
#if defined(HAVE_LIBCEC)
    if (bus.Type() == PERIPHERAL_BUS_CEC)
      peripheral = PeripheralPtr(new CPeripheralCecAdapter(mappedResult, &bus));
#else
    if (!m_bMissingLibCecWarningDisplayed)
    {
      m_bMissingLibCecWarningDisplayed = true;
      CLog::Log(LOGWARNING, "%s - libCEC support has not been compiled in, so the CEC adapter cannot be used.", __FUNCTION__);
      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(36000), g_localizeStrings.Get(36017));
    }
#endif
    break;

  case PERIPHERAL_IMON:
    peripheral = PeripheralPtr(new CPeripheralImon(mappedResult, &bus));
    break;

  case PERIPHERAL_JOYSTICK:
    peripheral = PeripheralPtr(new CPeripheralJoystick(mappedResult, &bus));
    break;

  default:
    break;
  }

  if (peripheral)
  {
    /* try to initialise the new peripheral
     * Initialise() will make sure that each device is only initialised once */
    if (peripheral->Initialise())
      bus.Register(peripheral);
    else
    {
      CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, mappedResult.m_strLocation.c_str());
    }
  }
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:74,代码来源:Peripherals.cpp


注:本文中的PeripheralPtr::Initialise方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。