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: 28342 $
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         /*!
42          * @brief   コンストラクタ
43          * @param[in]    msgId      MessageIDバイナリ列を渡して初期化します。
44          */
45         explicit MessageId(const u8 msgId[SIZE]);
46         explicit MessageId(const char* msgId);
47         explicit MessageId(CECMessageId msgId);// NN_ATTRIBUTE_DEPRECATED;
48 
49         void GenerateNewId(u64 uniqueId);
50 
51         /*!
52          * @brief   MessageIdのバイナリ列を取得します。
53          */
54         const u8* GetBinary(void) const;
55 
56         /*!
57          * @brief   MessageIdのバイナリ列を取得します。
58          * @param[out]    msgId      バッファ
59          */
60         void GetBinary(u8 msgId[SIZE]) const;
61         /*!
62          * @brief   MessageIdのバイナリ列を比較します。
63          * @param[out]    msgId      比較対象のMessageIDバイナリ列
64          */
65         bool IsEqual(const u8 msgId[SIZE]) const;
66 
67         bool IsEmpty(void) const;
68         const char* GetString(void) const;
69         const char* GetEncodedString(void) const;
70 
71     private:
72         u8      m_data[SIZE];
73         static  char s_buffer[SIZE * 2 + 1];
74     };
75 
GetBinary(void)76     inline const u8* MessageId::GetBinary(void) const
77     {
78         return m_data;
79     }
80 
81 
82 } // namespace CTR
83 } // namespace cec
84 } // namespace nn
85 
86 
87 #endif  //NN_CEC_CTR_CEC_MESSAGEID_H_
88 
89