nn::cec::CTR::MessageBox::CreateMessageBox Member Functionnn::Result CreateMessageBox( const TitleId cecTitleId, const u32 privateId, const char * hmacKey, void * icon, size_t iconSize, wchar_t * name, size_t nameSize, size_t inboxSizeMax = CEC_INBOX_SIZE_DEFAULT, size_t outboxSizeMax = CEC_OUTBOX_SIZE_DEFAULT, size_t inboxMessNumMax = CEC_INBOX_MESSNUM_DEFAULT, size_t outboxMessNumMax = CEC_OUTBOX_MESSNUM_DEFAULT, size_t messageSizeMax = CEC_MESSSIZEMAX_DEFAULT );
| Name | Description | |
|---|---|---|
| in | cecTitleId | A 32-bit StreetPass ID. Can be generated with MakeCecTitleId. |
| in | privateId | The key needed to open a message box.→ OpenMessageBoxThe value used must be stored by the application accessing the message box. |
| in | hmacKey | Specifies the key needed to read a Message. Specify a string of 32 characters.This must be a secret key shared with the communication partner. This value is used to check if the transmitted data has been tampered with. Transmitted data is signed with a signature generated using this key. Use a value stored by the application. |
| in | icon | Specifies an icon. Format: RGB565 (little-endian). Size: 48x48 (4.5 KB). |
| in | iconSize | Specifies the size of the icon data. |
| in | name | Specifies an application name. Encoding: UTF16-LE. Display size: Equivalent of the width of 17 full-width characters. Maximum buffer size: 64 x 2 bytes (including the NULL terminator). |
| in | nameSize | Specifies the size of the application name. |
| in | inboxSizeMax | Specifies the maximum amount of data that can be saved in the inbox. The combined size of the inbox and outbox must be no more than 1 MB. The default size is 512 * 1024 bytes. |
| in | outboxSizeMax | Specifies the maximum amount of data that can be saved in the outbox. The combined size of the inbox and outbox must be no more than 1 MB. The default size is 512 * 1024 bytes. |
| in | inboxMessNumMax | Specifies the maximum number of messages that can be saved in the inbox. The default is 99, which is the maximum specifiable value. |
| in | outboxMessNumMax | Specifies the maximum number of messages that can be saved in the outbox. The default is 99, which is the maximum specifiable value. |
| in | messageSizeMax | Specifies the maximum size of a message. Messages that exceed this size cannot be saved. Attempting to do so causes an error when calling WriteMessage. |
nn::Result| Value | Description |
|---|---|
ResultSuccess |
Process succeeded. |
ResultBoxAlreadyExists |
Could not create box, because box already exists. If this error is returned when the current status is OpenMessageBox == nn::cec::ResultNoData(), it might have been caused by an already-existing box with a different lower 8 bits of its CecTitleId.→ MakeCecTitleId, OpenMessageBox |
ResultBoxNumFull |
The maximum number of boxes have been created. To create a new box, you must delete a box for another game title. |
ResultInvalidArgument |
An argument was specified incorrectly. |
ResultInvalidData |
There is a problem with the data, icon, or name being set. |
ResultTooLarge |
There is a problem with the size of data being set. |
ResultStateBusy |
Unable to access because the daemon is busy (BUSY state). This may succeed if you wait some time before accessing again. |
| A value other than the above. | Operation failed. |
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.
MessageBox objects are created in NAND memory. Only one box may be created for each application. Only 12 boxes may be created in total. Attempting to create a new message box when 12 already exist will not create a new box.
When a box is created, it immediately enters 'opened' state (OpenMessageBox). The privateId and hmacKey values are used to restrict access. Decide and set these values on the application side.
The privateId value is the key needed to open a message box and is intended to be limited to one system. The hmacKey value is a secret key common to all instances of an application and is used to prevent data tampering and application spoofing. Set a value that cannot be guessed by analogy. These keys are stored in the message box. Create and set shared keys in an appropriate configuration if you need to access the same message box from multiple save-data files or applications.
When this function is called, the CEC daemon operating in the background stops. Be aware that background communication might be interrupted.→ CecControl::StopScanning
There are two types of StreetPass icons used on System Settings screens and other screens. There is a box icon and an icon for individual messages. You must specify both. This function sets the box icon.
CONFIDENTIAL