notif: Use hidLaShowControllerFirmwareUpdate if needed.

This commit is contained in:
yellows8 2020-11-28 12:31:28 -05:00 committed by fincs
parent baa9dab747
commit 527b813bcf
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
2 changed files with 10 additions and 1 deletions

View File

@ -44,7 +44,7 @@ typedef struct {
/// Maximum alarms that can be registered at the same time by the host Application.
#define NOTIF_MAX_ALARMS 8
/// Initialize notif. Only available on [9.0.0+]. Note that using Alarms also requires the [9.0.0+] firmware update for controllers to be installed.
/// Initialize notif. Only available on [9.0.0+].
Result notifInitialize(NotifServiceType service_type);
/// Exit notif.
@ -116,6 +116,7 @@ Result notifAlarmSettingDisable(NotifAlarmSetting *alarm_setting, u32 day_of_wee
/**
* @brief Registers the specified AlarmSetting.
* @note See \ref NOTIF_MAX_ALARMS for the maximum alarms.
* @note When indicated by the output from \ref hidIsFirmwareUpdateNeededForNotification, this will use \ref hidLaShowControllerFirmwareUpdate.
* @param[out] alarm_setting_id AlarmSettingId
* @param[in] alarm_setting \ref NotifAlarmSetting
* @param[in] buffer Input buffer containing the ApplicationParameter. Optional, can be NULL.

View File

@ -1,6 +1,8 @@
#include <string.h>
#include "service_guard.h"
#include "services/hid.h"
#include "services/notif.h"
#include "applets/hid_la.h"
#include "runtime/hosversion.h"
@ -108,6 +110,12 @@ Result notifAlarmSettingDisable(NotifAlarmSetting *alarm_setting, u32 day_of_wee
}
Result notifRegisterAlarmSetting(u16 *alarm_setting_id, const NotifAlarmSetting *alarm_setting, const void* buffer, size_t size) {
Result rc=0;
bool flag=0;
HidLaControllerFirmwareUpdateArg arg={.enable_force_update = 1};
rc = hidIsFirmwareUpdateNeededForNotification(&flag);
if (R_SUCCEEDED(rc) && flag) hidLaShowControllerFirmwareUpdate(&arg);
serviceAssumeDomain(&g_notifSrv);
return serviceDispatchOut(&g_notifSrv, 500, *alarm_setting_id,
.buffer_attrs = {