MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / cli_post_detection

Function cli_post_detection

cli.cpp:1627–1703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1625}
1626
1627unsigned int cli_post_detection(int argc, char *argv[])
1628{
1629 /*---------------------------------------------------------*\
1630 | Wait for device detection |
1631 \*---------------------------------------------------------*/
1632 ResourceManager::get()->WaitForDeviceDetection();
1633
1634 /*---------------------------------------------------------*\
1635 | Get controller list from resource manager |
1636 \*---------------------------------------------------------*/
1637 std::vector<RGBController *> rgb_controllers = ResourceManager::get()->GetRGBControllers();
1638
1639 /*---------------------------------------------------------*\
1640 | Process the argument options |
1641 \*---------------------------------------------------------*/
1642 Options options;
1643 unsigned int ret_flags = ProcessOptions(argc, argv, &options, rgb_controllers);
1644
1645 /*---------------------------------------------------------*\
1646 | If the return flags are set, exit CLI mode without |
1647 | processing device updates from CLI input. |
1648 \*---------------------------------------------------------*/
1649 switch(ret_flags)
1650 {
1651 case 0:
1652 break;
1653
1654 case RET_FLAG_PRINT_HELP:
1655 OptionHelp();
1656 exit(-1);
1657 break;
1658
1659 default:
1660 return ret_flags;
1661 break;
1662 }
1663
1664 /*---------------------------------------------------------*\
1665 | If the options has one or more specific devices, loop |
1666 | through all of the specific devices and apply settings. |
1667 | Otherwise, apply settings to all devices. |
1668 \*---------------------------------------------------------*/
1669 if (options.hasDevice)
1670 {
1671 for(unsigned int device_idx = 0; device_idx < options.devices.size(); device_idx++)
1672 {
1673 ApplyOptions(options.devices[device_idx], rgb_controllers);
1674 }
1675 }
1676 else if (!options.profile_loaded)
1677 {
1678 for (unsigned int device_idx = 0; device_idx < rgb_controllers.size(); device_idx++)
1679 {
1680 options.allDeviceOptions.device = device_idx;
1681 ApplyOptions(options.allDeviceOptions, rgb_controllers);
1682 }
1683 }
1684

Callers 1

mainFunction · 0.85

Calls 8

ProcessOptionsFunction · 0.85
OptionHelpFunction · 0.85
ApplyOptionsFunction · 0.85
GetProfileManagerMethod · 0.80
getFunction · 0.50
sizeMethod · 0.45
SaveProfileMethod · 0.45

Tested by

no test coverage detected