nn::cec::CTR::MessageBox Classclass MessageBox
This class is used to access CEC MessageBox objects.
This allows you to create and delete boxes, write and load messages, get box information, and so forth. By creating a box with the CreateMessageBox function and then opening it with the OpenMessageBox function, you can access the messages in that box. You can use the WriteMessage function to write messages to a box. Messages written to the outbox are sent. Received messages are stored in the inbox and can be read with the ReadMessage function.
Call the CloseMessageBox function when you have finished accessing the box. Changes are committed when you call the CloseMessageBox/CommitMessageBox pair. If the program is ended before changes are committed, all changes up to that point are reverted. Changes may also be reverted due to system operations, even when communication control returns to the system, such as when transitioning to Sleep Mode/Home Menu.
Treat the interval from Open/Create to Close as a single unit of processing and block entry to Sleep Mode/Home Menu during that time.
When a message is created and written, a MessageId is given to the message. The MessageId is a randomly generated unique value, and each message is accessed using this value as the key.
Use the GetMessageXXX functions to get various information, such as the attributes of individual messages. Because the GetMessageXXX functions retrieve information from the message list stored in the system, they can get information faster than the message itself can be accessed with ReadMessage. This information is read from the system when the OpenMessageBox function is called. It is possible that the message list stored in the system and the information in the messages themselves may become unsynchronized due to an unexpected power outage or other interruption. (For example, you may be able to get the message ID but ReadMessage may fail.) The message list is regenerated when a message is written with WriteMessage, but if processing enters an irrecoverable state, delete it using DeleteAllMessages and then DeleteMessageBox.
Do not adopt implementations that periodically call the OpenMessageBox and CloseMessageBox functions to check the arrival of messages in real time. Because communication stops whenever the OpenMessageBox function is called, send and receive processes cannot be executed in the background. Use the GetCecEvent and GetCecInfoBuffer functions to find out if there has been communication.
The EULA version to which the user has agreed is checked when a message is written by the WriteMessage function.
You must initialize the FS library before calling this function because the check uses FS library features.
| Create/Delete a Message Box | ||
|---|---|---|
CreateMessageBox
|
Creates a MessageBox. An inbox and outbox are created within the message box. Any message set in the outbox is automatically sent during StreetPass communication, and any received data is stored in the inbox. |
|
DeleteMessageBox
|
Deletes a MessageBox. |
|
OpenMessageBox
|
Opens a MessageBox. You must use this function to open a box before you can access the messages within it. |
|
CloseMessageBox
|
Closes the MessageBox. This function is called when you have finished accessing the box. |
|
IsOpened
|
Gets whether a MessageBox is already opened. |
|
| Message Operations | ||
ReadMessage
|
Reads a message. | |
WriteMessage
|
Writes a message to the system save region. | |
DeleteMessage
|
Deletes a message. | |
DeleteAllMessages
|
Deletes all messages in the box. | |
CommitMessageBox
|
Commits the data written in the system save region. | |
| Controlling Boxes and Getting Information | ||
GetMessageBoxData
|
Gets the data associated with a MessageBox. |
|
GetMessageBoxDataSize
|
Gets the data size associated with a MessageBox. |
|
SetMessageBoxData
|
Sets the data associated with a MessageBox. |
|
SetMessageBoxName
|
Sets a MessageBox's name. |
|
SetMessageBoxIcon
|
Sets a MessageBox's icon. |
|
GetMessageBoxName
|
Gets a MessageBox's name. |
|
GetMessageBoxIcon
|
Gets a MessageBox's icon. |
|
| Getting Message Box Information | ||
GetBoxSizeMax
|
Gets the capacity of the inbox or outbox. | |
GetBoxSize
|
Gets the used capacity of the inbox or outbox. | |
GetBoxMessageNumMax
|
Gets the maximum number of messages in the inbox or outbox. | |
GetBoxMessageNum
|
Gets the number of messages in the inbox or outbox. | |
GetBoxGroupNumMax
|
Gets the maximum number of message groups in the inbox or outbox. | |
GetBoxGroupNum
|
Gets the number of message groups in the inbox or outbox. | |
SetBoxGroupNumMax
|
Specifies the maximum number of message groups in the inbox or outbox. | |
GetBoxSessionNum
|
Gets the Session ID count for (the number of items received in) the inbox. | |
| Getting Message Information (old API) | ||
GetInBoxMessIdByIndex
|
Gets the message ID of the nth message in the inbox. |
|
GetOutBoxMessIdByIndex
|
Gets the message ID of the nth message in the outbox. |
|
GetMessSizeByMessId
|
Gets the size of the message with the specified message ID. | |
| Getting Message Information | ||
GetMessageSize
|
Gets the size of a message. | |
GetMessageBodySize
|
Gets the size of a message's body. | |
GetMessageGroupId
|
Gets the group ID of a message. | |
GetMessageSessionId
|
Gets an inbox message's session ID. (The ID assigned when received.) | |
GetMessageTypeFlag
|
Gets the MessageTypeFlag of a box message. |
|
GetMessageSendMode
|
Gets the SendMode of a message. |
|
GetMessageSendCount
|
Gets the send count of a message. | |
GetMessagePropagationCount
|
Gets the propagation count of a message. | |
GetMessageTag
|
Gets the message tag of a message. | |
GetMessageSendDate
|
Gets the timestamp of when a received message was sent. | |
GetMessageRecvDate
|
Gets the timestamp of when a message was received. | |
GetMessageCreateDate
|
Gets the timestamp of when a message was created. | |
GetMessageIdPair
|
Gets the ID of the exchanged message forming a pair with this one. | |
GetMessageId
|
Gets the MessageID of a message. |
|
GetMessageIndex
|
Gets a message's index (messIndex) based on its MessageID. |
|
| Other | ||
SetBoxActivate
|
Specifies whether a MessageBox is enabled or disabled. A disabled message box will not have any data sent or received. |
|
GetBoxActivate
|
Gets whether a MessageBox is enabled or disabled. A disabled message box will not have any data sent or received. |
|
| GetMessHeader | Gets the message header. | |
RoundOutBoxIndex
|
Moves the message with the specified message ID to the end of the outbox's outgoing message queue. (The message ID order is automatically changed when a message is sent, so there is normally no need to call this function.) | |
GetBoxMessNumMax to GetBoxMessageNumMax; GetBoxMessNum to GetBoxMessageNum; GetMessageMessSize to GetMessageSize; GetMessageMessTypeFlag to GetMessageTypeFlag; GetMessageMessIdPairto GetMessageIdPair; GetMessageMessId to GetMessageId; GetMessIndex to GetMessageIndexOpenMessageBox, ReadMessage, and WriteMessage.CONFIDENTIAL