/** * Returns the status of a specified Guest Additions facility. * * @return aStatus Current status of specified facility. * @param aType Facility to get the status from. * @param aTimestamp Timestamp of last facility status update in ms (optional). */ HRESULT Guest::getFacilityStatus(AdditionsFacilityType_T aFacility, LONG64 *aTimestamp, AdditionsFacilityStatus_T *aStatus) { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); /* Not checking for aTimestamp is intentional; it's optional. */ FacilityMapIterConst it = mData.mFacilityMap.find(aFacility); if (it != mData.mFacilityMap.end()) { AdditionsFacility *pFacility = it->second; ComAssert(pFacility); *aStatus = pFacility->i_getStatus(); if (aTimestamp) *aTimestamp = pFacility->i_getLastUpdated(); } else { /* * Do not fail here -- could be that the facility never has been brought up (yet) but * the host wants to have its status anyway. So just tell we don't know at this point. */ *aStatus = AdditionsFacilityStatus_Unknown; if (aTimestamp) *aTimestamp = RTTimeMilliTS(); } return S_OK; }
bool Guest::i_facilityIsActive(VBoxGuestFacilityType enmFacility) { Assert(enmFacility < INT32_MAX); FacilityMapIterConst it = mData.mFacilityMap.find((AdditionsFacilityType_T)enmFacility); if (it != mData.mFacilityMap.end()) { AdditionsFacility *pFac = it->second; return (pFac->i_getStatus() == AdditionsFacilityStatus_Active); } return false; }