libnx  v4.8.0
Data Structures | Macros | Enumerations | Functions
notif.h File Reference

Alarm notification (notif:*) service IPC wrapper. More...

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

Go to the source code of this file.

Data Structures

struct  NotifAlarmTime
 Data extracted from NotifWeeklyScheduleAlarmSetting::settings. This uses local-time. More...
 
struct  NotifWeeklyScheduleAlarmSetting
 WeeklyScheduleAlarmSetting. More...
 
struct  NotifAlarmSetting
 AlarmSetting. More...
 

Macros

#define NOTIF_MAX_ALARMS   8
 Maximum alarms that can be registered at the same time by the host Application.
 

Enumerations

enum  NotifServiceType {
  NotifServiceType_Application = 0 ,
  NotifServiceType_System = 1
}
 ServiceType for notifInitialize. More...
 

Functions

Result notifInitialize (NotifServiceType service_type)
 Initialize notif. Only available on [9.0.0+].
 
void notifExit (void)
 Exit notif.
 
ServicenotifGetServiceSession (void)
 Gets the Service object for the actual notif:* service session.
 
void notifAlarmSettingCreate (NotifAlarmSetting *alarm_setting)
 Creates a NotifAlarmSetting. More...
 
static void notifAlarmSettingSetIsMuted (NotifAlarmSetting *alarm_setting, bool flag)
 Sets whether the NotifAlarmSetting is muted. More...
 
static void notifAlarmSettingSetUid (NotifAlarmSetting *alarm_setting, AccountUid uid)
 Sets the AccountUid for the NotifAlarmSetting, see NotifAlarmSetting::uid. More...
 
Result notifAlarmSettingIsEnabled (NotifAlarmSetting *alarm_setting, u32 day_of_week, bool *out)
 Gets whether the schedule setting for the specified day_of_week is enabled, for the NotifAlarmSetting. More...
 
Result notifAlarmSettingGet (NotifAlarmSetting *alarm_setting, u32 day_of_week, NotifAlarmTime *out)
 Gets the schedule setting for the specified day_of_week, for the NotifAlarmSetting. More...
 
Result notifAlarmSettingEnable (NotifAlarmSetting *alarm_setting, u32 day_of_week, s32 hour, s32 minute)
 Enables the schedule setting for the specified day_of_week, for the NotifAlarmSetting. More...
 
Result notifAlarmSettingDisable (NotifAlarmSetting *alarm_setting, u32 day_of_week)
 Disables the schedule setting for the specified day_of_week, for the NotifAlarmSetting. More...
 
Result notifRegisterAlarmSetting (u16 *alarm_setting_id, const NotifAlarmSetting *alarm_setting, const void *buffer, size_t size)
 Registers the specified AlarmSetting. More...
 
Result notifUpdateAlarmSetting (const NotifAlarmSetting *alarm_setting, const void *buffer, size_t size)
 Updates the specified AlarmSetting. More...
 
Result notifListAlarmSettings (NotifAlarmSetting *alarm_settings, s32 count, s32 *total_out)
 Gets a listing of AlarmSettings. More...
 
Result notifLoadApplicationParameter (u16 alarm_setting_id, void *buffer, size_t size, u32 *actual_size)
 Loads the ApplicationParameter for the specified AlarmSetting. More...
 
Result notifDeleteAlarmSetting (u16 alarm_setting_id)
 Deletes the specified AlarmSetting. More...
 
static Result notifGetNotificationSystemEvent (Event *out_event)
 Gets an Event which is signaled when data is available with notifTryPopNotifiedApplicationParameter. More...
 
Result notifTryPopNotifiedApplicationParameter (void *buffer, u64 size, u64 *out_size)
 Uses appletTryPopFromNotificationStorageChannel then reads the data from there into the output params. More...
 

Detailed Description

Alarm notification (notif:*) service IPC wrapper.

Author
yellows8

Enumeration Type Documentation

◆ NotifServiceType

ServiceType for notifInitialize.

Enumerator
NotifServiceType_Application 

Initializes notif:a, for Application.

NotifServiceType_System 

Initializes notif:s, for System.

Function Documentation

◆ notifAlarmSettingCreate()

void notifAlarmSettingCreate ( NotifAlarmSetting alarm_setting)

Creates a NotifAlarmSetting.

Note
This clears the struct, with all schedule settings set the same as notifAlarmSettingDisable.
Parameters
[out]alarm_settingNotifAlarmSetting

◆ notifAlarmSettingDisable()

Result notifAlarmSettingDisable ( NotifAlarmSetting alarm_setting,
u32  day_of_week 
)

Disables the schedule setting for the specified day_of_week, for the NotifAlarmSetting.

Note
Schedule settings are disabled by default (notifAlarmSettingCreate).
Parameters
alarm_settingNotifAlarmSetting
[in]day_of_weekDay-of-week, must be 0-6 (Sun-Sat).

◆ notifAlarmSettingEnable()

Result notifAlarmSettingEnable ( NotifAlarmSetting alarm_setting,
u32  day_of_week,
s32  hour,
s32  minute 
)

Enables the schedule setting for the specified day_of_week, for the NotifAlarmSetting.

This uses local-time.

Parameters
alarm_settingNotifAlarmSetting
[in]day_of_weekDay-of-week, must be 0-6 (Sun-Sat).
[in]hourHour.
[in]minuteMinute.

