IPsmServer.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Ryujinx.Common.Logging;
  2. namespace Ryujinx.HLE.HOS.Services.Psm
  3. {
  4. [Service("psm")]
  5. class IPsmServer : IpcService
  6. {
  7. enum ChargerType
  8. {
  9. None,
  10. ChargerOrDock,
  11. UsbC
  12. }
  13. public IPsmServer(ServiceCtx context) { }
  14. [Command(0)]
  15. // GetBatteryChargePercentage() -> u32
  16. public static ResultCode GetBatteryChargePercentage(ServiceCtx context)
  17. {
  18. int chargePercentage = 100;
  19. context.ResponseData.Write(chargePercentage);
  20. Logger.PrintStub(LogClass.ServicePsm, new { chargePercentage });
  21. return ResultCode.Success;
  22. }
  23. [Command(1)]
  24. // GetChargerType() -> u32
  25. public static ResultCode GetChargerType(ServiceCtx context)
  26. {
  27. ChargerType chargerType = ChargerType.ChargerOrDock;
  28. context.ResponseData.Write((int)chargerType);
  29. Logger.PrintStub(LogClass.ServicePsm, new { chargerType });
  30. return ResultCode.Success;
  31. }
  32. [Command(7)]
  33. // OpenSession() -> IPsmSession
  34. public ResultCode OpenSession(ServiceCtx context)
  35. {
  36. MakeObject(context, new IPsmSession(context.Device.System));
  37. return ResultCode.Success;
  38. }
  39. }
  40. }