9 #include "../sf/service.h"
10 #include "../services/acc.h"
11 #include "../kernel/event.h"
147 } power_state_change;
152 } operation_mode_change;
336 return ((
u64)timestamp) * 60 + 946598400;
Result pdmqryInitialize(void)
Initialize pdm:qry.
PdmPlayEventType
PlayEventType.
Definition: pdm.h:14
@ PdmPlayEventType_Account
Account.
Definition: pdm.h:16
@ PdmPlayEventType_PowerStateChange
PowerStateChange.
Definition: pdm.h:17
@ PdmPlayEventType_Applet
Applet.
Definition: pdm.h:15
@ PdmPlayEventType_Initialize
Initialize. Used for the very first PlayEvent entry in the log.
Definition: pdm.h:19
@ PdmPlayEventType_OperationModeChange
OperationModeChange.
Definition: pdm.h:18
static u64 pdmPlayTimestampToPosix(u32 timestamp)
Helper function which converts a Play timestamp from the Pdm*Event structs to POSIX.
Definition: pdm.h:335
Result pdmqryQueryRecentlyPlayedApplication(AccountUid uid, bool flag, u64 *application_ids, s32 count, s32 *total_out)
Gets a list of applications played by the specified user.
Result pdmqryQueryPlayStatisticsByApplicationId(u64 application_id, bool flag, PdmPlayStatistics *stats)
Gets PdmPlayStatistics for the specified ApplicationId.
Result pdmqryQueryAccountPlayEvent(s32 entry_index, AccountUid uid, PdmAccountPlayEvent *events, s32 count, s32 *total_out)
Gets a list of PdmAccountPlayEvent.
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(u64 application_id, AccountUid uid, bool flag, PdmPlayStatistics *stats)
Gets PdmPlayStatistics for the specified ApplicationId and account userId.
Result pdmqryQueryLastPlayTime(bool flag, PdmLastPlayTime *playtimes, const u64 *application_ids, s32 count, s32 *total_out)
Gets PdmLastPlayTime for the specified applications.
Result pdmqryQueryPlayEvent(s32 entry_index, PdmPlayEvent *events, s32 count, s32 *total_out)
Gets a list of PdmPlayEvent.
Result pdmqryGetAvailablePlayEventRange(s32 *total_entries, s32 *start_entry_index, s32 *end_entry_index)
Gets range fields which can then be used with the other pdmqry funcs, except for pdmqryQueryAccountPl...
Result pdmqryQueryAppletEvent(s32 entry_index, bool flag, PdmAppletEvent *events, s32 count, s32 *total_out)
Gets a list of PdmAppletEvent.
Result pdmqryQueryAccountEvent(s32 entry_index, PdmAccountEvent *events, s32 count, s32 *total_out)
Gets a list of PdmAccountEvent.
void pdmqryExit(void)
Exit pdm:qry.
Result pdmqryGetRecentlyPlayedApplicationUpdateEvent(Event *out_event)
Gets an Event which is signaled when logging a new PdmPlayEvent which would be available via pdmqryQu...
Service * pdmqryGetServiceSession(void)
Gets the Service object for the actual pdm:qry service session.
Result pdmqryGetAvailableAccountPlayEventRange(AccountUid uid, s32 *total_entries, s32 *start_entry_index, s32 *end_entry_index)
Gets range fields which can then be used with pdmqryQueryAccountPlayEvent.
PdmPlayLogPolicy
PlayLogPolicy.
Definition: pdm.h:34
@ PdmPlayLogPolicy_All
All pdm:qry commands which require PdmPlayEventType_Applet and AppletId = Application will only retur...
Definition: pdm.h:35
@ PdmPlayLogPolicy_Unknown3
[10.0.0+] The cmds which require PdmPlayLogPolicy_All, now also allow value 3 if the cmd input flag i...
Definition: pdm.h:38
@ PdmPlayLogPolicy_LogOnly
The above commands will filter out the entry with this.
Definition: pdm.h:36
@ PdmPlayLogPolicy_None
The pdm:ntfy commands which handle PdmPlayEventType_Applet logging will immediately return 0 when the...
Definition: pdm.h:37
PdmAppletEventType
AppletEventType.
Definition: pdm.h:23
@ PdmAppletEventType_Exit5
"exit"
Definition: pdm.h:29
@ PdmAppletEventType_OutOfFocus4
"out_of_focus"
Definition: pdm.h:28
@ PdmAppletEventType_Exit6
"exit"
Definition: pdm.h:30
@ PdmAppletEventType_Launch
"launch"
Definition: pdm.h:24
@ PdmAppletEventType_Exit
"exit"
Definition: pdm.h:25
@ PdmAppletEventType_InFocus
"in_focus"
Definition: pdm.h:26
@ PdmAppletEventType_OutOfFocus
"out_of_focus"
Definition: pdm.h:27
Account UserId.
Definition: acc.h:25
Kernel-mode event structure.
Definition: event.h:13
AccountEventV10. AccountEvent for [10.0.0-15.0.1], converted to PdmAccountEvent when needed.
Definition: pdm.h:178
u8 type
See PdmPlayEvent::event_data::account::type.
Definition: pdm.h:186
u32 entry_index
Entry index.
Definition: pdm.h:181
u64 program_id
ProgramId.
Definition: pdm.h:180
u64 timestamp_steady
See PdmPlayEvent::timestamp_steady.
Definition: pdm.h:185
u64 timestamp_network
See PdmPlayEvent::timestamp_network.
Definition: pdm.h:184
AccountUid uid
AccountUid
Definition: pdm.h:179
u64 timestamp_user
See PdmPlayEvent::timestamp_user.
Definition: pdm.h:183
AccountEventV3. AccountEvent for [3.0.0-9.2.0], converted to PdmAccountEvent when needed.
Definition: pdm.h:166
AccountUid uid
AccountUid
Definition: pdm.h:167
u64 timestamp_steady
See PdmPlayEvent::timestamp_steady.
Definition: pdm.h:172
u64 timestamp_network
See PdmPlayEvent::timestamp_network.
Definition: pdm.h:171
u8 type
See PdmPlayEvent::event_data::account::type.
Definition: pdm.h:173
u32 entry_index
Entry index.
Definition: pdm.h:168
u64 timestamp_user
See PdmPlayEvent::timestamp_user.
Definition: pdm.h:170
AccountEvent. AccountEvent for [16.0.0+], converted from the older structs when needed.
Definition: pdm.h:191
u64 timestamp_network
See PdmPlayEvent::timestamp_network.
Definition: pdm.h:197
u32 entry_index
Entry index.
Definition: pdm.h:194
u8 type
See PdmPlayEvent::event_data::account::type.
Definition: pdm.h:198
u64 timestamp_user
See PdmPlayEvent::timestamp_user.
Definition: pdm.h:196
u64 program_id
[10.0.0+] ProgramId
Definition: pdm.h:193
AccountUid uid
AccountUid
Definition: pdm.h:192
AccountPlayEvent.
Definition: pdm.h:204
u64 timestamp1
POSIX timestamp.
Definition: pdm.h:209
u64 timestamp0
POSIX timestamp.
Definition: pdm.h:208
AppletEventV1.
Definition: pdm.h:44
u64 program_id
ProgramId.
Definition: pdm.h:45
u32 timestamp_user
See PdmPlayEvent::timestamp_user, with the above timestamp format.
Definition: pdm.h:47
u32 timestamp_network
See PdmPlayEvent::timestamp_network, with the above timestamp format.
Definition: pdm.h:48
u32 entry_index
Entry index.
Definition: pdm.h:46
u8 event_type
PdmAppletEventType
Definition: pdm.h:49
AppletEvent. AppletEvent for [16.0.0+], converted from PdmAppletEventV1 on [1.0.0-15....
Definition: pdm.h:54
u64 timestamp_user
See PdmPlayEvent::timestamp_user.
Definition: pdm.h:58
u8 event_type
PdmAppletEventType
Definition: pdm.h:60
u32 pad
Padding.
Definition: pdm.h:57
u64 timestamp_network
See PdmPlayEvent::timestamp_network.
Definition: pdm.h:59
u32 entry_index
Entry index.
Definition: pdm.h:56
u64 program_id
ProgramId.
Definition: pdm.h:55
ApplicationPlayStatistics.
Definition: pdm.h:213
u64 total_launches
Total times the application was launched.
Definition: pdm.h:216
u64 playtime
Total play-time in nanoseconds.
Definition: pdm.h:215
u64 application_id
ApplicationId.
Definition: pdm.h:214
LastPlayTime.
Definition: pdm.h:101
u8 flag
Flag indicating whether the above field is set.
Definition: pdm.h:106
u64 application_id
ApplicationId.
Definition: pdm.h:102
u32 timestamp_network
See PdmAppletEventV1::timestamp_network.
Definition: pdm.h:104
u32 timestamp_user
See PdmAppletEventV1::timestamp_user.
Definition: pdm.h:103
u32 last_played_minutes
Total minutes since the application was last played.
Definition: pdm.h:105
PlayEvent.
Definition: pdm.h:112
u64 timestamp_network
PosixTime timestamp from StandardNetworkSystemClock.
Definition: pdm.h:161
u32 version
Application version.
Definition: pdm.h:119
u8 play_event_type
PdmPlayEventType. Controls which struct in the above event_data is used. PdmPlayEventType_Initialize ...
Definition: pdm.h:157
u8 type
0-1 to be listed by pdmqryQueryAccountEvent, or 2 to include the above ApplicationId.
Definition: pdm.h:141
u8 log_policy
PdmPlayLogPolicy
Definition: pdm.h:133
u8 mode
Input value from pdm:ntfy cmd8, see LibAppletMode.
Definition: pdm.h:124
u8 applet_id
AppletId
Definition: pdm.h:131
u8 value
Input value from the pdm:ntfy command.
Definition: pdm.h:145
u8 event_type
PdmAppletEventType
Definition: pdm.h:134
u8 storage_id
NcmStorageId
Definition: pdm.h:132
u64 timestamp_steady
Timestamp in seconds derived from StandardSteadyClock.
Definition: pdm.h:162
u64 timestamp_user
PosixTime timestamp from StandardUserSystemClock.
Definition: pdm.h:160
u8 flag
Set to 0x1 by pdm:ntfy cmd8, indicating that the below field is set to an input param.
Definition: pdm.h:123
PlayStatisticsV1. PlayStatistics for [1.0.0-15.0.1], converted to PdmPlayStatistics when needed.
Definition: pdm.h:65
u32 first_timestamp_network
See PdmAppletEventV1::timestamp_network. This is for the first time the program was played.
Definition: pdm.h:70
u64 program_id
ProgramId.
Definition: pdm.h:66
u32 first_entry_index
Entry index for the first time the program was played.
Definition: pdm.h:68
u32 total_launches
Total times the program was launched.
Definition: pdm.h:77
u32 last_timestamp_user
See PdmAppletEventV1::timestamp_user. This is for the last time the program was played.
Definition: pdm.h:73
u32 last_timestamp_network
See PdmAppletEventV1::timestamp_network. This is for the last time the program was played.
Definition: pdm.h:74
u32 last_entry_index
Entry index for the last time the program was played.
Definition: pdm.h:72
u32 playtime_minutes
Total play-time in minutes.
Definition: pdm.h:76
u32 first_timestamp_user
See PdmAppletEventV1::timestamp_user. This is for the first time the program was played.
Definition: pdm.h:69
PlayStatistics. PlayStatistics for [16.0.0+], converted from PdmPlayStatisticsV1 on [1....
Definition: pdm.h:81
u32 last_entry_index
Entry index for the last time the program was played.
Definition: pdm.h:89
u64 last_timestamp_user
See PdmAppletEvent::timestamp_user. This is for the last time the program was played,...
Definition: pdm.h:91
u32 total_launches
Total times the program was launched.
Definition: pdm.h:95
u64 playtime
Total play-time in nanoseconds.
Definition: pdm.h:94
u32 pad
Padding.
Definition: pdm.h:85
u32 first_entry_index
Entry index for the first time the program was played.
Definition: pdm.h:84
u64 first_timestamp_network
See PdmAppletEvent::timestamp_network. This is for the first time the program was played,...
Definition: pdm.h:87
u32 pad2
Padding.
Definition: pdm.h:90
u32 pad3
Padding.
Definition: pdm.h:96
u64 program_id
ProgramId.
Definition: pdm.h:82
u64 last_timestamp_network
See PdmAppletEvent::timestamp_network. This is for the last time the program was played,...
Definition: pdm.h:92
u64 first_timestamp_user
See PdmAppletEvent::timestamp_user. This is for the first time the program was played,...
Definition: pdm.h:86
Service object structure.
Definition: service.h:14
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21