本文整理汇总了C++中CNBLogicalDevice::IsOperatable方法的典型用法代码示例。如果您正苦于以下问题:C++ CNBLogicalDevice::IsOperatable方法的具体用法?C++ CNBLogicalDevice::IsOperatable怎么用?C++ CNBLogicalDevice::IsOperatable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNBLogicalDevice
的用法示例。
在下文中一共展示了CNBLogicalDevice::IsOperatable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOperatableSingleDevices
NBUnitDevicePtrList CMainFrame::GetOperatableSingleDevices()
{
NBUnitDevicePtrList listUnitDevicesSingle;
CNBLogicalDevice *pLogicalDevice;
for(NBLogicalDevicePtrList::iterator itLogicalDevice = m_listLogicalDevices.begin();
itLogicalDevice != m_listLogicalDevices.end(); itLogicalDevice++)
{
pLogicalDevice = *itLogicalDevice;
if( pLogicalDevice->IsOperatable() &&
pLogicalDevice->IsHDD() &&
!pLogicalDevice->IsGroup())
{
listUnitDevicesSingle.push_back((*pLogicalDevice)[0]);
}
}
return listUnitDevicesSingle;
}
示例2: OnReplaceUnitDevice
void CMainFrame::OnReplaceUnitDevice(UINT wNotifyCode, int wID, HWND hwndCtl)
{
CNBDevice *pDevice = m_viewTreeList.GetSelectedDevice();
if(!pDevice)
return;
if(!pDevice->GetCommandAbility(wID))
return;
CNBLogicalDevice *pLogicalDevice = dynamic_cast<CNBLogicalDevice *>(pDevice);
if(!pLogicalDevice)
return;
// find the missing device
CNBLogicalDevice *pLogicalDeviceReplace = NULL;
CNBUnitDevice *pUnitDeviceReplace = NULL;
NBUnitDevicePtrList listUnitDevicesReplace;
NBLogicalDevicePtrList::iterator itLogicalDevice;
for(UINT32 i = 0; i < pLogicalDevice->DevicesTotal(); i++)
{
if(!(*pLogicalDevice)[i])
{
for(itLogicalDevice = m_listLogicalDevices.begin();
itLogicalDevice != m_listLogicalDevices.end();
++itLogicalDevice)
{
pLogicalDeviceReplace = *itLogicalDevice;
if(pLogicalDeviceReplace)
{
if (pLogicalDeviceReplace->IsHDD() &&
!pLogicalDeviceReplace->IsGroup() &&
pLogicalDeviceReplace->IsOperatable())
{
pUnitDeviceReplace = (*pLogicalDeviceReplace)[0];
if (pUnitDeviceReplace->IsThis(
pLogicalDevice->DIB()->UnitDisks[i].MACAddr,
pLogicalDevice->DIB()->UnitDisks[i].UnitNumber))
{
// ok we found replacable HDD
listUnitDevicesReplace.push_back(pUnitDeviceReplace);
}
}
}
}
}
}
if(!listUnitDevicesReplace.size())
return;
CNBSelectDeviceDlg dlgSelectDevice(
IDD_DEVICE_LIST,
IDS_REPLACE_UNIT_DEVICE_DLG_CAPTION,
IDS_REPLACE_UNIT_DEVICE_DLG_MESSAGE,
listUnitDevicesReplace,
0,
CheckCapacityForSpare,
pLogicalDevice);
if(dlgSelectDevice.DoModal() != IDOK)
return;
// dlgSelectDevice is not selective dialog. get unit device from listUnitDevicesReplace
CNBUnitDevice *pUnitDevice = *(listUnitDevicesReplace.begin());
// Bind & Synchronize
NDASCOMM_CONNECTION_INFO ci, ci_replace;
pLogicalDevice->InitConnectionInfo(&ci, TRUE); // use write access. this function does not support run time replace yet.
pUnitDevice->InitConnectionInfo(&ci_replace, TRUE);
for(UINT32 i = 0; i < pLogicalDevice->DevicesTotal(); i++)
{
if (!(*pLogicalDevice)[i])
{
break;
}
}
if(pLogicalDevice->DevicesTotal() == i)
{
// failed to find missing device
return;
}
AutoCursor l_auto_cursor(IDC_WAIT);
BOOL bResults = NdasOpReplaceUnitDevice(
&ci, &ci_replace, i);
l_auto_cursor.Release();
pLogicalDevice->HixChangeNotify(pGetNdasHostGuid());
pUnitDevice->HixChangeNotify(pGetNdasHostGuid());
if(!bResults)
{
CString strMsg;
//.........这里部分代码省略.........