VirtualBox

Ignore:
Timestamp:
Aug 8, 2014 10:13:28 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95440
Message:

Main,Frontends: poll more than one device in IConsole::GetDeviceActivity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r52252 r52319  
    27542754}
    27552755
    2756 HRESULT Console::getDeviceActivity(DeviceType_T aType,
    2757                                    DeviceActivity_T *aActivity)
     2756HRESULT Console::getDeviceActivity(const std::vector<DeviceType_T> &aType,
     2757                                   std::vector<DeviceActivity_T> &aActivity)
    27582758{
    27592759    /*
     
    27622762     */
    27632763
    2764     /* Get LED array to read */
    2765     PDMLEDCORE SumLed = {0};
    2766     switch (aType)
    2767     {
    2768         case DeviceType_Floppy:
    2769         case DeviceType_DVD:
    2770         case DeviceType_HardDisk:
    2771         {
    2772             for (unsigned i = 0; i < RT_ELEMENTS(mapStorageLeds); ++i)
    2773                 if (maStorageDevType[i] == aType)
    2774                     SumLed.u32 |= readAndClearLed(mapStorageLeds[i]);
    2775             break;
    2776         }
    2777 
    2778         case DeviceType_Network:
    2779         {
    2780             for (unsigned i = 0; i < RT_ELEMENTS(mapNetworkLeds); ++i)
    2781                 SumLed.u32 |= readAndClearLed(mapNetworkLeds[i]);
    2782             break;
    2783         }
    2784 
    2785         case DeviceType_USB:
    2786         {
    2787             for (unsigned i = 0; i < RT_ELEMENTS(mapUSBLed); ++i)
    2788                 SumLed.u32 |= readAndClearLed(mapUSBLed[i]);
    2789             break;
    2790         }
    2791 
    2792         case DeviceType_SharedFolder:
    2793         {
    2794             SumLed.u32 |= readAndClearLed(mapSharedFolderLed);
    2795             break;
    2796         }
    2797 
    2798         case DeviceType_Graphics3D:
    2799         {
    2800             SumLed.u32 |= readAndClearLed(mapCrOglLed);
    2801             break;
    2802         }
    2803 
    2804         default:
    2805             return setError(E_INVALIDARG,
    2806                 tr("Invalid device type: %d"),
    2807                 aType);
    2808     }
    2809 
    2810     /* Compose the result */
    2811     switch (SumLed.u32 & (PDMLED_READING | PDMLED_WRITING))
    2812     {
    2813         case 0:
    2814             *aActivity = DeviceActivity_Idle;
    2815             break;
    2816         case PDMLED_READING:
    2817             *aActivity = DeviceActivity_Reading;
    2818             break;
    2819         case PDMLED_WRITING:
    2820         case PDMLED_READING | PDMLED_WRITING:
    2821             *aActivity = DeviceActivity_Writing;
    2822             break;
     2764    aActivity.resize(aType.size());
     2765
     2766    size_t iType;
     2767    for (iType = 0; iType < aType.size(); ++iType)
     2768    {
     2769        /* Get LED array to read */
     2770        PDMLEDCORE SumLed = {0};
     2771        switch (aType[iType])
     2772        {
     2773            case DeviceType_Floppy:
     2774            case DeviceType_DVD:
     2775            case DeviceType_HardDisk:
     2776            {
     2777                for (unsigned i = 0; i < RT_ELEMENTS(mapStorageLeds); ++i)
     2778                    if (maStorageDevType[i] == aType[iType])
     2779                        SumLed.u32 |= readAndClearLed(mapStorageLeds[i]);
     2780                break;
     2781            }
     2782
     2783            case DeviceType_Network:
     2784            {
     2785                for (unsigned i = 0; i < RT_ELEMENTS(mapNetworkLeds); ++i)
     2786                    SumLed.u32 |= readAndClearLed(mapNetworkLeds[i]);
     2787                break;
     2788            }
     2789
     2790            case DeviceType_USB:
     2791            {
     2792                for (unsigned i = 0; i < RT_ELEMENTS(mapUSBLed); ++i)
     2793                    SumLed.u32 |= readAndClearLed(mapUSBLed[i]);
     2794                break;
     2795            }
     2796
     2797            case DeviceType_SharedFolder:
     2798            {
     2799                SumLed.u32 |= readAndClearLed(mapSharedFolderLed);
     2800                break;
     2801            }
     2802
     2803            case DeviceType_Graphics3D:
     2804            {
     2805                SumLed.u32 |= readAndClearLed(mapCrOglLed);
     2806                break;
     2807            }
     2808
     2809            default:
     2810                return setError(E_INVALIDARG,
     2811                    tr("Invalid device type: %d"),
     2812                    aType[iType]);
     2813        }
     2814
     2815        /* Compose the result */
     2816        switch (SumLed.u32 & (PDMLED_READING | PDMLED_WRITING))
     2817        {
     2818            case 0:
     2819                aActivity[iType] = DeviceActivity_Idle;
     2820                break;
     2821            case PDMLED_READING:
     2822                aActivity[iType] = DeviceActivity_Reading;
     2823                break;
     2824            case PDMLED_WRITING:
     2825            case PDMLED_READING | PDMLED_WRITING:
     2826                aActivity[iType] = DeviceActivity_Writing;
     2827                break;
     2828        }
    28232829    }
    28242830
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette