libnx  v4.6.0
Data Structures | Enumerations | Functions
pdm.h File Reference

PDM (pdm:*) service IPC wrapper. More...

#include "../types.h"
#include "../sf/service.h"
#include "../services/acc.h"
#include "../kernel/event.h"

Go to the source code of this file.

Data Structures

struct  PdmAppletEventV1
 AppletEventV1. More...
 
struct  PdmAppletEvent
 AppletEvent. AppletEvent for [16.0.0+], converted from PdmAppletEventV1 on [1.0.0-15.0.1]. More...
 
struct  PdmPlayStatisticsV1
 PlayStatisticsV1. PlayStatistics for [1.0.0-15.0.1], converted to PdmPlayStatistics when needed. More...
 
struct  PdmPlayStatistics
 PlayStatistics. PlayStatistics for [16.0.0+], converted from PdmPlayStatisticsV1 on [1.0.0-15.0.1]. More...
 
struct  PdmLastPlayTime
 LastPlayTime. More...
 
struct  PdmPlayEvent
 PlayEvent. More...
 
struct  PdmAccountEventV3
 AccountEventV3. AccountEvent for [3.0.0-9.2.0], converted to PdmAccountEvent when needed. More...
 
struct  PdmAccountEventV10
 AccountEventV10. AccountEvent for [10.0.0-15.0.1], converted to PdmAccountEvent when needed. More...
 
struct  PdmAccountEvent
 AccountEvent. AccountEvent for [16.0.0+], converted from the older structs when needed. More...
 
struct  PdmAccountPlayEvent
 AccountPlayEvent. More...
 
struct  PdmApplicationPlayStatistics
 ApplicationPlayStatistics. More...
 

Enumerations

enum  PdmPlayEventType {
  PdmPlayEventType_Applet = 0 ,
  PdmPlayEventType_Account = 1 ,
  PdmPlayEventType_PowerStateChange = 2 ,
  PdmPlayEventType_OperationModeChange = 3 ,
  PdmPlayEventType_Initialize = 4
}
 PlayEventType. More...
 
enum  PdmAppletEventType {
  PdmAppletEventType_Launch = 0 ,
  PdmAppletEventType_Exit = 1 ,
  PdmAppletEventType_InFocus = 2 ,
  PdmAppletEventType_OutOfFocus = 3 ,
  PdmAppletEventType_OutOfFocus4 = 4 ,
  PdmAppletEventType_Exit5 = 5 ,
  PdmAppletEventType_Exit6 = 6
}
 AppletEventType. More...
 
enum  PdmPlayLogPolicy {
  PdmPlayLogPolicy_All = 0 ,
  PdmPlayLogPolicy_LogOnly = 1 ,
  PdmPlayLogPolicy_None = 2 ,
  PdmPlayLogPolicy_Unknown3 = 3
}
 PlayLogPolicy. More...
 

Functions

Result pdmqryInitialize (void)
 Initialize pdm:qry.
 
void pdmqryExit (void)
 Exit pdm:qry.
 
ServicepdmqryGetServiceSession (void)
 Gets the Service object for the actual pdm:qry service session.
 
Result pdmqryQueryAppletEvent (s32 entry_index, bool flag, PdmAppletEvent *events, s32 count, s32 *total_out)
 Gets a list of PdmAppletEvent. More...
 
Result pdmqryQueryPlayStatisticsByApplicationId (u64 application_id, bool flag, PdmPlayStatistics *stats)
 Gets PdmPlayStatistics for the specified ApplicationId. More...
 
Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId (u64 application_id, AccountUid uid, bool flag, PdmPlayStatistics *stats)
 Gets PdmPlayStatistics for the specified ApplicationId and account userId. More...
 
Result pdmqryQueryLastPlayTime (bool flag, PdmLastPlayTime *playtimes, const u64 *application_ids, s32 count, s32 *total_out)
 Gets PdmLastPlayTime for the specified applications. More...
 
Result pdmqryQueryPlayEvent (s32 entry_index, PdmPlayEvent *events, s32 count, s32 *total_out)
 Gets a list of PdmPlayEvent. More...
 
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 pdmqryQueryAccountPlayEvent. More...
 
