| 721 | } |
| 722 | |
| 723 | void ResourceManager::DetectDevices() |
| 724 | { |
| 725 | /*-----------------------------------------------------*\ |
| 726 | | Process pre-detection hooks | |
| 727 | \*-----------------------------------------------------*/ |
| 728 | ProcessPreDetectionHooks(); |
| 729 | |
| 730 | /*-----------------------------------------------------*\ |
| 731 | | Process Dynamic Detectors | |
| 732 | \*-----------------------------------------------------*/ |
| 733 | if(!dynamic_detectors_processed) |
| 734 | { |
| 735 | ProcessDynamicDetectors(); |
| 736 | } |
| 737 | |
| 738 | /*-----------------------------------------------------*\ |
| 739 | | Call detection start callbacks | |
| 740 | \*-----------------------------------------------------*/ |
| 741 | LOG_TRACE("[ResourceManager] Calling detection start callbacks."); |
| 742 | |
| 743 | for(unsigned int callback_idx = 0; callback_idx < DetectionStartCallbacks.size(); callback_idx++) |
| 744 | { |
| 745 | DetectionStartCallbacks[callback_idx](DetectionStartCallbackArgs[callback_idx]); |
| 746 | } |
| 747 | |
| 748 | /*-----------------------------------------------------*\ |
| 749 | | Update the detector settings | |
| 750 | \*-----------------------------------------------------*/ |
| 751 | UpdateDetectorSettings(); |
| 752 | |
| 753 | if(detection_enabled) |
| 754 | { |
| 755 | /*-------------------------------------------------*\ |
| 756 | | Do nothing is it is already detecting devices | |
| 757 | \*-------------------------------------------------*/ |
| 758 | if(detection_is_required.load()) |
| 759 | { |
| 760 | return; |
| 761 | } |
| 762 | |
| 763 | /*-------------------------------------------------*\ |
| 764 | | If there's anything left from the last time, | |
| 765 | | we shall remove it first | |
| 766 | \*-------------------------------------------------*/ |
| 767 | detection_percent = 0; |
| 768 | detection_string = ""; |
| 769 | |
| 770 | DetectionProgressChanged(); |
| 771 | |
| 772 | Cleanup(); |
| 773 | |
| 774 | UpdateDeviceList(); |
| 775 | |
| 776 | /*-------------------------------------------------*\ |
| 777 | | Start the device detection thread | |
| 778 | \*-------------------------------------------------*/ |
| 779 | detection_is_required = true; |
| 780 | DetectDevicesThread = new std::thread(&ResourceManager::DetectDevicesThreadFunction, this); |
no test coverage detected