本文整理汇总了C++中USBDevice::GetDeviceType方法的典型用法代码示例。如果您正苦于以下问题:C++ USBDevice::GetDeviceType方法的具体用法?C++ USBDevice::GetDeviceType怎么用?C++ USBDevice::GetDeviceType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USBDevice
的用法示例。
在下文中一共展示了USBDevice::GetDeviceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
//!!Polymorphism would be easier to implement!
BOOL USBDeviceHandle::Open(const USBDevice& clDevice_, USBDeviceHandle*& pclDeviceHandle_, ULONG ulBaudRate_)
{
//dynamic_cast does not handle *& types
BOOL bSuccess;
switch(clDevice_.GetDeviceType())
{
case DeviceType::SI_LABS:
{
const USBDeviceSI& clDeviceSi = dynamic_cast<const USBDeviceSI&>(clDevice_);
USBDeviceHandleSI* pclDeviceHandleSi;
bSuccess = USBDeviceHandleSI::Open(clDeviceSi, pclDeviceHandleSi, ulBaudRate_);
//pclDeviceHandle_ = dynamic_cast<USBDeviceHandle*>(pclDeviceHandleSi);
pclDeviceHandle_ = pclDeviceHandleSi;
break;
}
case DeviceType::SI_LABS_IOKIT:
{
const USBDeviceIOKit& clDeviceSi = dynamic_cast<const USBDeviceIOKit&>(clDevice_);
USBDeviceHandleSIIOKit* pclDeviceHandleSiIOKit;
bSuccess = USBDeviceHandleSIIOKit::Open(clDeviceSi, pclDeviceHandleSiIOKit, ulBaudRate_);
//pclDeviceHandle_ = dynamic_cast<USBDeviceHandle*>(pclDeviceHandleSiIOKit);
pclDeviceHandle_ = pclDeviceHandleSiIOKit;
break;
}
case DeviceType::IO_KIT:
{
const USBDeviceIOKit& clDeviceIOKit = dynamic_cast<const USBDeviceIOKit&>(clDevice_);
USBDeviceHandleIOKit* pclDeviceHandleIOKit;
bSuccess = USBDeviceHandleIOKit::Open(clDeviceIOKit, pclDeviceHandleIOKit);
//pclDeviceHandle_ = dynamic_cast<USBDeviceHandle*>(pclDeviceHandleIOKit);
pclDeviceHandle_ = pclDeviceHandleIOKit;
break;
}
default:
{
pclDeviceHandle_ = NULL;
bSuccess = FALSE;
break;
}
}
return bSuccess;
}