Result pdmqryQueryAccountEvent (s32 entry_index, PdmAccountEvent *events, s32 count, s32 *total_out)
 Gets a list of PdmAccountEvent. More...
 
Result pdmqryQueryAccountPlayEvent (s32 entry_index, AccountUid uid, PdmAccountPlayEvent *events, s32 count, s32 *total_out)
 Gets a list of PdmAccountPlayEvent. More...
 
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. More...
 
Result pdmqryQueryRecentlyPlayedApplication (AccountUid uid, bool flag, u64 *application_ids, s32 count, s32 *total_out)
 Gets a list of applications played by the specified user. More...
 
Result pdmqryGetRecentlyPlayedApplicationUpdateEvent (Event *out_event)
 Gets an Event which is signaled when logging a new PdmPlayEvent which would be available via pdmqryQueryAccountEvent, where PdmPlayEvent::event_data::account::type is 0. More...
 
static u64 pdmPlayTimestampToPosix (u32 timestamp)
 Helper function which converts a Play timestamp from the Pdm*Event structs to POSIX. More...
 

Detailed Description

PDM (pdm:*) service IPC wrapper.

Author
yellows8

Enumeration Type Documentation

◆ PdmAppletEventType

AppletEventType.

Enumerator
PdmAppletEventType_Launch 

"launch"

PdmAppletEventType_Exit 

"exit"

PdmAppletEventType_InFocus 

"in_focus"

PdmAppletEventType_OutOfFocus 

"out_of_focus"

PdmAppletEventType_OutOfFocus4 

"out_of_focus"

PdmAppletEventType_Exit5 

"exit"

PdmAppletEventType_Exit6 

"exit"

◆ PdmPlayEventType

PlayEventType.

Enumerator
PdmPlayEventType_Applet 

Applet.

PdmPlayEventType_Account 

Account.

PdmPlayEventType_PowerStateChange 

PowerStateChange.

PdmPlayEventType_OperationModeChange 

OperationModeChange.

PdmPlayEventType_Initialize 

Initialize. Used for the very first PlayEvent entry in the log.

◆ PdmPlayLogPolicy

PlayLogPolicy.

Enumerator
PdmPlayLogPolicy_All 

All pdm:qry commands which require PdmPlayEventType_Applet and AppletId = Application will only return the entry when PlayLogPolicy matches this value.

PdmPlayLogPolicy_LogOnly 

The above commands will filter out the entry with this.

PdmPlayLogPolicy_None 

The pdm:ntfy commands which handle PdmPlayEventType_Applet logging will immediately return 0 when the input param matches this value.

PdmPlayLogPolicy_Unknown3 

[10.0.0+] The cmds which require PdmPlayLogPolicy_All, now also allow value 3 if the cmd input flag is set.

Function Documentation

◆ pdmPlayTimestampToPosix()

static u64 pdmPlayTimestampToPosix ( u32  timestamp)
inlinestatic

Helper function which converts a Play timestamp from the Pdm*Event structs to POSIX.

Parameters
[in]timestampInput timestamp.

◆ pdmqryGetAvailableAccountPlayEventRange()

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.

Parameters
[in]uidAccountUid
[out]total_entriesTotal entries.
[out]start_entry_indexStart entry index.
[out]end_entry_indexEnd entry index.

◆ pdmqryGetAvailablePlayEventRange()

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 pdmqryQueryAccountPlayEvent.

Parameters
[out]total_entriesTotal entries.
[out]start_entry_indexStart entry index.
[out]end_entry_indexEnd entry index.

◆ pdmqryGetRecentlyPlayedApplicationUpdateEvent()

Result pdmqryGetRecentlyPlayedApplicationUpdateEvent ( Event out_event)

Gets an Event which is signaled when logging a new PdmPlayEvent which would be available via pdmqryQueryAccountEvent, where PdmPlayEvent::event_data::account::type is 0.

Note
Only available with [6.0.0-14.1.2].
The Event must be closed by the user once finished with it.
Parameters
[out]out_eventOutput Event with autoclear=false.

