[SMC] Removed std::bind usage in favor of lambda

This commit is contained in:
Gliniak
2026-05-18 19:52:12 +02:00
parent 482629a3b1
commit ef67d1ca3f

View File

@@ -17,42 +17,38 @@ namespace kernel {
SystemManagementController::SystemManagementController() SystemManagementController::SystemManagementController()
: dvd_tray_state_(X_DVD_TRAY_STATE::OPEN) { : dvd_tray_state_(X_DVD_TRAY_STATE::OPEN) {
smc_commands_[X_SMC_CMD::QUERY_TEMP_SENSOR] = auto registerQuery =
std::bind(&SystemManagementController::QueryTemperatureSensor, this, [&](X_SMC_CMD command,
std::placeholders::_1, std::placeholders::_2); void (SystemManagementController::*fn)(X_SMC_DATA*, X_SMC_DATA*)) {
smc_commands_[X_SMC_CMD::QUERY_TRAY] = smc_commands_[command] = [this, fn](X_SMC_DATA* message,
std::bind(&SystemManagementController::QueryDriveTraySensor, this, X_SMC_DATA* response) {
std::placeholders::_1, std::placeholders::_2); (this->*fn)(message, response);
smc_commands_[X_SMC_CMD::QUERY_AV_PACK] = };
std::bind(&SystemManagementController::QueryAvPack, this, };
std::placeholders::_1, std::placeholders::_2);
smc_commands_[X_SMC_CMD::QUERY_SMC_VERSION] = registerQuery(X_SMC_CMD::QUERY_TEMP_SENSOR,
std::bind(&SystemManagementController::QuerySmcVersion, this, &SystemManagementController::QueryTemperatureSensor);
std::placeholders::_1, std::placeholders::_2); registerQuery(X_SMC_CMD::QUERY_TRAY,
smc_commands_[X_SMC_CMD::QUERY_IR_ADDRESS] = &SystemManagementController::QueryDriveTraySensor);
std::bind(&SystemManagementController::QueryIRAddress, this, registerQuery(X_SMC_CMD::QUERY_AV_PACK,
std::placeholders::_1, std::placeholders::_2); &SystemManagementController::QueryAvPack);
smc_commands_[X_SMC_CMD::QUERY_TILT_SENSOR] = registerQuery(X_SMC_CMD::QUERY_SMC_VERSION,
std::bind(&SystemManagementController::QueryTiltState, this, &SystemManagementController::QuerySmcVersion);
std::placeholders::_1, std::placeholders::_2); registerQuery(X_SMC_CMD::QUERY_IR_ADDRESS,
smc_commands_[X_SMC_CMD::SET_FAN_SPEED_CPU] = &SystemManagementController::QueryIRAddress);
std::bind(&SystemManagementController::SetFanSpeed, this, registerQuery(X_SMC_CMD::QUERY_TILT_SENSOR,
std::placeholders::_1, std::placeholders::_2); &SystemManagementController::QueryTiltState);
smc_commands_[X_SMC_CMD::SET_FAN_SPEED_GPU] = registerQuery(X_SMC_CMD::SET_FAN_SPEED_CPU,
std::bind(&SystemManagementController::SetFanSpeed, this, &SystemManagementController::SetFanSpeed);
std::placeholders::_1, std::placeholders::_2); registerQuery(X_SMC_CMD::SET_FAN_SPEED_GPU,
smc_commands_[X_SMC_CMD::SET_DVD_TRAY] = &SystemManagementController::SetFanSpeed);
std::bind(&SystemManagementController::SetDriveTray, this, registerQuery(X_SMC_CMD::SET_DVD_TRAY,
std::placeholders::_1, std::placeholders::_2); &SystemManagementController::SetDriveTray);
smc_commands_[X_SMC_CMD::SET_IR_ADDRESS] = registerQuery(X_SMC_CMD::SET_IR_ADDRESS,
std::bind(&SystemManagementController::SetIRAddress, this, &SystemManagementController::SetIRAddress);
std::placeholders::_1, std::placeholders::_2); registerQuery(X_SMC_CMD::SET_POWER_LED,
smc_commands_[X_SMC_CMD::SET_POWER_LED] = &SystemManagementController::SetPowerLed);
std::bind(&SystemManagementController::SetPowerLed, this, registerQuery(X_SMC_CMD::SET_LEDS, &SystemManagementController::SetLedState);
std::placeholders::_1, std::placeholders::_2);
smc_commands_[X_SMC_CMD::SET_LEDS] =
std::bind(&SystemManagementController::SetLedState, this,
std::placeholders::_1, std::placeholders::_2);
}; };
SystemManagementController::~SystemManagementController() {}; SystemManagementController::~SystemManagementController() {};