mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-25 19:02:45 -06:00
ts: add OpenSession
This commit is contained in:
parent
2e760a9833
commit
2b85e9e997
2 changed files with 40 additions and 6 deletions
|
@ -9,6 +9,35 @@
|
||||||
|
|
||||||
namespace Service::PTM {
|
namespace Service::PTM {
|
||||||
|
|
||||||
|
enum class Location : u8 {
|
||||||
|
Internal,
|
||||||
|
External,
|
||||||
|
};
|
||||||
|
|
||||||
|
class ISession : public ServiceFramework<ISession> {
|
||||||
|
public:
|
||||||
|
explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, nullptr, "GetTemperatureRange"},
|
||||||
|
{2, nullptr, "SetMeasurementMode"},
|
||||||
|
{4, &ISession::GetTemperature, "GetTemperature"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void GetTemperature(HLERequestContext& ctx) {
|
||||||
|
constexpr f32 temperature = 35;
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push(temperature);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} {
|
TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
|
@ -16,7 +45,7 @@ TS::TS(Core::System& system_) : ServiceFramework{system_, "ts"} {
|
||||||
{1, &TS::GetTemperature, "GetTemperature"},
|
{1, &TS::GetTemperature, "GetTemperature"},
|
||||||
{2, nullptr, "SetMeasurementMode"},
|
{2, nullptr, "SetMeasurementMode"},
|
||||||
{3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"},
|
{3, &TS::GetTemperatureMilliC, "GetTemperatureMilliC"},
|
||||||
{4, nullptr, "OpenSession"},
|
{4, &TS::OpenSession, "OpenSession"},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
@ -47,4 +76,13 @@ void TS::GetTemperatureMilliC(HLERequestContext& ctx) {
|
||||||
rb.Push(temperature);
|
rb.Push(temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TS::OpenSession(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
[[maybe_unused]] const u32 device_code = rp.Pop<u32>();
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushIpcInterface<ISession>(system);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Service::PTM
|
} // namespace Service::PTM
|
||||||
|
|
|
@ -14,13 +14,9 @@ public:
|
||||||
~TS() override;
|
~TS() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Location : u8 {
|
|
||||||
Internal,
|
|
||||||
External,
|
|
||||||
};
|
|
||||||
|
|
||||||
void GetTemperature(HLERequestContext& ctx);
|
void GetTemperature(HLERequestContext& ctx);
|
||||||
void GetTemperatureMilliC(HLERequestContext& ctx);
|
void GetTemperatureMilliC(HLERequestContext& ctx);
|
||||||
|
void OpenSession(HLERequestContext& ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::PTM
|
} // namespace Service::PTM
|
||||||
|
|
Loading…
Reference in a new issue