BCAT services: Difference between revisions
News docs |
|||
Line 200: | Line 200: | ||
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]]. | On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]]. | ||
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others]. | |||
Metadata for each entry is stored and queried from an internal SQLite database. | |||
Official software uses sqlite[https://www.sqlite.org/download.html] for processing. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 223: | Line 227: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 10100 || PostLocalNews | | 10100 || [[#PostLocalNews]] | ||
|- | |- | ||
| 20100 || SetPassphrase | | 20100 || SetPassphrase | ||
Line 259: | Line 263: | ||
| 40201 || ClearSubscriptionStatusAll | | 40201 || ClearSubscriptionStatusAll | ||
|- | |- | ||
| 90100 || GetNewsDatabaseDump | | 90100 || [[#GetNewsDatabaseDump]] | ||
|} | |} | ||
=== PostLocalNews === | |||
Takes an input buffer msgpack. | |||
=== 30110 === | === 30110 === | ||
Line 270: | Line 277: | ||
=== 30210 === | === 30210 === | ||
Returns the Database version retrieved from system setting news!db_version | Returns the Database version retrieved from system setting news!db_version | ||
=== GetNewsDatabaseDump === | |||
Dumps internal SQLite file. | |||
== INewlyArrivedEventHolder == | == INewlyArrivedEventHolder == | ||
Line 278: | Line 288: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || Get | | 0 || [[#Get]] | ||
|} | |} | ||
=== Get === | |||
Returns readable event. | |||
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist. | |||
== INewsDataService == | == INewsDataService == | ||
Line 288: | Line 302: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || Open | | 0 || [[#Open]] | ||
|- | |- | ||
| 1 || OpenWithNewsRecordV1 | | 1 || [[#OpenWithNewsRecordV1]] | ||
|- | |- | ||
| 2 || Read | | 2 || [[#Read]] | ||
|- | |- | ||
| 3 || GetSize | | 3 || [[#GetSize]] | ||
|- | |- | ||
| 1001 || [6.0.0+] OpenWithNewsRecord | | 1001 || [6.0.0+] [[#OpenWithNewsRecord]] | ||
|} | |} | ||
=== Open === | |||
Takes an input string. Opens file with the output of snprintf from "news:/data/%s" with input. | |||
=== OpenWithNewsRecordV1 === | |||
Takes an input #NewsRecordV1. Opens file with the output of snprintf of "news:/data/D00000000000000000000_%s.msgpack" with news_id if user_id is empty or else of "news:/data/U%s_%s.msgpack" with user_id and news_id of input. | |||
=== Read === | |||
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]]. | |||
=== GetSize === | |||
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]]. | |||
=== OpenWithNewsRecord=== | |||
Takes an input #NewsRecord. Same behavior as [[#OpenWithNewsRecordV1]]. | |||
== INewsDatabaseService == | == INewsDatabaseService == | ||
Line 328: | Line 357: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || Get | | 0 || [[#Get]] | ||
|} | |} | ||
=== Get === | |||
Returns readable event. | |||
Event is signaled on fetch from CDN if the file already exists. | |||
== IUnknown2 == | == IUnknown2 == | ||
Line 345: | Line 378: | ||
|- | |- | ||
| 3 || | | 3 || | ||
|} | |||
= NewsDatabase = | |||
Internal SQLite database. Has a second version since 6.0.0. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Name | |||
! Type | |||
! Exists | |||
|- | |||
| news_id || TEXT || All | |||
|- | |||
| user_id || TEXT || All | |||
|- | |||
| topic_id || TEXT || All | |||
|- | |||
| application_ids || TEXT || All | |||
|- | |||
| received_at || INTEGER || All | |||
|- | |||
| published_at || INTEGER || All | |||
|- | |||
| expire_at || INTEGER || All | |||
|- | |||
| pickup_limit || INTEGER || All | |||
|- | |||
| essential_pickup_limit || INTEGER || Only V2 | |||
|- | |||
| priority || INTEGER || All | |||
|- | |||
| deletion_priority || INTEGER || All | |||
|- | |||
| age_limit || INTEGER || All | |||
|- | |||
| surprise || INTEGER || All | |||
|- | |||
| bashotorya || INTEGER || Only V1 | |||
|- | |||
| decoration_type || INTEGER || Only V2 | |||
|- | |||
| point || INTEGER || All | |||
|- | |||
| read || INTEGER || All | |||
|- | |||
| newly || INTEGER || All | |||
|- | |||
| displayed || INTEGER || All | |||
|- | |||
| opted_in || INTEGER || All | |||
|- | |||
| point_status || INTEGER || All | |||
|- | |||
| feedback || INTEGER || Only V2 | |||
|- | |||
| extra_1 || INTEGER || All | |||
|- | |||
| extra_2 || INTEGER || All | |||
|- | |||
|} | |||
= NewsRecordV1 = | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! SQLite association | |||
|- | |||
| 0x0 || 0x18 || TEXT news_id | |||
|- | |||
| 0x18 || 0x18 || TEXT user_id | |||
|- | |||
| 0x30 || 0x8 || INTEGER received_id | |||
|- | |||
| 0x38 || 0x4 || INTEGER news | |||
|- | |||
| 0x3c || 0x4 || INTEGER newly | |||
|- | |||
| 0x40 || 0x4 || INTEGER displayed | |||
|- | |||
| 0x44 || 0x4 || none | |||
|- | |||
|} | |||
= NewsRecord = | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! SQLite association | |||
|- | |||
| 0x0 || 0x18 || TEXT news_id | |||
|- | |||
| 0x18 || 0x18 || TEXT user_id | |||
|- | |||
| 0x30 || 0x20 || TEXT topic_id | |||
|- | |||
| 0x50 || 0x8 || INTEGER received_id | |||
|- | |||
| 0x58 || 0x8 || none | |||
|- | |||
| 0x60 || 0x4 || INTEGER decoration_type | |||
|- | |||
| 0x64 || 0x4 || INTEGER read | |||
|- | |||
| 0x68 || 0x4 || INTEGER newly | |||
|- | |||
| 0x6c || 0x4 || INTEGER displayed | |||
|- | |||
| 0x70 || 0x4 || INTEGER feedback | |||
|- | |||
| 0x74 || 0x4 || none | |||
|- | |||
| 0x78 || 0x4 || INTEGER extra_1 | |||
|- | |||
| 0x7c || 0x4 || INTEGER extra_2 | |||
|- | |||
|} | |} | ||