/*---------------------------------------------------------------------------* Project: Horizon File: cec_MessageBoxInfoReader.h Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 28630 $ *---------------------------------------------------------------------------*/ #ifndef __MESSAGE_BOX_INFO_READER_H__ #define __MESSAGE_BOX_INFO_READER_H__ #include #include /* CEC/ | +-- MessageBoxList \-- Message_BOX1/ | | | +-- MessageBoxInfo | \-- InBox/ | | | | | +-- InBoxInfo | | +-- Message1 | | | \-- OutBox/ | | | +-- OutBoxIndex | +-- OutBoxInfo | +-- Message2 | \-- Message_BOX2/ | ------------------------------------ struct MessageBoxInfo { u16 magic16; NN_PADDING2; u32 cecTitleId; // Title固有ID u32 privateId; // アプリがつける固有ID。アクセスする為のキーとなる。 MessageBoxFlag MessageBoxInfoFlag; // MessageBoxInfoのフラグ(Systemなど) NN_PADDING3; char hmacKey[MESSAGE_HMAC_KEYLEN]; // HMACで署名を付けるときに使用するKey u32 MessageBoxInfoSize; // MessageBoxInfoのサイズ(Byte) nn::fnd::DateTimeParameters lastOpened; // アクセス時の時刻を記録 u8 reserved[256]; // reserved (名称・iconなどは別ファイルに書く) }; ------------------------------------ File : InBoxInfo/OutBoxInfo +----------------------+ | CEC Box Info Header | +----------------------+ -+ | CEC Message Header1 | | +----------------------+ | CecMessageHeader_List | CEC Message Header2 | | +----------------------+ | | CEC Message Header3 | | +----------------------+ | | .......... | | | | | +----------------------+ -+ struct CecBoxInfoHeader { u16 magic16; NN_PADDING2; u32 boxInfoSize; // BoxInfoのサイズ u32 boxSizeMax; // MessageBoxのサイズ(Byte)最大値 u32 boxSize; // MessageBoxのサイズ(使用量)(Byte) u32 messNumMax; // ボックスに格納可能な message数 の最大値 u32 messNum; // ボックスに格納されているmessage数 u32 groupNumMax; // ボックスに格納可能な Message Group 数 の最大値 u32 messSizeMax; // 1つのMessageの最大サイズ }; */ namespace nn { namespace cec { namespace CTR { /*! @class MessageBoxInfoReader @brief BOX・Messageのヘッダ情報を取得します。Message の一覧を取得するとき等に使用できます。 Message の 本文・拡張ヘッダ(アイコン等) を読み出すことはできません。
それらを読み出すには Message クラスを使用する必要があります。
このクラスの機能は MessageBox クラスに統合されました。このクラスは廃止予定です。 */ class MessageBoxInfoReader { private: u32 m_currentCecTitleId; struct MessageBoxInfo m_cecMessageboxInfo; struct CecBoxInfoHeader m_cecInboxInfo; CecMessageHeader* m_cecInboxInfo_body[CEC_INBOX_MESSNUM_DEFAULT]; struct CecBoxInfoHeader m_cecOutboxInfo; CecMessageHeader* m_cecOutboxInfo_body[CEC_OUTBOX_MESSNUM_DEFAULT]; public: //! @name 初期化 //@{ /*! * @brief コンストラクタです。@ref MessageBox のオブジェクトを指定することで、Boxの情報をロードします。 MessageBoxは、特定のBoxがOpenされている必要があります。 * @param[in] cecMessBox @ref MessageBox のオブジェクト * @return なし */ MessageBoxInfoReader(const MessageBox& cecMessBox); MessageBoxInfoReader(); ~MessageBoxInfoReader(); /*! * @brief @ref MessageBox のオブジェクトを指定することで、Boxの情報をロードします。 MessageBoxは、特定のBoxがOpenされている必要があります。 * @param[in] cecMessBox @ref MessageBox のオブジェクト * @return nn::Result */ nn::Result LoadMessageBoxInfo(const MessageBox& cecMessBox); //@} //! @name MessageBox の情報取得 //@{ /*! * @brief @ref MessageBoxFlag を取得します。 * @param[in] cecTitleId Title固有ID * @return MessageBoxFlag */ MessageBoxFlag GetMessageBoxInfoFlag(); /*! * @brief Boxの最大容量を取得します。 * @param[in] boxType @ref CecBoxType * @return Boxの最大容量 */ u32 GetBoxSizeMax(CecBoxType boxType); /*! * @brief Boxの使用容量を取得します。 * @param[in] boxType @ref CecBoxType * @return Boxの使用量 */ u32 GetBoxSize(CecBoxType boxType); /*! * @brief BoxのMessage最大数を取得します。 * @param[in] boxType @ref CecBoxType * @return BoxのMessage最大数 */ u32 GetMessNumMax(CecBoxType boxType); /*! * @brief BoxのMessage数を取得します。 * @param[in] boxType @ref CecBoxType * @return BoxのMessage数 */ u32 GetMessNum(CecBoxType boxType); u32 GetGroupNumMax(CecBoxType boxType); //@} CecMessageHeader* GetCecMessageHeader(CecBoxType boxType, u32 messIndex); //! @name Message の情報取得 //@{ /*! * @brief BoxのMessageのサイズを取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return Messageのサイズ */ u32 GetMessageMessSize(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの本文サイズを取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return Messageの本文サイズ */ u32 GetMessageBodySize(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの Group ID を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return Messageの Group ID */ u32 GetMessageGroupId(CecBoxType boxType, u32 messIndex); /*! * @brief 受信BoxのMessageの Session ID を取得します。(受信時に付与されるIDです) * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return Messageの Session ID */ u32 GetMessageSessionId(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの @ref CecMessageTypeFlag を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return @ref CecMessageTypeFlag */ u8 GetMessageMessTypeFlag(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの @ref SendMode を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return @ref SendMode */ u8 GetMessageSendMode(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの 送信回数 を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return 送信回数 */ u8 GetMessageSendCount(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの 伝播回数 を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return 伝播回数 */ u8 GetMessagePropagationCount(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの 未読フラグ を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return 未読フラグ */ bit8 GetMessageFlag_Unread(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの 新着フラグ を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return 新着フラグ */ bit8 GetMessageFlag_New(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの Tag を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return Tag */ bit16 GetMessageTag(CecBoxType boxType, u32 messIndex); /*! * @brief Boxの受信Messageの 送信日時 を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return @ref nn::fnd::DateTimeParameters */ nn::fnd::DateTimeParameters GetMessageSendDate(CecBoxType boxType, u32 messIndex); /*! * @brief Boxの受信Messageの 受信日時 を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return @ref nn::fnd::DateTimeParameters */ nn::fnd::DateTimeParameters GetMessageRecvDate(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの 作成日時 を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return @ref nn::fnd::DateTimeParameters */ nn::fnd::DateTimeParameters GetMessageCreateDate(CecBoxType boxType, u32 messIndex); /*! * @brief 交換された Message の 対になる MessageID を取得します。 通信の方式に「交換」を 指定して通信したとき、対になる 送信 Message の MessageID が、受信 Message に記録されます。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return CECMessageId */ u8* GetMessageMessIdPair(CecBoxType boxType, u32 messIndex); /*! * @brief BoxのMessageの MessageID を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messIndex n番目のMessage * @return CECMessageId */ u8* GetMessageMessId(CecBoxType boxType, u32 messIndex); /*! * @brief MessageID から、何番目のMessageであるか(messIndex)を取得します。 * @param[in] boxType @ref CecBoxType * @param[in] messId MessageID * @return messIndex */ u32 GetMessIndex(CecBoxType boxType, const MessageId& messageId); //@} }; } // namespace CTR } // namespace cec } // namespace nn #endif //__MESSAGE_BOX_INFO_READER_H__