summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/ptm/psm.cpp41
-rw-r--r--src/core/hle/service/ptm/psm.h10
2 files changed, 27 insertions, 24 deletions
diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp
index a8e3813c8..c2d5fda94 100644
--- a/src/core/hle/service/ptm/psm.cpp
+++ b/src/core/hle/service/ptm/psm.cpp
@@ -12,13 +12,16 @@
12 12
13namespace Service::PSM { 13namespace Service::PSM {
14 14
15constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full 15constexpr u32 BATTERY_FULLY_CHARGED = 100; // 100% Full
16constexpr u32 BATTERY_CURRENTLY_CHARGING = 1; // Plugged into an official dock
16 17
17PSM::PSM() : ServiceFramework{"psm"} { 18class PSM final : public ServiceFramework<PSM> {
18 // clang-format off 19public:
20 explicit PSM() : ServiceFramework{"psm"} {
21 // clang-format off
19 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
20 {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"}, 23 {0, &PSM::GetBatteryChargePercentage, "GetBatteryChargePercentage"},
21 {1, nullptr, "GetChargerType"}, 24 {1, &PSM::GetChargerType, "GetChargerType"},
22 {2, nullptr, "EnableBatteryCharging"}, 25 {2, nullptr, "EnableBatteryCharging"},
23 {3, nullptr, "DisableBatteryCharging"}, 26 {3, nullptr, "DisableBatteryCharging"},
24 {4, nullptr, "IsBatteryChargingEnabled"}, 27 {4, nullptr, "IsBatteryChargingEnabled"},
@@ -36,20 +39,30 @@ PSM::PSM() : ServiceFramework{"psm"} {
36 {16, nullptr, "GetBatteryChargeInfoEvent"}, 39 {16, nullptr, "GetBatteryChargeInfoEvent"},
37 {17, nullptr, "GetBatteryChargeInfoFields"}, 40 {17, nullptr, "GetBatteryChargeInfoFields"},
38 }; 41 };
39 // clang-format on 42 // clang-format on
40 43
41 RegisterHandlers(functions); 44 RegisterHandlers(functions);
42} 45 }
43 46
44PSM::~PSM() = default; 47 ~PSM() override = default;
45 48
46void PSM::GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) { 49private:
47 LOG_WARNING(Service_PSM, "(STUBBED) called"); 50 void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx) {
51 LOG_WARNING(Service_PSM, "(STUBBED) called");
48 52
49 IPC::ResponseBuilder rb{ctx, 3}; 53 IPC::ResponseBuilder rb{ctx, 3};
50 rb.Push(RESULT_SUCCESS); 54 rb.Push(RESULT_SUCCESS);
51 rb.Push<u32>(BATTERY_FULLY_CHARGED); 55 rb.Push<u32>(BATTERY_FULLY_CHARGED);
52} 56 }
57
58 void GetChargerType(Kernel::HLERequestContext& ctx) {
59 LOG_WARNING(Service_PSM, "(STUBBED) called");
60
61 IPC::ResponseBuilder rb{ctx, 3};
62 rb.Push(RESULT_SUCCESS);
63 rb.Push<u32>(BATTERY_CURRENTLY_CHARGING);
64 }
65};
53 66
54void InstallInterfaces(SM::ServiceManager& sm) { 67void InstallInterfaces(SM::ServiceManager& sm) {
55 std::make_shared<PSM>()->InstallAsService(sm); 68 std::make_shared<PSM>()->InstallAsService(sm);
diff --git a/src/core/hle/service/ptm/psm.h b/src/core/hle/service/ptm/psm.h
index 113878bb7..a286793ae 100644
--- a/src/core/hle/service/ptm/psm.h
+++ b/src/core/hle/service/ptm/psm.h
@@ -3,7 +3,6 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#pragma once 5#pragma once
6#include "core/hle/service/service.h"
7 6
8namespace Service::SM { 7namespace Service::SM {
9class ServiceManager; 8class ServiceManager;
@@ -11,15 +10,6 @@ class ServiceManager;
11 10
12namespace Service::PSM { 11namespace Service::PSM {
13 12
14class PSM final : public ServiceFramework<PSM> {
15public:
16 explicit PSM();
17 ~PSM() override;
18
19private:
20 void GetBatteryChargePercentage(Kernel::HLERequestContext& ctx);
21};
22
23void InstallInterfaces(SM::ServiceManager& sm); 13void InstallInterfaces(SM::ServiceManager& sm);
24 14
25} // namespace Service::PSM 15} // namespace Service::PSM