CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
local_LdnSessionInfo.h
1 /*--------------------------------------------------------------------------------*
2  Copyright (C)Nintendo All rights reserved.
3 
4  These coded instructions, statements, and computer programs contain proprietary
5  information of Nintendo and/or its licensed developers and are protected by
6  national and international copyright laws. They may not be disclosed to third
7  parties or copied or duplicated in any form, in whole or in part, without the
8  prior written consent of Nintendo.
9 
10  The content herein is highly confidential and should be handled accordingly.
11  *--------------------------------------------------------------------------------*/
12 
13 
14 #pragma once
15 
16 #include <nn/pia/local/local_LocalSessionInfo.h>
17 
18 #if NN_PIA_NINTENDOSDK
19 #include <nn/pia/local/local_LdnNetworkSetting.h>
20 
21 namespace nn
22 {
23 namespace pia
24 {
25 namespace local
26 {
27 
28 /*!
29  @brief ローカル通信のセッション情報クラスです。
30 */
31 class LdnSessionInfo : public local::LocalSessionInfo
32 {
33 public:
34  LdnSessionInfo();
35  virtual ~LdnSessionInfo();
36 
37  /*!
38  @brief セッション情報をコピーします。
39  @details アプリケーションでセッション情報を保持したい際に使用します。
40  @param[in] rhs コピーするセッション情報
41  */
42  void Copy(const LdnSessionInfo& rhs);
43 
44  /*!
45  @brief 代入演算子です。
46  @param[in] rhs 代入するオブジェクトです。
47  @return 本オブジェクトへの参照。
48  */
49  LdnSessionInfo& operator=(const LdnSessionInfo& rhs);
50 
51  /*!
52  @brief コピーコンストラクタ。。
53  @param[in] rhs コピー元のオブジェクトです。
54  */
55  LdnSessionInfo(const LdnSessionInfo& rhs);
56 
57  /*!
58  @brief セッション情報をクリアします。
59  */
60  virtual void Clear();
61 
62  /*!
63  @brief セッションのゲームモードを取得します。
64  @details 通信モード識別用 ID を uint32_t にキャストして返します。
65  @return ゲームモードを返します。
66  */
67  virtual uint32_t GetGameMode() const;
68 
69  /*!
70  @brief セッションの ID を取得します。
71  @details 同じセッション ID を持つ異なるセッションが存在する場合があります。
72  @return セッションの ID を返します。
73  */
74  virtual uint32_t GetSessionId() const;
75 
76  /*!
77  @brief セッションに参加している人数を取得します。
78  @return セッションに参加している人数を返します。
79  */
80  virtual uint16_t GetCurrentParticipantNum() const;
81 
82  /*!
83  @brief セッションに参加できる最大人数を取得します。
84  @return セッションに参加できる最大人数を返します。
85  */
86  virtual uint16_t GetMaxParticipantNum() const;
87 
88  /*!
89  @brief セッションのアプリケーション定義データを取得します。
90  @details アプリケーションが設定したビーコンデータを取得します。
91  @param[out] pBuffer セッションのアプリケーション定義データのコピー用バッファのポインタ。
92  @param[in] size セッションのアプリケーション定義データのコピー用バッファのサイズ。
93  @return 正常に情報を取得できた場合、成功の Result が返ります。
94  @retval ResultInvalidArgument 引数が不正です。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
95  */
96  virtual Result GetApplicationData(void* pBuffer, uint32_t size) const;
97 
98  /*!
99  @brief セッションのアプリケーション定義データの長さを取得します。
100  @return セッションのアプリケーション定義データの長さが返ります。
101  */
102  virtual uint32_t GetApplicationDataSize() const;
103 
104 
105  /*!
106  @brief セッションが参加募集受付状態かどうかを取得します。
107  @return セッションが参加募集受付状態なら true, 参加募集締切状態なら false を返します。
108  */
109  virtual bool IsOpened() const;
110 
111  /*!
112  @if NIN_DOC
113  @brief セッションに参加中のステーション情報を取得します。
114  @param[out] pSessionStationInfo ステーション情報格納先のポインタ。
115  @param[in] sessionStationInfoListSize ステーション情報リスト格納先のサイズ。参加中のステーション数以上である必要があります。
116  @return 正常に情報を取得できた場合、成功の Result が返ります。
117  @retval ResultInvalidArgument 引数が不正です。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
118  @retval ResultBufferShortage ステーション情報のサイズがステーション情報格納先のサイズよりも大きいため、コピーできません。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
119  @endif
120  */
121  virtual Result GetSessionStationInfo(LocalStationInfo* pSessionStationInfo, uint32_t sessionStationInfoListSize) const;
122 
123  /*!
124  @if NIN_DOC
125  @brief BSSID(ホストの MAC アドレス)を取得します。
126  @details BSSID のサイズは @ref local::BssIdSize バイトです。引数には、このサイズのバッファを設定する必要があります。
127  @param[out] pBssidBuffer BSSID を格納するためのバッファのポインタ。サイズが local::BssIdSize バイトである必要があります。
128  @param[in] size BSSID を格納するためのバッファのサイズ。
129  @return 正常に情報を取得できた場合、成功の Result が返ります。
130  @retval ResultInvalidArgument 引数が不正です。プログラミングエラーです。このエラーが返らないようにソースコードを修正してください。
131  @endif
132  */
133  virtual Result GetBssid(uint8_t* pBssidBuffer, uint32_t size) const;
134 
135  /*!
136  @brief デバッグに有用な情報をプリントします。
137  @param[in] flag トレースフラグの論理和。詳細は @ref TraceFlag 型を参照してください。
138  */
139  virtual void Trace(uint64_t flag) const;
140 
141  //! @cond PRIVATE
142  virtual const LocalNetworkDescription* GetLocalNetworkDescription() const;
143  virtual void SetLocalNetworkDescription(uint32_t networkIndex, const LocalNetworkDescription* pDescription);
144 
145  virtual Result SetSessionStationInfo(uint32_t index);
146 
147  void SetCurrentPaticipantNum(uint16_t participantNum)
148  {
149  m_CurrentParticipantNum = participantNum;
150  }
151  void SetMaxParticipantNum(uint16_t maxParticipantNum)
152  {
153  m_MaxParticipantNum = maxParticipantNum;
154  }
155  void SetGameMode(uint32_t gameMode)
156  {
157  m_GameMode = gameMode;
158  }
159  void SetSessionId(uint32_t sessionId)
160  {
161  m_SessionId = sessionId;
162  }
163  void SetOpened(bool b)
164  {
165  m_IsOpened = b;
166  }
167  const uint8_t* GetApplicationDataBuffer() const
168  {
169  return m_ApplicationData;
170  }
171  uint8_t* GetApplicationDataBuffer()
172  {
173  return m_ApplicationData;
174  }
175  uint32_t GetApplicationDataBufferSize() const
176  {
177  return sizeof(m_ApplicationData);
178  }
179  uint8_t* GetBssIdBuffer()
180  {
181  return m_BssId;
182  }
183  void SetApplicationDataSize(uint32_t dataSize)
184  {
185  m_ApplicationDataSize = dataSize;
186  }
187  LdnStationInfo* GetStationInfoArray()
188  {
189  return m_LdnStationInfoArray;
190  }
191 
192  //! @endcond
193 
194 private:
195  LdnNetworkDescription m_LdnNetworkDescription;
196  LdnStationInfo m_LdnStationInfoArray[StationMaxEntry];
197 
198  uint8_t m_BssId[local::BssIdSize];
199  uint32_t m_GameMode;
200  uint32_t m_SessionId;
201  uint16_t m_CurrentParticipantNum;
202  uint16_t m_MaxParticipantNum;
203  uint8_t m_ApplicationData[LdnBeaconApplicationDataSizeMax];
204  uint32_t m_ApplicationDataSize;
205  bool m_IsOpened;
206 };
207 }
208 }
209 } // end of namespace nn::pia::local
210 #endif