libnx  v4.7.0
news.h
Go to the documentation of this file.
1 /**
2  * @file news.h
3  * @brief News service IPC wrapper.
4  * @author Behemoth
5  * @copyright libnx Authors
6  */
7 
8 #pragma once
9 
10 #include "../kernel/event.h"
11 #include "../services/acc.h"
12 #include "../sf/service.h"
13 #include "../types.h"
14 
15 typedef enum {
16  NewsServiceType_Administrator = 0, ///< Initializes news:a
17  NewsServiceType_Configuration = 1, ///< Initializes news:c
18  NewsServiceType_Manager = 2, ///< Initializes news:m
19  NewsServiceType_Post = 3, ///< Initializes news:p
20  NewsServiceType_Viewer = 4, ///< Initializes news:v
21 
22  NewsServiceType_Count
24 
25 typedef struct {
26  char name[0x20];
28 
29 typedef struct {
30  Service s;
32 
33 typedef struct {
34  Service s;
36 
37 typedef struct {
38  Service s;
40 
41 typedef struct {
42  Service s;
44 
45 typedef struct {
46  char news_id[0x18];
47  char user_id[0x18];
48  s64 received_at;
49  s32 read;
50  s32 newly;
51  s32 displayed;
52 } NewsRecordV1;
53 
54 typedef struct {
55  char news_id[0x18];
56  char user_id[0x18];
57  NewsTopicName topic_id;
58  s64 received_at;
59  s64 pad_0;
60  s32 decoration_type;
61  s32 read;
62  s32 newly;
63  s32 displayed;
64  s32 feedback;
65  s32 pad_1;
66  s32 extra_1;
67  s32 extra_2;
68 } NewsRecord;
69 
70 Result newsInitialize(NewsServiceType service_type);
71 void newsExit(void);
72 
73 Service *newsGetServiceSession(void);
74 
75 Result newsCreateNewlyArrivedEventHolder(NewsNewlyArrivedEventHolder *out);
76 Result newsCreateNewsDataService(NewsDataService *out);
77 Result newsCreateNewsDatabaseService(NewsDatabaseService *out);
79 
80 Result newsPostLocalNews(const void *news, size_t size);
81 Result newsSetPassphrase(u64 program_id, const char *passphrase);
82 Result newsGetSubscriptionStatus(const char *filter, u32 *status);
83 Result newsGetTopicList(u32 channel, u32 *out_count, NewsTopicName *out, u32 max_count); ///< [3.0.0+]
84 Result newsGetSavedataUsage(u64 *current, u64 *total); ///< [6.0.0+]
85 Result newsIsSystemUpdateRequired(bool *out);
86 Result newsGetDatabaseVersion(u32 *version); ///< [10.0.0+]
87 Result newsRequestImmediateReception(const char *filter);
88 Result newsSetSubscriptionStatus(const char *filter, u32 status);
89 Result newsClearStorage(void);
90 Result newsClearSubscriptionStatusAll(void);
91 Result newsGetNewsDatabaseDump(void *buffer, u64 size, u64 *out);
92 
93 void newsNewlyArrivedEventHolderClose(NewsNewlyArrivedEventHolder *srv);
94 Result newsNewlyArrivedEventHolderGet(NewsNewlyArrivedEventHolder *srv, Event *out);
95 
96 void newsDataClose(NewsDataService *srv);
97 Result newsDataOpen(NewsDataService *srv, const char *file_name);
98 Result newsDataOpenWithNewsRecordV1(NewsDataService *srv, NewsRecordV1 *record);
99 Result newsDataRead(NewsDataService *srv, u64 *bytes_read, u64 offset, void *out, size_t out_size);
100 Result newsDataGetSize(NewsDataService *srv, u64 *size);
102 
103 void newsDatabaseClose(NewsDatabaseService *srv);
104 Result newsDatabaseGetListV1(NewsDatabaseService *srv, NewsRecordV1 *out, u32 max_count, const char *where, const char *order, u32 *count, u32 offset);
105 Result newsDatabaseCount(NewsDatabaseService *srv, const char *filter, u32 *count);
106 Result newsDatabaseGetList(NewsDatabaseService *srv, NewsRecord *out, u32 max_count, const char *where, const char *order, u32 *count, u32 offset); ///< [6.0.0+]
107 
108 void newsOverwriteEventHolderClose(NewsOverwriteEventHolder *srv);
109 Result newsOverwriteEventHolderGet(NewsOverwriteEventHolder *srv, Event *out);
Result newsGetDatabaseVersion(u32 *version)
[10.0.0+]
Result newsGetTopicList(u32 channel, u32 *out_count, NewsTopicName *out, u32 max_count)
[3.0.0+]
Result newsGetSavedataUsage(u64 *current, u64 *total)
[6.0.0+]
Result newsDatabaseGetList(NewsDatabaseService *srv, NewsRecord *out, u32 max_count, const char *where, const char *order, u32 *count, u32 offset)
[6.0.0+]
NewsServiceType
Definition: news.h:15
@ NewsServiceType_Viewer
Initializes news:v.
Definition: news.h:20
@ NewsServiceType_Manager
Initializes news:m.
Definition: news.h:18
@ NewsServiceType_Configuration
Initializes news:c.
Definition: news.h:17
@ NewsServiceType_Post
Initializes news:p.
Definition: news.h:19
@ NewsServiceType_Administrator
Initializes news:a.
Definition: news.h:16
Result newsDataOpenWithNewsRecord(NewsDataService *srv, NewsRecord *record)
[6.0.0+]
Result newsCreateOverwriteEventHolder(NewsOverwriteEventHolder *out)
[2.0.0+]
Kernel-mode event structure.
Definition: event.h:13
Definition: news.h:33
Definition: news.h:37
Definition: news.h:29
Definition: news.h:41
Definition: news.h:45
Definition: news.h:54
Definition: news.h:25
Service object structure.
Definition: service.h:14
int64_t s64
64-bit signed integer.
Definition: types.h:28
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
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