| 797 | } |
| 798 | |
| 799 | bool OptionProfile(std::string argument, std::vector<RGBController *>& rgb_controllers) |
| 800 | { |
| 801 | ResourceManager::get()->WaitForDeviceDetection(); |
| 802 | |
| 803 | /*---------------------------------------------------------*\ |
| 804 | | Attempt to load profile | |
| 805 | \*---------------------------------------------------------*/ |
| 806 | if(ResourceManager::get()->GetProfileManager()->LoadProfile(argument)) |
| 807 | { |
| 808 | /*-----------------------------------------------------*\ |
| 809 | | Change device mode if profile loading was successful | |
| 810 | \*-----------------------------------------------------*/ |
| 811 | for(std::size_t controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++) |
| 812 | { |
| 813 | RGBController* device = rgb_controllers[controller_idx]; |
| 814 | |
| 815 | device->DeviceUpdateMode(); |
| 816 | LOG_DEBUG("Updating mode for %s to %i", device->name.c_str(), device->active_mode); |
| 817 | |
| 818 | if(device->modes[device->active_mode].color_mode == MODE_COLORS_PER_LED) |
| 819 | { |
| 820 | device->DeviceUpdateLEDs(); |
| 821 | LOG_DEBUG("Mode uses per-LED color, also updating LEDs"); |
| 822 | } |
| 823 | } |
| 824 | |
| 825 | std::cout << "Profile loaded successfully" << std::endl; |
| 826 | return true; |
| 827 | } |
| 828 | else |
| 829 | { |
| 830 | std::cout << "Profile failed to load" << std::endl; |
| 831 | return false; |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | bool OptionSaveProfile(std::string argument) |
| 836 | { |
no test coverage detected