Use IPC:MakeHeader instead of hardcoded raw values for IPC command tables. (#6453)

* Use IPC:MakeHeader instead of hardcoded values for IPC command tables.

* Use u32 instead of unsigned int in MakeHeader function

Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>

* Fix clang format

---------

Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>
This commit is contained in:
PabloMK7 2023-04-28 07:31:03 +02:00 committed by GitHub
parent 9bd8c9290b
commit 63bc0b59bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 1983 additions and 1896 deletions

View file

@ -9,26 +9,28 @@ namespace Service::AC {
AC_I::AC_I(std::shared_ptr<Module> ac) : Module::Interface(std::move(ac), "ac:i", 10) {
static const FunctionInfo functions[] = {
{0x00010000, &AC_I::CreateDefaultConfig, "CreateDefaultConfig"},
{0x00040006, &AC_I::ConnectAsync, "ConnectAsync"},
{0x00050002, &AC_I::GetConnectResult, "GetConnectResult"},
{0x00070002, nullptr, "CancelConnectAsync"},
{0x00080004, &AC_I::CloseAsync, "CloseAsync"},
{0x00090002, &AC_I::GetCloseResult, "GetCloseResult"},
{0x000A0000, nullptr, "GetLastErrorCode"},
{0x000C0000, nullptr, "GetStatus"},
{0x000D0000, &AC_I::GetWifiStatus, "GetWifiStatus"},
{0x000E0042, nullptr, "GetCurrentAPInfo"},
{0x00100042, nullptr, "GetCurrentNZoneInfo"},
{0x00110042, nullptr, "GetNZoneApNumService"},
{0x001D0042, nullptr, "ScanAPs"},
{0x00240042, nullptr, "AddDenyApType"},
{0x00270002, &AC_I::GetInfraPriority, "GetInfraPriority"},
{0x002D0082, &AC_I::SetRequestEulaVersion, "SetRequestEulaVersion"},
{0x00300004, &AC_I::RegisterDisconnectEvent, "RegisterDisconnectEvent"},
{0x003C0042, nullptr, "GetAPSSIDList"},
{0x003E0042, &AC_I::IsConnected, "IsConnected"},
{0x00400042, &AC_I::SetClientVersion, "SetClientVersion"},
// clang-format off
{IPC::MakeHeader(0x0001, 0, 0), &AC_I::CreateDefaultConfig, "CreateDefaultConfig"},
{IPC::MakeHeader(0x0004, 0, 6), &AC_I::ConnectAsync, "ConnectAsync"},
{IPC::MakeHeader(0x0005, 0, 2), &AC_I::GetConnectResult, "GetConnectResult"},
{IPC::MakeHeader(0x0007, 0, 2), nullptr, "CancelConnectAsync"},
{IPC::MakeHeader(0x0008, 0, 4), &AC_I::CloseAsync, "CloseAsync"},
{IPC::MakeHeader(0x0009, 0, 2), &AC_I::GetCloseResult, "GetCloseResult"},
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "GetLastErrorCode"},
{IPC::MakeHeader(0x000C, 0, 0), nullptr, "GetStatus"},
{IPC::MakeHeader(0x000D, 0, 0), &AC_I::GetWifiStatus, "GetWifiStatus"},
{IPC::MakeHeader(0x000E, 1, 2), nullptr, "GetCurrentAPInfo"},
{IPC::MakeHeader(0x0010, 1, 2), nullptr, "GetCurrentNZoneInfo"},
{IPC::MakeHeader(0x0011, 1, 2), nullptr, "GetNZoneApNumService"},
{IPC::MakeHeader(0x001D, 1, 2), nullptr, "ScanAPs"},
{IPC::MakeHeader(0x0024, 1, 2), nullptr, "AddDenyApType"},
{IPC::MakeHeader(0x0027, 0, 2), &AC_I::GetInfraPriority, "GetInfraPriority"},
{IPC::MakeHeader(0x002D, 2, 2), &AC_I::SetRequestEulaVersion, "SetRequestEulaVersion"},
{IPC::MakeHeader(0x0030, 0, 4), &AC_I::RegisterDisconnectEvent, "RegisterDisconnectEvent"},
{IPC::MakeHeader(0x003C, 1, 2), nullptr, "GetAPSSIDList"},
{IPC::MakeHeader(0x003E, 1, 2), &AC_I::IsConnected, "IsConnected"},
{IPC::MakeHeader(0x0040, 1, 2), &AC_I::SetClientVersion, "SetClientVersion"},
// clang-format on
};
RegisterHandlers(functions);
}

View file

@ -9,26 +9,28 @@ namespace Service::AC {
AC_U::AC_U(std::shared_ptr<Module> ac) : Module::Interface(std::move(ac), "ac:u", 10) {
static const FunctionInfo functions[] = {
{0x00010000, &AC_U::CreateDefaultConfig, "CreateDefaultConfig"},
{0x00040006, &AC_U::ConnectAsync, "ConnectAsync"},
{0x00050002, &AC_U::GetConnectResult, "GetConnectResult"},
{0x00070002, nullptr, "CancelConnectAsync"},
{0x00080004, &AC_U::CloseAsync, "CloseAsync"},
{0x00090002, &AC_U::GetCloseResult, "GetCloseResult"},
{0x000A0000, nullptr, "GetLastErrorCode"},
{0x000C0000, nullptr, "GetStatus"},
{0x000D0000, &AC_U::GetWifiStatus, "GetWifiStatus"},
{0x000E0042, nullptr, "GetCurrentAPInfo"},
{0x00100042, nullptr, "GetCurrentNZoneInfo"},
{0x00110042, nullptr, "GetNZoneApNumService"},
{0x001D0042, nullptr, "ScanAPs"},
{0x00240042, nullptr, "AddDenyApType"},
{0x00270002, &AC_U::GetInfraPriority, "GetInfraPriority"},
{0x002D0082, &AC_U::SetRequestEulaVersion, "SetRequestEulaVersion"},
{0x00300004, &AC_U::RegisterDisconnectEvent, "RegisterDisconnectEvent"},
{0x003C0042, nullptr, "GetAPSSIDList"},
{0x003E0042, &AC_U::IsConnected, "IsConnected"},
{0x00400042, &AC_U::SetClientVersion, "SetClientVersion"},
// clang-format off
{IPC::MakeHeader(0x0001, 0, 0), &AC_U::CreateDefaultConfig, "CreateDefaultConfig"},
{IPC::MakeHeader(0x0004, 0, 6), &AC_U::ConnectAsync, "ConnectAsync"},
{IPC::MakeHeader(0x0005, 0, 2), &AC_U::GetConnectResult, "GetConnectResult"},
{IPC::MakeHeader(0x0007, 0, 2), nullptr, "CancelConnectAsync"},
{IPC::MakeHeader(0x0008, 0, 4), &AC_U::CloseAsync, "CloseAsync"},
{IPC::MakeHeader(0x0009, 0, 2), &AC_U::GetCloseResult, "GetCloseResult"},
{IPC::MakeHeader(0x000A, 0, 0), nullptr, "GetLastErrorCode"},
{IPC::MakeHeader(0x000C, 0, 0), nullptr, "GetStatus"},
{IPC::MakeHeader(0x000D, 0, 0), &AC_U::GetWifiStatus, "GetWifiStatus"},
{IPC::MakeHeader(0x000E, 1, 2), nullptr, "GetCurrentAPInfo"},
{IPC::MakeHeader(0x0010, 1, 2), nullptr, "GetCurrentNZoneInfo"},
{IPC::MakeHeader(0x0011, 1, 2), nullptr, "GetNZoneApNumService"},
{IPC::MakeHeader(0x001D, 1, 2), nullptr, "ScanAPs"},
{IPC::MakeHeader(0x0024, 1, 2), nullptr, "AddDenyApType"},
{IPC::MakeHeader(0x0027, 0, 2), &AC_U::GetInfraPriority, "GetInfraPriority"},
{IPC::MakeHeader(0x002D, 2, 2), &AC_U::SetRequestEulaVersion, "SetRequestEulaVersion"},
{IPC::MakeHeader(0x0030, 0, 4), &AC_U::RegisterDisconnectEvent, "RegisterDisconnectEvent"},
{IPC::MakeHeader(0x003C, 1, 2), nullptr, "GetAPSSIDList"},
{IPC::MakeHeader(0x003E, 1, 2), &AC_U::IsConnected, "IsConnected"},
{IPC::MakeHeader(0x0040, 1, 2), &AC_U::SetClientVersion, "SetClientVersion"},
// clang-format on
};
RegisterHandlers(functions);
}