Nintendo 3DS Miiverse Library  1.3.2
(OLV/Olive)
olv_TypesConnect.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*
2 Project: OLV
3 File: olv_TypesConnect.h
4 
5 Copyright (C) 2009-2013 Nintendo. 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  *---------------------------------------------------------------------------*/
14 #ifndef __OLV_TYPES_CONNECT_H_
15 #define __OLV_TYPES_CONNECT_H_
16 
17 /*! @file
18 @brief Declaration of types related to OLV connections.
19 */
20 
21 #include <nn/config.h>
22 #include <nn/types.h>
23 #include <nn/act.h>
24 #include <nn/olv/olv_Const.h>
25 
26 /// <span>nn</span>
27 namespace nn {
28 
29 /// <span>olv</span>
30 namespace olv {
31 
32 namespace internal
33 {
34 class Main;
35 }
36 
37 /*/* @defgroup class Classes
38  * @{
39  */
40 
41 /*!
42 @brief Represents the parameters when connecting.
43 */
45 {
46 public:
47  /*!
48 @brief Instantiates the object.
49  */
50  ConnectParam();
51 
52  /*!
53 @brief Reverts parameters to their initial state.
54  */
55  void Reset();
56 
57  /*!
58 @brief Sets the Miiverse service token.
59 
60 You must specify this option.
61 
62 @param[in] serviceToken The Miiverse service token. <br />
63 The maximum number of characters that can be specified is <tt>NN_ACT_INDEPENDENT_SERVICE_TOKEN_SIZE - 1</tt>.
64  */
65  void SetServiceToken(const char* serviceToken);
66 
67  /*!
68 @brief Sets flags.
69 
70 This is for future expansion. It is not used currently.
71 
72 @param[in] flags Flags (<tt>FLAG_*</tt>).
73  */
74  void SetFlags(u32 flags);
75 
76 protected:
77  u32 m_Flags;
78  char m_ServiceToken[NN_ACT_INDEPENDENT_SERVICE_TOKEN_SIZE];
79  NN_PADDING3;
80  u8 m_Reserved[768-520];
81 
82  friend class nn::olv::internal::Main;
83 };
84 
85 /*!
86 @brief A class that stores the connection results.
87 */
89 {
90 public:
91  /*!
92 @brief Instantiates the object.
93  */
94  ConnectedData();
95 
96  /*!
97 @brief Reverts parameters to their initial state.
98  */
99  void Reset();
100 
101  /*!
102 @brief Tests flags.
103 
104 This is for future expansion. It is not used currently.
105 
106 @param[in] flags Flags (<tt>FLAG_*</tt>).
107 
108 @return Returns <tt>true</tt> if any of the flags are set; returns <tt>false</tt> otherwise.
109  */
110  bool TestFlags(u32 flags) const;
111 
112  /*!
113 @brief Gets the hostname.
114 
115 Note that specifying invalid arguments for this function, such as the following, results in an assert in debug/development versions and the function returning without doing anything in release versions. <br />
116 - If <tt>NULL</tt> is specified for the <span class="argument">hostName</span> argument.
117 - If a value less than that of <tt>nn::olv::HOST_NAME_BUFF_LENGTH</tt> is specified for the <span class="argument">hostNameMaxLength</span> argument.
118 
119 @param[out] hostName The buffer that stores the hostname.
120 @param[in] hostNameMaxLength The length of the buffer that stores the hostname, including the terminating null character. <br />
121 Make sure that you specify a size of at least <tt>@ref nn::olv::HOST_NAME_BUFF_LENGTH</tt>.
122  */
123  void GetHostName(char* hostName, u32 hostNameMaxLength) const;
124 
125 protected:
126  u32 m_Flags;
127  char m_ApiHostName[HOST_NAME_BUFF_LENGTH];
128  u8 m_Reserved[512-260];
129 
130  friend class nn::olv::internal::Main;
131 };
132 
133 /** @} */
134 
135 } // namespace olv
136 } // namespace nn
137 
138 #endif