/*---------------------------------------------------------------------------* Project: Horizon File: uds_NetworkDescription.h Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 35645 $ *---------------------------------------------------------------------------*/ /*! @file @brief UDS ネットワーク情報クラスの定義 */ #ifndef LIBRARIES_UDS_CTR_UDS_NETWORK_DESCRIPTION_H_ #define LIBRARIES_UDS_CTR_UDS_NETWORK_DESCRIPTION_H_ #include #include #include #include namespace nn { namespace uds { namespace CTR { /*! :category Scan関数の結果の取り扱い @class nn::uds::CTR::NetworkDescription @brief @ref nn::uds::CTR::NetworkDescriptionReader から取得出来る、ネットワーク情報を示すクラスです。 */ class NetworkDescription { public: /*! :private @brief NetworkDescription の初期化を行います。 通常、アプリは @ref nn::uds::CTR::NetworkDescriptionReader から NetworkDescription を取得するので Initialize() をする必要はありません。 @param[in] localId ローカル通信 ID です。 @param[in] subId アプリが自由に設定可能な通信モード識別用 ID です。 @param[in] maxEntry ネットワークに接続可能なノードの最大数です。 @param[in] channel ネットワークが存在するチャンネルです。 @return */ void Initialize( u32 localId, u8 subId, u8 maxEntry, u8 channel ); /*! :private @brief NetworkDescription の初期化を行います。 通常、アプリは @ref nn::uds::CTR::NetworkDescriptionReader から NetworkDescription を取得するので Initialize() をする必要はありません。 @param[in] element ビーコン内に含まれる NetworkDescription IE のペイロードです。 @param[in] channel ネットワークが存在するチャンネルです。 @param[in] bssid ネットワークの BSSID (Master の MAC アドレス) です。 @return */ void Initialize( const detail::NetworkDescriptionElement* element, u8 channel, const bit8 bssid[MAC_ADDRESS_SIZE]); /*! :private @brief NetworkDescription の終了処理を行います。 不正なビーコンを検知した際に実行されます。 @return */ void Finalize() { m_IsInitialized = false; std::memset(m_Bssid, 0x00, MAC_ADDRESS_SIZE); } const bit8* GetBssid() const{ return m_Bssid; } //!< BSSID (Master の MAC アドレス)を取得します。 u32 GetGameId() const {return this->GetLocalCommunicationId(); } //!< ローカル通信 ID を取得します。本関数は @ref GetLocalCommunicationId 関数と同一で互換性維持のために残されている API です。 u32 GetLocalCommunicationId() const {return m_IsInitialized? detail::UDS_BE2LE32(m_Element.gameId):0; } //!< ローカル通信 ID を取得します。 @ref Scan で指定した値と同一になります。 u8 GetSubId() const {return m_IsInitialized? m_Element.subId:0; } //!< SubId を取得します。 u32 GetTemporaryId() const {return m_IsInitialized? detail::UDS_BE2LE32(m_Element.temporaryId):0; } //!< TemporaryId を取得します。ネットワークの識別に利用できますが、BSSID もしくは Master の NodeInformation の使用を推奨します。 u16 GetChannel() const { return m_IsInitialized? m_Channel:0; } //!< 通信に使用しているチャンネルを取得します。通常参照する必要はありません。 u8 GetNowEntry() const { return m_IsInitialized? m_Element.nowEntry:0 ; } //!< 現在の接続台数を取得します。 u8 GetMaxEntry() const { return m_IsInitialized? m_Element.maxEntry:0 ; } //!< 最大接続台数を取得します。 size_t GetApplicationData(bit8* buffer, const size_t bufferSize) const; //!< SetApplicationDataToBeacon() でセットしたデータを取得します。 bool CanConnectAsSpectator() const { return ( m_IsInitialized && !(detail::UDS_BE2LE16(m_Element.attribute) & detail::EJECT_SPECTAOTR_FLAG)); } //!CanConnectAsClient() && !(detail::UDS_BE2LE16(m_Element.attribute) & detail::DISALLOW_RECONNECT_FLAG)); }//!