2018-10-20 23:01:22 -07:00
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
|
|
2019-09-18 17:45:11 -07:00
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Ptm.Psm
|
2018-10-20 23:01:22 -07:00
|
|
|
|
{
|
2019-07-10 08:59:54 -07:00
|
|
|
|
[Service("psm")]
|
2018-10-20 23:01:22 -07:00
|
|
|
|
class IPsmServer : IpcService
|
|
|
|
|
{
|
2019-07-11 18:13:43 -07:00
|
|
|
|
public IPsmServer(ServiceCtx context) { }
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2021-04-13 15:01:24 -07:00
|
|
|
|
[CommandHipc(0)]
|
2018-10-20 23:01:22 -07:00
|
|
|
|
// GetBatteryChargePercentage() -> u32
|
2019-07-14 12:04:38 -07:00
|
|
|
|
public static ResultCode GetBatteryChargePercentage(ServiceCtx context)
|
2018-10-20 23:01:22 -07:00
|
|
|
|
{
|
2018-12-06 03:16:24 -08:00
|
|
|
|
int chargePercentage = 100;
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2018-12-06 03:16:24 -08:00
|
|
|
|
context.ResponseData.Write(chargePercentage);
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2020-08-03 16:32:53 -07:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServicePsm, new { chargePercentage });
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2019-07-14 12:04:38 -07:00
|
|
|
|
return ResultCode.Success;
|
2018-10-20 23:01:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:01:24 -07:00
|
|
|
|
[CommandHipc(1)]
|
2018-10-20 23:01:22 -07:00
|
|
|
|
// GetChargerType() -> u32
|
2019-07-14 12:04:38 -07:00
|
|
|
|
public static ResultCode GetChargerType(ServiceCtx context)
|
2018-10-20 23:01:22 -07:00
|
|
|
|
{
|
2019-01-10 16:11:46 -08:00
|
|
|
|
ChargerType chargerType = ChargerType.ChargerOrDock;
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2019-01-10 16:11:46 -08:00
|
|
|
|
context.ResponseData.Write((int)chargerType);
|
|
|
|
|
|
2020-08-03 16:32:53 -07:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServicePsm, new { chargerType });
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2019-07-14 12:04:38 -07:00
|
|
|
|
return ResultCode.Success;
|
2018-10-20 23:01:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:01:24 -07:00
|
|
|
|
[CommandHipc(7)]
|
2018-10-20 23:01:22 -07:00
|
|
|
|
// OpenSession() -> IPsmSession
|
2019-07-14 12:04:38 -07:00
|
|
|
|
public ResultCode OpenSession(ServiceCtx context)
|
2018-10-20 23:01:22 -07:00
|
|
|
|
{
|
2018-12-06 03:16:24 -08:00
|
|
|
|
MakeObject(context, new IPsmSession(context.Device.System));
|
2018-10-20 23:01:22 -07:00
|
|
|
|
|
2019-07-14 12:04:38 -07:00
|
|
|
|
return ResultCode.Success;
|
2018-10-20 23:01:22 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|