1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     cec_MessageId.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: 25783 $
14  *---------------------------------------------------------------------------*/
15 #ifndef NN_CEC_CTR_CEC_MESSAGEID_H_
16 #define NN_CEC_CTR_CEC_MESSAGEID_H_
17 
18 #include <nn/cec/CTR/cec_Const.h>
19 #include <nn/config.h>
20 
21 namespace nn {
22 namespace cec {
23 namespace CTR {
24 
25     // 互換性の為に残す
26     typedef u8  CECMessageId[CEC_SIZEOF_MESSAGEID];
27 
28     /*!
29      * @brief   メッセージ ID
30      */
31     class MessageId
32     {
33     public:
34         static const size_t SIZE = MESSAGE_ID_SIZE;
35         static const size_t ENCODED_SIZE = 12 /*(SIZE * 4 / 3) +  (3 - (SIZE * 4 / 3) % 3)*/;
36 
37         /*!
38          * @brief   コンストラクタ
39          */
40         MessageId(void);
41         explicit MessageId(const u8 msgId[SIZE]);
42         explicit MessageId(const char* msgId);
43         explicit MessageId(CECMessageId msgId);// NN_ATTRIBUTE_DEPRECATED;
44 
45         void GenerateNewId(u64 uniqueId);
46 
47         /*!
48          * @brief   MessageIdのバイナリ列を取得します。
49          */
50         const u8* GetBinary(void) const;
51         void GetBinary(u8 msgId[SIZE]) const;
52         bool IsEqual(const u8 msgId[SIZE]) const;
53         bool IsEmpty(void) const;
54         const char* GetString(void) const;
55         const char* GetEncodedString(void) const;
56 
57     private:
58         u8      m_data[SIZE];
59         static  char s_buffer[SIZE * 2 + 1];
60     };
61 
GetBinary(void)62     inline const u8* MessageId::GetBinary(void) const
63     {
64         return m_data;
65     }
66 
67 
68 } // namespace CTR
69 } // namespace cec
70 } // namespace nn
71 
72 
73 #endif  //NN_CEC_CTR_CEC_MESSAGEID_H_
74 
75