1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: cec_MessageBoxInfoReader.h 4 5 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 33743 $ 14 *---------------------------------------------------------------------------*/ 15 #ifndef __MESSAGE_BOX_INFO_READER_H__ 16 #define __MESSAGE_BOX_INFO_READER_H__ 17 18 #include <nn/cec/CTR/cec_Message.h> 19 #include <nn/cec/CTR/cec_MessageBox.h> 20 21 /* 22 CEC/ 23 | 24 +-- MessageBoxList 25 \-- Message_BOX1/ 26 | | 27 | +-- MessageBoxInfo 28 | \-- InBox/ 29 | | | 30 | | +-- InBoxInfo 31 | | +-- Message1 32 | | 33 | \-- OutBox/ 34 | | 35 | +-- OutBoxIndex 36 | +-- OutBoxInfo 37 | +-- Message2 38 | 39 \-- Message_BOX2/ 40 | 41 42 ------------------------------------ 43 44 struct MessageBoxInfo 45 { 46 u16 magic16; 47 NN_PADDING2; 48 u32 cecTitleId; // Title固有ID 49 u32 privateId; // アプリがつける固有ID。アクセスする為のキーとなる。 50 MessageBoxFlag MessageBoxInfoFlag; // MessageBoxInfoのフラグ(Systemなど) 51 NN_PADDING3; 52 char hmacKey[MESSAGE_HMAC_KEYLEN]; // HMACで署名を付けるときに使用するKey 53 u32 MessageBoxInfoSize; // MessageBoxInfoのサイズ(Byte) 54 nn::fnd::DateTimeParameters lastOpened; // アクセス時の時刻を記録 55 u8 reserved[256]; // reserved (名称・iconなどは別ファイルに書く) 56 }; 57 58 ------------------------------------ 59 60 File : InBoxInfo/OutBoxInfo 61 +----------------------+ 62 | CEC Box Info Header | 63 +----------------------+ -+ 64 | CEC Message Header1 | | 65 +----------------------+ | CecMessageHeader_List 66 | CEC Message Header2 | | 67 +----------------------+ | 68 | CEC Message Header3 | | 69 +----------------------+ | 70 | .......... | | 71 | | | 72 +----------------------+ -+ 73 74 struct CecBoxInfoHeader 75 { 76 u16 magic16; 77 NN_PADDING2; 78 u32 boxInfoSize; // BoxInfoのサイズ 79 u32 boxSizeMax; // MessageBoxのサイズ(Byte)最大値 80 u32 boxSize; // MessageBoxのサイズ(使用量)(Byte) 81 u32 messNumMax; // ボックスに格納可能な message数 の最大値 82 u32 messNum; // ボックスに格納されているmessage数 83 u32 groupNumMax; // ボックスに格納可能な Message Group 数 の最大値 84 u32 messSizeMax; // 1つのMessageの最大サイズ 85 }; 86 87 */ 88 89 90 namespace nn { 91 namespace cec { 92 namespace CTR { 93 94 /*! 95 :private 96 @class MessageBoxInfoReader 97 @brief BOX・Messageのヘッダ情報を取得します。Message の一覧を取得するとき等に使用できます。 98 99 Message の 本文・拡張ヘッダ(アイコン等) を読み出すことはできません。<br> 100 それらを読み出すには Message クラスを使用する必要があります。<br> 101 102 このクラスの機能は MessageBox クラスに統合されました。このクラスは廃止予定です。 103 */ 104 class MessageBoxInfoReader 105 { 106 private: 107 108 u32 m_currentCecTitleId; 109 struct MessageBoxInfo m_cecMessageboxInfo; 110 struct CecBoxInfoHeader m_cecInboxInfo; 111 CecMessageHeader* m_cecInboxInfo_body[CEC_INBOX_MESSNUM_DEFAULT]; 112 struct CecBoxInfoHeader m_cecOutboxInfo; 113 CecMessageHeader* m_cecOutboxInfo_body[CEC_OUTBOX_MESSNUM_DEFAULT]; 114 115 public: 116 //! @name 初期化 117 //@{ 118 /*! 119 * @brief コンストラクタです。@ref MessageBox のオブジェクトを指定することで、Boxの情報をロードします。 120 MessageBoxは、特定のBoxがOpenされている必要があります。 121 * @param[in] cecMessBox @ref MessageBox のオブジェクト 122 * @return なし 123 */ 124 MessageBoxInfoReader(const MessageBox& cecMessBox); 125 MessageBoxInfoReader(); 126 ~MessageBoxInfoReader(); 127 128 /*! 129 * @brief @ref MessageBox のオブジェクトを指定することで、Boxの情報をロードします。 130 MessageBoxは、特定のBoxがOpenされている必要があります。 131 * @param[in] cecMessBox @ref MessageBox のオブジェクト 132 * @return nn::Result 133 */ 134 nn::Result LoadMessageBoxInfo(const MessageBox& cecMessBox); 135 //@} 136 137 //! @name MessageBox の情報取得 138 //@{ 139 /*! 140 * @brief @ref MessageBoxFlag を取得します。 141 * @param[in] cecTitleId Title固有ID 142 * @return MessageBoxFlag 143 */ 144 MessageBoxFlag GetMessageBoxInfoFlag(); 145 146 /*! 147 * @brief Boxの最大容量を取得します。 148 * @param[in] boxType @ref CecBoxType 149 * @return Boxの最大容量 150 */ 151 u32 GetBoxSizeMax(CecBoxType boxType); 152 153 /*! 154 * @brief Boxの使用容量を取得します。 155 * @param[in] boxType @ref CecBoxType 156 * @return Boxの使用量 157 */ 158 u32 GetBoxSize(CecBoxType boxType); 159 160 /*! 161 * @brief BoxのMessage最大数を取得します。 162 * @param[in] boxType @ref CecBoxType 163 * @return BoxのMessage最大数 164 */ 165 u32 GetMessNumMax(CecBoxType boxType); 166 167 /*! 168 * @brief BoxのMessage数を取得します。 169 * @param[in] boxType @ref CecBoxType 170 * @return BoxのMessage数 171 */ 172 u32 GetMessNum(CecBoxType boxType); 173 174 u32 GetGroupNumMax(CecBoxType boxType); 175 //@} 176 177 CecMessageHeader* GetCecMessageHeader(CecBoxType boxType, u32 messIndex); 178 179 180 181 //! @name Message の情報取得 182 //@{ 183 184 /*! 185 * @brief BoxのMessageのサイズを取得します。 186 * @param[in] boxType @ref CecBoxType 187 * @param[in] messIndex n番目のMessage 188 * @return Messageのサイズ 189 */ 190 u32 GetMessageMessSize(CecBoxType boxType, u32 messIndex); 191 192 /*! 193 * @brief BoxのMessageの本文サイズを取得します。 194 * @param[in] boxType @ref CecBoxType 195 * @param[in] messIndex n番目のMessage 196 * @return Messageの本文サイズ 197 */ 198 u32 GetMessageBodySize(CecBoxType boxType, u32 messIndex); 199 200 /*! 201 * @brief BoxのMessageの Group ID を取得します。 202 * @param[in] boxType @ref CecBoxType 203 * @param[in] messIndex n番目のMessage 204 * @return Messageの Group ID 205 */ 206 u32 GetMessageGroupId(CecBoxType boxType, u32 messIndex); 207 208 /*! 209 * @brief 受信BoxのMessageの Session ID を取得します。(受信時に付与されるIDです) 210 * @param[in] boxType @ref CecBoxType 211 * @param[in] messIndex n番目のMessage 212 * @return Messageの Session ID 213 */ 214 u32 GetMessageSessionId(CecBoxType boxType, u32 messIndex); 215 216 /*! 217 * @brief BoxのMessageの @ref CecMessageTypeFlag を取得します。 218 * @param[in] boxType @ref CecBoxType 219 * @param[in] messIndex n番目のMessage 220 * @return @ref CecMessageTypeFlag 221 */ 222 u8 GetMessageMessTypeFlag(CecBoxType boxType, u32 messIndex); 223 224 /*! 225 * @brief BoxのMessageの @ref SendMode を取得します。 226 * @param[in] boxType @ref CecBoxType 227 * @param[in] messIndex n番目のMessage 228 * @return @ref SendMode 229 */ 230 u8 GetMessageSendMode(CecBoxType boxType, u32 messIndex); 231 232 /*! 233 * @brief BoxのMessageの 送信回数 を取得します。 234 * @param[in] boxType @ref CecBoxType 235 * @param[in] messIndex n番目のMessage 236 * @return 送信回数 237 */ 238 u8 GetMessageSendCount(CecBoxType boxType, u32 messIndex); 239 240 /*! 241 * @brief BoxのMessageの 伝播回数 を取得します。 242 * @param[in] boxType @ref CecBoxType 243 * @param[in] messIndex n番目のMessage 244 * @return 伝播回数 245 */ 246 u8 GetMessagePropagationCount(CecBoxType boxType, u32 messIndex); 247 248 /*! 249 * @brief BoxのMessageの 未読フラグ を取得します。 250 * @param[in] boxType @ref CecBoxType 251 * @param[in] messIndex n番目のMessage 252 * @return 未読フラグ 253 */ 254 bit8 GetMessageFlag_Unread(CecBoxType boxType, u32 messIndex); 255 256 /*! 257 * @brief BoxのMessageの 新着フラグ を取得します。 258 * @param[in] boxType @ref CecBoxType 259 * @param[in] messIndex n番目のMessage 260 * @return 新着フラグ 261 */ 262 bit8 GetMessageFlag_New(CecBoxType boxType, u32 messIndex); 263 264 /*! 265 * @brief BoxのMessageの Tag を取得します。 266 * @param[in] boxType @ref CecBoxType 267 * @param[in] messIndex n番目のMessage 268 * @return Tag 269 */ 270 bit16 GetMessageTag(CecBoxType boxType, u32 messIndex); 271 272 /*! 273 * @brief Boxの受信Messageの 送信日時 を取得します。 274 * @param[in] boxType @ref CecBoxType 275 * @param[in] messIndex n番目のMessage 276 * @return @ref nn::fnd::DateTimeParameters 277 */ 278 nn::fnd::DateTimeParameters GetMessageSendDate(CecBoxType boxType, u32 messIndex); 279 280 /*! 281 * @brief Boxの受信Messageの 受信日時 を取得します。 282 * @param[in] boxType @ref CecBoxType 283 * @param[in] messIndex n番目のMessage 284 * @return @ref nn::fnd::DateTimeParameters 285 */ 286 nn::fnd::DateTimeParameters GetMessageRecvDate(CecBoxType boxType, u32 messIndex); 287 288 /*! 289 * @brief BoxのMessageの 作成日時 を取得します。 290 * @param[in] boxType @ref CecBoxType 291 * @param[in] messIndex n番目のMessage 292 * @return @ref nn::fnd::DateTimeParameters 293 */ 294 nn::fnd::DateTimeParameters GetMessageCreateDate(CecBoxType boxType, u32 messIndex); 295 296 /*! 297 * @brief 交換された Message の 対になる MessageID を取得します。 298 299 通信の方式に「交換」を 指定して通信したとき、対になる 送信 Message の MessageID が、受信 Message に記録されます。 300 301 * @param[in] boxType @ref CecBoxType 302 * @param[in] messIndex n番目のMessage 303 * @return CECMessageId 304 */ 305 u8* GetMessageMessIdPair(CecBoxType boxType, u32 messIndex); 306 307 308 /*! 309 * @brief BoxのMessageの MessageID を取得します。 310 * @param[in] boxType @ref CecBoxType 311 * @param[in] messIndex n番目のMessage 312 * @return CECMessageId 313 */ 314 u8* GetMessageMessId(CecBoxType boxType, u32 messIndex); 315 316 317 /*! 318 * @brief MessageID から、何番目のMessageであるか(messIndex)を取得します。 319 * @param[in] boxType @ref CecBoxType 320 * @param[in] messId MessageID 321 * @return messIndex 322 */ 323 u32 GetMessIndex(CecBoxType boxType, const MessageId& messageId); 324 //@} 325 326 }; 327 328 329 } // namespace CTR 330 } // namespace cec 331 } // namespace nn 332 333 334 #endif //__MESSAGE_BOX_INFO_READER_H__ 335 336