◆ pdmqryQueryAccountEvent()

Result pdmqryQueryAccountEvent ( s32  entry_index,
PdmAccountEvent events,
s32  count,
s32 total_out 
)

Gets a list of PdmAccountEvent.

Note
Only available with [3.0.0+].
Parameters
[in]entry_indexStart entry index.
[out]eventsOutput PdmAccountEvent array.
[in]countMax entries in the output array.
[out]total_outTotal output entries.

◆ pdmqryQueryAccountPlayEvent()

Result pdmqryQueryAccountPlayEvent ( s32  entry_index,
AccountUid  uid,
PdmAccountPlayEvent events,
s32  count,
s32 total_out 
)

Gets a list of PdmAccountPlayEvent.

Note
Only available with [4.0.0+].
Parameters
[in]entry_indexStart entry index.
[in]uidAccountUid
[out]eventsOutput PdmAccountPlayEvent array.
[in]countMax entries in the output array.
[out]total_outTotal output entries.

◆ pdmqryQueryAppletEvent()

Result pdmqryQueryAppletEvent ( s32  entry_index,
bool  flag,
PdmAppletEvent events,
s32  count,
s32 total_out 
)

Gets a list of PdmAppletEvent.

Parameters
[in]entry_indexStart entry index.
[in]flag[10.0.0+] Whether to additionally allow using entries with PdmPlayLogPolicy_Unknown3.
[out]eventsOutput PdmAppletEvent array.
[in]countMax entries in the output array.
[out]total_outTotal output entries.

◆ pdmqryQueryLastPlayTime()

Result pdmqryQueryLastPlayTime ( bool  flag,
PdmLastPlayTime playtimes,
const u64 application_ids,
s32  count,
s32 total_out 
)

Gets PdmLastPlayTime for the specified applications.

Parameters
[in]flag[10.0.0+] Whether to additionally allow using entries with PdmPlayLogPolicy_Unknown3.
[out]playtimesOutput PdmLastPlayTime array.
[in]application_idsInput ApplicationIds array.
[in]countTotal entries in the input/output arrays.
[out]total_outTotal output entries.

◆ pdmqryQueryPlayEvent()

Result pdmqryQueryPlayEvent ( s32  entry_index,
PdmPlayEvent events,
s32  count,
s32 total_out 
)

Gets a list of PdmPlayEvent.

Parameters
[in]entry_indexStart entry index.
[out]eventsOutput PdmPlayEvent array.
[in]countMax entries in the output array.
[out]total_outTotal output entries.

◆ pdmqryQueryPlayStatisticsByApplicationId()

Result pdmqryQueryPlayStatisticsByApplicationId ( u64  application_id,
bool  flag,
PdmPlayStatistics stats 
)

Gets PdmPlayStatistics for the specified ApplicationId.

Parameters
[in]application_idApplicationId
[in]flag[10.0.0+] Whether to additionally allow using entries with PdmPlayLogPolicy_Unknown3.
[out]statsPdmPlayStatistics

◆ pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId()

Result pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId ( u64  application_id,
AccountUid  uid,
bool  flag,
PdmPlayStatistics stats 
)

Gets PdmPlayStatistics for the specified ApplicationId and account userId.

Parameters
[in]application_idApplicationId
[in]uidAccountUid
[in]flag[10.0.0+] Whether to additionally allow using entries with PdmPlayLogPolicy_Unknown3.
[out]statsPdmPlayStatistics

◆ pdmqryQueryRecentlyPlayedApplication()

Result pdmqryQueryRecentlyPlayedApplication ( AccountUid  uid,
bool  flag,
u64 application_ids,
s32  count,
s32 total_out 
)

Gets a list of applications played by the specified user.

Note
Only available with [6.0.0-14.1.2].
Parameters
[in]uidAccountUid
[in]flag[10.0.0+] Whether to additionally allow using entries with PdmPlayLogPolicy_Unknown3.
[out]application_idsOutput ApplicationIds array.
[in]countMax entries in the output array.
[out]total_outTotal output entries.