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: 28630 $ 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 @class MessageBoxInfoReader 96 @brief BOX・Messageのヘッダ情報を取得します。Message の一覧を取得するとき等に使用できます。 97 98 Message の 本文・拡張ヘッダ(アイコン等) を読み出すことはできません。<br> 99 それらを読み出すには Message クラスを使用する必要があります。<br> 100 101 このクラスの機能は MessageBox クラスに統合されました。このクラスは廃止予定です。 102 */ 103 class MessageBoxInfoReader 104 { 105 private: 106 107 u32 m_currentCecTitleId; 108 struct MessageBoxInfo m_cecMessageboxInfo; 109 struct CecBoxInfoHeader m_cecInboxInfo; 110 CecMessageHeader* m_cecInboxInfo_body[CEC_INBOX_MESSNUM_DEFAULT]; 111 struct CecBoxInfoHeader m_cecOutboxInfo; 112 CecMessageHeader* m_cecOutboxInfo_body[CEC_OUTBOX_MESSNUM_DEFAULT]; 113 114 public: 115 //! @name 初期化 116 //@{ 117 /*! 118 * @brief コンストラクタです。@ref MessageBox のオブジェクトを指定することで、Boxの情報をロードします。 119 MessageBoxは、特定のBoxがOpenされている必要があります。 120 * @param[in] cecMessBox @ref MessageBox のオブジェクト 121 * @return なし 122 */ 123 MessageBoxInfoReader(const MessageBox& cecMessBox); 124 MessageBoxInfoReader(); 125 ~MessageBoxInfoReader(); 126 127 /*! 128 * @brief @ref MessageBox のオブジェクトを指定することで、Boxの情報をロードします。 129 MessageBoxは、特定のBoxがOpenされている必要があります。 130 * @param[in] cecMessBox @ref MessageBox のオブジェクト 131 * @return nn::Result 132 */ 133 nn::Result LoadMessageBoxInfo(const MessageBox& cecMessBox); 134 //@} 135 136 //! @name MessageBox の情報取得 137 //@{ 138 /*! 139 * @brief @ref MessageBoxFlag を取得します。 140 * @param[in] cecTitleId Title固有ID 141 * @return MessageBoxFlag 142 */ 143 MessageBoxFlag GetMessageBoxInfoFlag(); 144 145 /*! 146 * @brief Boxの最大容量を取得します。 147 * @param[in] boxType @ref CecBoxType 148 * @return Boxの最大容量 149 */ 150 u32 GetBoxSizeMax(CecBoxType boxType); 151 152 /*! 153 * @brief Boxの使用容量を取得します。 154 * @param[in] boxType @ref CecBoxType 155 * @return Boxの使用量 156 */ 157 u32 GetBoxSize(CecBoxType boxType); 158 159 /*! 160 * @brief BoxのMessage最大数を取得します。 161 * @param[in] boxType @ref CecBoxType 162 * @return BoxのMessage最大数 163 */ 164 u32 GetMessNumMax(CecBoxType boxType); 165 166 /*! 167 * @brief BoxのMessage数を取得します。 168 * @param[in] boxType @ref CecBoxType 169 * @return BoxのMessage数 170 */ 171 u32 GetMessNum(CecBoxType boxType); 172 173 u32 GetGroupNumMax(CecBoxType boxType); 174 //@} 175 176 CecMessageHeader* GetCecMessageHeader(CecBoxType boxType, u32 messIndex); 177 178 179 180 //! @name Message の情報取得 181 //@{ 182 183 /*! 184 * @brief BoxのMessageのサイズを取得します。 185 * @param[in] boxType @ref CecBoxType 186 * @param[in] messIndex n番目のMessage 187 * @return Messageのサイズ 188 */ 189 u32 GetMessageMessSize(CecBoxType boxType, u32 messIndex); 190 191 /*! 192 * @brief BoxのMessageの本文サイズを取得します。 193 * @param[in] boxType @ref CecBoxType 194 * @param[in] messIndex n番目のMessage 195 * @return Messageの本文サイズ 196 */ 197 u32 GetMessageBodySize(CecBoxType boxType, u32 messIndex); 198 199 /*! 200 * @brief BoxのMessageの Group ID を取得します。 201 * @param[in] boxType @ref CecBoxType 202 * @param[in] messIndex n番目のMessage 203 * @return Messageの Group ID 204 */ 205 u32 GetMessageGroupId(CecBoxType boxType, u32 messIndex); 206 207 /*! 208 * @brief 受信BoxのMessageの Session ID を取得します。(受信時に付与されるIDです) 209 * @param[in] boxType @ref CecBoxType 210 * @param[in] messIndex n番目のMessage 211 * @return Messageの Session ID 212 */ 213 u32 GetMessageSessionId(CecBoxType boxType, u32 messIndex); 214 215 /*! 216 * @brief BoxのMessageの @ref CecMessageTypeFlag を取得します。 217 * @param[in] boxType @ref CecBoxType 218 * @param[in] messIndex n番目のMessage 219 * @return @ref CecMessageTypeFlag 220 */ 221 u8 GetMessageMessTypeFlag(CecBoxType boxType, u32 messIndex); 222 223 /*! 224 * @brief BoxのMessageの @ref SendMode を取得します。 225 * @param[in] boxType @ref CecBoxType 226 * @param[in] messIndex n番目のMessage 227 * @return @ref SendMode 228 */ 229 u8 GetMessageSendMode(CecBoxType boxType, u32 messIndex); 230 231 /*! 232 * @brief BoxのMessageの 送信回数 を取得します。 233 * @param[in] boxType @ref CecBoxType 234 * @param[in] messIndex n番目のMessage 235 * @return 送信回数 236 */ 237 u8 GetMessageSendCount(CecBoxType boxType, u32 messIndex); 238 239 /*! 240 * @brief BoxのMessageの 伝播回数 を取得します。 241 * @param[in] boxType @ref CecBoxType 242 * @param[in] messIndex n番目のMessage 243 * @return 伝播回数 244 */ 245 u8 GetMessagePropagationCount(CecBoxType boxType, u32 messIndex); 246 247 /*! 248 * @brief BoxのMessageの 未読フラグ を取得します。 249 * @param[in] boxType @ref CecBoxType 250 * @param[in] messIndex n番目のMessage 251 * @return 未読フラグ 252 */ 253 bit8 GetMessageFlag_Unread(CecBoxType boxType, u32 messIndex); 254 255 /*! 256 * @brief BoxのMessageの 新着フラグ を取得します。 257 * @param[in] boxType @ref CecBoxType 258 * @param[in] messIndex n番目のMessage 259 * @return 新着フラグ 260 */ 261 bit8 GetMessageFlag_New(CecBoxType boxType, u32 messIndex); 262 263 /*! 264 * @brief BoxのMessageの Tag を取得します。 265 * @param[in] boxType @ref CecBoxType 266 * @param[in] messIndex n番目のMessage 267 * @return Tag 268 */ 269 bit16 GetMessageTag(CecBoxType boxType, u32 messIndex); 270 271 /*! 272 * @brief Boxの受信Messageの 送信日時 を取得します。 273 * @param[in] boxType @ref CecBoxType 274 * @param[in] messIndex n番目のMessage 275 * @return @ref nn::fnd::DateTimeParameters 276 */ 277 nn::fnd::DateTimeParameters GetMessageSendDate(CecBoxType boxType, u32 messIndex); 278 279 /*! 280 * @brief Boxの受信Messageの 受信日時 を取得します。 281 * @param[in] boxType @ref CecBoxType 282 * @param[in] messIndex n番目のMessage 283 * @return @ref nn::fnd::DateTimeParameters 284 */ 285 nn::fnd::DateTimeParameters GetMessageRecvDate(CecBoxType boxType, u32 messIndex); 286 287 /*! 288 * @brief BoxのMessageの 作成日時 を取得します。 289 * @param[in] boxType @ref CecBoxType 290 * @param[in] messIndex n番目のMessage 291 * @return @ref nn::fnd::DateTimeParameters 292 */ 293 nn::fnd::DateTimeParameters GetMessageCreateDate(CecBoxType boxType, u32 messIndex); 294 295 /*! 296 * @brief 交換された Message の 対になる MessageID を取得します。 297 298 通信の方式に「交換」を 指定して通信したとき、対になる 送信 Message の MessageID が、受信 Message に記録されます。 299 300 * @param[in] boxType @ref CecBoxType 301 * @param[in] messIndex n番目のMessage 302 * @return CECMessageId 303 */ 304 u8* GetMessageMessIdPair(CecBoxType boxType, u32 messIndex); 305 306 307 /*! 308 * @brief BoxのMessageの MessageID を取得します。 309 * @param[in] boxType @ref CecBoxType 310 * @param[in] messIndex n番目のMessage 311 * @return CECMessageId 312 */ 313 u8* GetMessageMessId(CecBoxType boxType, u32 messIndex); 314 315 316 /*! 317 * @brief MessageID から、何番目のMessageであるか(messIndex)を取得します。 318 * @param[in] boxType @ref CecBoxType 319 * @param[in] messId MessageID 320 * @return messIndex 321 */ 322 u32 GetMessIndex(CecBoxType boxType, const MessageId& messageId); 323 //@} 324 325 }; 326 327 328 } // namespace CTR 329 } // namespace cec 330 } // namespace nn 331 332 333 #endif //__MESSAGE_BOX_INFO_READER_H__ 334 335