/** * 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). */ STDMETHODIMP Guest::GetFacilityStatus(AdditionsFacilityType_T aType, LONG64 *aTimestamp, AdditionsFacilityStatus_T *aStatus) { AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); CheckComArgNotNull(aStatus); /* Not checking for aTimestamp is intentional; it's optional. */ FacilityMapIterConst it = mData.mFacilityMap.find(aType); if (it != mData.mFacilityMap.end()) { AdditionsFacility *pFacility = it->second; ComAssert(pFacility); *aStatus = pFacility->getStatus(); if (aTimestamp) *aTimestamp = pFacility->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::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->getStatus() == AdditionsFacilityStatus_Active); } return false; }