libctru  v2.4.1
news.h
Go to the documentation of this file.
1 /**
2  * @file news.h
3  * @brief NEWS (Notification) service.
4  */
5 #pragma once
6 
7 /// Notification header data.
8 typedef struct {
9  bool dataSet;
10  bool unread;
11  bool enableJPEG;
12  bool isSpotPass;
13  bool isOptedOut;
14  u8 unkData[3];
15  u64 processID;
16  u8 unkData2[8];
17  u64 jumpParam;
18  u8 unkData3[8];
19  u64 time;
20  u16 title[32];
22 
23 /// Initializes NEWS.
25 
26 /// Exits NEWS.
27 void newsExit(void);
28 
29 /**
30  * @brief Adds a notification to the home menu Notifications applet.
31  * @param title UTF-16 title of the notification.
32  * @param titleLength Number of characters in the title, not including the null-terminator.
33  * @param message UTF-16 message of the notification, or NULL for no message.
34  * @param messageLength Number of characters in the message, not including the null-terminator.
35  * @param image Data of the image to show in the notification, or NULL for no image.
36  * @param imageSize Size of the image data in bytes.
37  * @param jpeg Whether the image is a JPEG or not.
38  */
39 Result NEWS_AddNotification(const u16* title, u32 titleLength, const u16* message, u32 messageLength, const void* imageData, u32 imageSize, bool jpeg);
40 
41 /**
42  * @brief Gets current total notifications number.
43  * @param num Pointer where total number will be saved.
44  */
46 
47 /**
48  * @brief Sets a custom header for a specific notification.
49  * @param news_id Identification number of the notification.
50  * @param header Pointer to notification header to set.
51  */
53 
54 /**
55  * @brief Gets the header of a specific notification.
56  * @param news_id Identification number of the notification.
57  * @param header Pointer where header of the notification will be saved.
58  */
60 
61 /**
62  * @brief Sets a custom message for a specific notification.
63  * @param news_id Identification number of the notification.
64  * @param message Pointer to UTF-16 message to set.
65  * @param size Size of message to set.
66  */
67 Result NEWS_SetNotificationMessage(u32 news_id, const u16* message, u32 size);
68 
69 /**
70  * @brief Gets the message of a specific notification.
71  * @param news_id Identification number of the notification.
72  * @param message Pointer where UTF-16 message of the notification will be saved.
73  * @param size Pointer where size of the message data will be saved in bytes.
74  */
75 Result NEWS_GetNotificationMessage(u32 news_id, u16* message, u32* size);
76 
77 /**
78  * @brief Sets a custom image for a specific notification.
79  * @param news_id Identification number of the notification.
80  * @param buffer Pointer to MPO image to set.
81  * @param size Size of the MPO image to set.
82  */
83 Result NEWS_SetNotificationImage(u32 news_id, const void* buffer, u32 size);
84 
85 /**
86  * @brief Gets the image of a specific notification.
87  * @param news_id Identification number of the notification.
88  * @param buffer Pointer where MPO image of the notification will be saved.
89  * @param size Pointer where size of the image data will be saved in bytes.
90  */
91 Result NEWS_GetNotificationImage(u32 news_id, void* buffer, u32* size);
Result NEWS_GetTotalNotifications(u32 *num)
Gets current total notifications number.
Result NEWS_SetNotificationImage(u32 news_id, const void *buffer, u32 size)
Sets a custom image for a specific notification.
Result NEWS_AddNotification(const u16 *title, u32 titleLength, const u16 *message, u32 messageLength, const void *imageData, u32 imageSize, bool jpeg)
Adds a notification to the home menu Notifications applet.
Result NEWS_GetNotificationMessage(u32 news_id, u16 *message, u32 *size)
Gets the message of a specific notification.
Result newsInit(void)
Initializes NEWS.
Result NEWS_GetNotificationImage(u32 news_id, void *buffer, u32 *size)
Gets the image of a specific notification.
Result NEWS_GetNotificationHeader(u32 news_id, NotificationHeader *header)
Gets the header of a specific notification.
Result NEWS_SetNotificationMessage(u32 news_id, const u16 *message, u32 size)
Sets a custom message for a specific notification.
Result NEWS_SetNotificationHeader(u32 news_id, const NotificationHeader *header)
Sets a custom header for a specific notification.
void newsExit(void)
Exits NEWS.
Notification header data.
Definition: news.h:8
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
s32 Result
Function result.
Definition: types.h:42
uint16_t u16
16-bit unsigned integer
Definition: types.h:22
uint32_t u32
32-bit unsigned integer
Definition: types.h:23