◆ notifAlarmSettingGet()

Result notifAlarmSettingGet ( NotifAlarmSetting alarm_setting,
u32  day_of_week,
NotifAlarmTime out 
)

Gets the schedule setting for the specified day_of_week, for the NotifAlarmSetting.

Note
Should not be used if the output from notifAlarmSettingIsEnabled is false.
Parameters
alarm_settingNotifAlarmSetting
[in]day_of_weekDay-of-week, must be 0-6 (Sun-Sat).
[out]outNotifAlarmTime

◆ notifAlarmSettingIsEnabled()

Result notifAlarmSettingIsEnabled ( NotifAlarmSetting alarm_setting,
u32  day_of_week,
bool *  out 
)

Gets whether the schedule setting for the specified day_of_week is enabled, for the NotifAlarmSetting.

Parameters
alarm_settingNotifAlarmSetting
[in]day_of_weekDay-of-week, must be 0-6 (Sun-Sat).
[out]outWhether the setting is enabled.

◆ notifAlarmSettingSetIsMuted()

static void notifAlarmSettingSetIsMuted ( NotifAlarmSetting alarm_setting,
bool  flag 
)
inlinestatic

Sets whether the NotifAlarmSetting is muted.

Note
By default (notifAlarmSettingCreate) this is false.
Parameters
alarm_settingNotifAlarmSetting
[in]flagWhether the alarm is muted (true = Alarm turned off, false = on).

◆ notifAlarmSettingSetUid()

static void notifAlarmSettingSetUid ( NotifAlarmSetting alarm_setting,
AccountUid  uid 
)
inlinestatic

Sets the AccountUid for the NotifAlarmSetting, see NotifAlarmSetting::uid.

Parameters
alarm_settingNotifAlarmSetting
[in]uidAccountUid. If want to clear the uid after it was previously set, you can use an all-zero uid to reset to the default (notifAlarmSettingCreate).

◆ notifDeleteAlarmSetting()

Result notifDeleteAlarmSetting ( u16  alarm_setting_id)

Deletes the specified AlarmSetting.

Parameters
[in]alarm_setting_idAlarmSettingId

◆ notifGetNotificationSystemEvent()

static Result notifGetNotificationSystemEvent ( Event out_event)
inlinestatic

Gets an Event which is signaled when data is available with notifTryPopNotifiedApplicationParameter.

Note
This is a wrapper for appletGetNotificationStorageChannelEvent, see that for the usage requirements.
Some official apps don't use this.
The Event must be closed by the user once finished with it.
Parameters
[out]out_eventOutput Event with autoclear=false.

◆ notifListAlarmSettings()

Result notifListAlarmSettings ( NotifAlarmSetting alarm_settings,
s32  count,
s32 total_out 
)

Gets a listing of AlarmSettings.

Parameters
[out]alarm_settingsOutput NotifAlarmSetting array.
[in]countTotal entries in the alarm_settings array.
[out]total_outTotal output entries.

◆ notifLoadApplicationParameter()

Result notifLoadApplicationParameter ( u16  alarm_setting_id,
void *  buffer,
size_t  size,
u32 actual_size 
)

Loads the ApplicationParameter for the specified AlarmSetting.

Parameters
[in]alarm_setting_idAlarmSettingId
[out]bufferOutput buffer containing the ApplicationParameter.
[in]sizeOutput buffer size.
[out]actual_sizeActual output size.

◆ notifRegisterAlarmSetting()

Result notifRegisterAlarmSetting ( u16 alarm_setting_id,
const NotifAlarmSetting alarm_setting,
const void *  buffer,
size_t  size 
)

Registers the specified AlarmSetting.

Note
See NOTIF_MAX_ALARMS for the maximum alarms.
When indicated by the output from hidIsFirmwareUpdateNeededForNotification, this will use hidLaShowControllerFirmwareUpdate.
Parameters
[out]alarm_setting_idAlarmSettingId
[in]alarm_settingNotifAlarmSetting
[in]bufferInput buffer containing the ApplicationParameter. Optional, can be NULL.
[in]sizeInput buffer size, must be <=0x400. Optional, can be 0.

◆ notifTryPopNotifiedApplicationParameter()

Result notifTryPopNotifiedApplicationParameter ( void *  buffer,
u64  size,
u64 out_size 
)

Uses appletTryPopFromNotificationStorageChannel then reads the data from there into the output params.

Note
This is a wrapper for appletTryPopFromNotificationStorageChannel, see that for the usage requirements.
The system will only push data for this when launching the Application when the Alarm was triggered, where the system was previously in sleep-mode.
Some official apps don't use this.
Parameters
[out]bufferOutput buffer.
[out]sizeOutput buffer size.
[out]out_sizeSize of the data which was written into the output buffer. Optional, can be NULL.

◆ notifUpdateAlarmSetting()

Result notifUpdateAlarmSetting ( const NotifAlarmSetting alarm_setting,
const void *  buffer,
size_t  size 
)

Updates the specified AlarmSetting.

Parameters
[in]alarm_settingNotifAlarmSetting
[in]bufferInput buffer containing the ApplicationParameter. Optional, can be NULL.
[in]sizeInput buffer size, must be <=0x400. Optional, can be 0.