HostDev: Start/stop emulation based on no. of deviceGroups
Host Devices are included in deviceCount() but not in deviceGroupCount() and emulation is not applicable to Host devices
This commit is contained in:
parent
7e476a8361
commit
178b942d6e
@ -166,8 +166,9 @@ bool DeviceManager::addDeviceGroup(uint deviceGroupId)
|
|||||||
|
|
||||||
enumerateDevices(deviceGroup, kAdd);
|
enumerateDevices(deviceGroup, kAdd);
|
||||||
|
|
||||||
// Start emulation when first device is added
|
// Start emulation when first device group is added
|
||||||
if ((deviceCount() == 1) && port_)
|
// NOTE: Host devices don't have a deviceGroup and don't need emulation
|
||||||
|
if ((deviceGroupCount() == 1) && port_)
|
||||||
port_->startDeviceEmulation();
|
port_->startDeviceEmulation();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -186,8 +187,9 @@ bool DeviceManager::deleteDeviceGroup(uint deviceGroupId)
|
|||||||
enumerateDevices(deviceGroup, kDelete);
|
enumerateDevices(deviceGroup, kDelete);
|
||||||
delete deviceGroup;
|
delete deviceGroup;
|
||||||
|
|
||||||
// Stop emulation if no devices remain
|
// Stop emulation if no device groups remain
|
||||||
if ((deviceCount() == 0) && port_)
|
// NOTE: Host devices don't have a deviceGroup and don't need emulation
|
||||||
|
if ((deviceGroupCount() == 0) && port_)
|
||||||
port_->stopDeviceEmulation();
|
port_->stopDeviceEmulation();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -222,7 +224,7 @@ bool DeviceManager::modifyDeviceGroup(const OstProto::DeviceGroup *deviceGroup)
|
|||||||
|
|
||||||
int DeviceManager::deviceCount()
|
int DeviceManager::deviceCount()
|
||||||
{
|
{
|
||||||
return deviceList_.size() + hostDeviceList_.size();
|
return deviceList_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::getDeviceList(
|
void DeviceManager::getDeviceList(
|
||||||
|
Loading…
Reference in New Issue
Block a user