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