1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     uds_ScanResultReader.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: 28220 $
14  *---------------------------------------------------------------------------*/
15 
16 /*! @file
17     @brief    スキャン結果の解析用クラスを定義します。
18 */
19 
20 #ifndef LIBRARIES_UDS_CTR_UDS_SCAN_RESULT_READER_H_
21 #define LIBRARIES_UDS_CTR_UDS_SCAN_RESULT_READER_H_
22 
23 #include <nn.h>
24 
25 #include <nn/uds/CTR/uds_Type.h>
26 #include <nn/uds/CTR/uds_Result.h>
27 #include <nn/uds/CTR/uds_InfoElement.h>
28 #include <nn/uds/CTR/uds_NetworkDescription.h>
29 
30 namespace nn {
31 namespace uds {
32 namespace CTR {
33 
34 
35 /*!
36     :category Scan関数の結果の取り扱い
37     @class nn::uds::CTR::NetworkDescriptionReader
38     @brief @ref nn::uds::CTR::ScanResultReader から取得出来る、各ネットワークの情報を解析するクラスです。
39 */
40 class NetworkDescriptionReader
41 {
42 public:
NetworkDescriptionReader(const u8 * pBuffer)43     NetworkDescriptionReader(const u8* pBuffer):m_pBuffer(pBuffer){}
~NetworkDescriptionReader()44     virtual ~NetworkDescriptionReader() {}
45 
46 /*!
47   @brief        スキャン結果からネットワーク情報を取得します。
48 
49   @param[out]   pNetworkDescription  ネットワーク情報の格納先です。データは正しくネットワーク情報を取得できた場合のみ格納されます。
50 
51   @return       関数の実行結果を返します。以下に挙げる Result を返します。
52   @retval       ResultSuccess       ネットワーク情報の取得に成功しました。
53   @retval       ResultMalformedData データが改ざんされている可能性があったため取得しませんでした。
54   @retval       上記以外            上記以外の理由で失敗しました。
55 */
56     nn::Result GetNetworkDescription ( NetworkDescription* pNetworkDescription );
57 
58 /*!
59   @brief        スキャン結果からネットワークに接続しているノードのユーザー情報を取得します。
60 
61   @param[out]   pNodeInfo ユーザー情報の格納です。そのネットワークの最大接続数分の配列を指定してください。データは正しくユーザー情報を取得できた場合のみ格納されます。
62 
63   @return       関数の実行結果を返します。以下に挙げる Result を返します。
64   @retval       ResultSuccess       ネットワーク情報の取得に成功しました。
65   @retval       ResultMalformedData データが改ざんされている可能性があったため取得しませんでした。
66   @retval       ResultWirelessOff   無線 OFF モードに遷移しました。再初期化が必要です。
67   @retval       上記以外            上記以外の理由で失敗しました。
68 */
69     nn::Result GetNodeInformationList( NodeInformation pNodeInfo[NODE_MAX] );
70 
71 /*!
72   @brief        ネットワークから送信された電波の強度を リンクレベル換算で取得します。
73 
74   @param[out]   pLinkLevel 電波強度の格納先です。
75 
76   @return       関数の実行結果を返します。以下に挙げる Result を返します。
77   @retval       ResultSuccess       ネットワーク情報の取得に成功しました。
78   @retval       上記以外            上記以外の理由で失敗しました。
79 
80 */
81     nn::Result GetRadioStrength( LinkLevel* pLinkLevel );
82 private:
83     const u8* m_pBuffer;
84 };
85 
86 /*!
87 
88     :category Scan関数の結果の取り扱い
89     @class nn::uds::CTR::ScanResultReader
90     @brief @ref nn::uds::CTR::Scan の探索結果を解析するクラスです。
91 */
92 class ScanResultReader
93 {
94 public:
95 /*!
96   @brief        引数で与えたれた探索結果を解析する インスタンスを生成します。
97   @param[in]    pBuffer 探索結果のポインタです。@ref nn::uds::CTR::Scan に与えたバッファを指定してください。
98   @return       なし
99 */
ScanResultReader(const void * pBuffer)100     ScanResultReader(const void* pBuffer) : m_pBuffer(pBuffer), m_pNext(NULL){}
~ScanResultReader()101     virtual ~ScanResultReader() {}
102 
103 /*!
104   @brief        見つかったネットワークの数をカウントします。
105   @return       見つかったネットワークの個数です。
106 */
107     u32   GetCount() const;
108 
109 /*!
110   @brief        最初に見つかったネットワークを @ref nn::uds::CTR::NetworkDescriptionReader で取得します。
111   @return       @ref nn::uds::CTR::NetworkDescriptionReader を参照下さい。
112 
113 */      const NetworkDescriptionReader GetFirstDescription();
114 
115 /*!
116   @brief        次に見つかったネットワークを @ref nn::uds::CTR::NetworkDescriptionReader で取得します。
117   @return       @ref nn::uds::CTR::NetworkDescriptionReader を参照下さい。
118 
119 */      const NetworkDescriptionReader GetNextDescription();
120 private:
121     const void* m_pBuffer;
122     bit8*       m_pNext;
123 };
124 
125 /*!
126   @}
127 */
128 } // end of namespace CTR
129 } // end of namespace uds
130 } // end of namespace nn
131 
132 #endif /* LIBRARIES_UDS_CTR_UDS_SCAN_RESULT_READER_H_ */
133