Return an error when an initialization has failed.
[platform/framework/native/net.git] / src / FNet_NetAccountManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file                FNet_NetAccountManagerImpl.cpp
19  * @brief               This is the implementation for the %_NetAccountManagerImpl class.
20  */
21
22 #ifndef _FNET_INTERNAL_NET_ACCOUNT_MANAGER_IMPL_H_
23 #define _FNET_INTERNAL_NET_ACCOUNT_MANAGER_IMPL_H_
24
25 #include <FBaseDataType.h>
26 #include <FBaseObject.h>
27 #include <FBaseString.h>
28 #include <FNetNetTypes.h>
29 #include "FNet_NetUtility.h"
30
31 namespace Tizen { namespace Base { namespace Collection
32 {
33 class IList;
34 } } } // Tizen::Base::Collection
35
36 namespace Tizen { namespace Net
37 {
38 class NetAccountInfo;
39 class NetAccountManager;
40 class _PsSystemNetConnection;
41
42 class _NetProfileInfo
43         : public Tizen::Base::Object
44 {
45 public:
46         _NetProfileInfo(void);
47         _NetProfileInfo(const Tizen::Base::String& profileName, const Tizen::Base::String& profileDisplayName);
48         ~_NetProfileInfo(void);
49
50         Tizen::Base::String GetProfileName(void) const;
51         Tizen::Base::String GetProfileDisplayName(void) const;
52
53 private:
54         Tizen::Base::String __profileName;
55         Tizen::Base::String __profileDisplayName;
56 }; // _NetProfileInfo
57
58 class _NetAccountManagerImpl
59         : public Tizen::Base::Object
60 {
61 public :
62         /**
63          * This is the default constructor for this class.
64          *
65          * @remarks             After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
66          * @see                 Construct()
67          */
68         _NetAccountManagerImpl(void);
69
70         /**
71          * This is the destructor for this class.
72          */
73         ~_NetAccountManagerImpl(void);
74
75         /**
76          * @see                 NetAccountManager::Construct()
77          */
78         result Construct(void);
79
80         /**
81          * @see                 NetAccountManager::CreateNetAccount()
82          */
83         NetAccountId CreateNetAccount(NetAccountInfo& netAccountInfo);
84
85         /**
86          * @see                 NetAccountManager::DeleteNetAccount()
87          */
88         result DeleteNetAccount(NetAccountId netAccountId);
89
90         /**
91          * @see                 NetAccountManager::UpdateNetAccount()
92          */
93         result UpdateNetAccount(const NetAccountInfo& netAccountInfo);
94
95         /**
96          * @see                 NetAccountManager::GetNetAccountId()
97          */
98         NetAccountId GetNetAccountId(const Tizen::Base::String& netAccountName) const;
99
100         /**
101          * @see                 NetAccountManager::GetNetAccountId()
102          */
103         NetAccountId GetNetAccountId(NetBearerType netBearerType) const;
104
105         /**
106          * @see                 NetAccountManager::GetNetAccountInfoN()
107          */
108         NetAccountInfo* GetNetAccountInfoN(NetAccountId netAccountId) const;
109
110         /**
111          * @see                 NetAccountManager::GetNetAccountIdsN()
112          */
113         Tizen::Base::Collection::IListT<NetAccountId>* GetNetAccountIdsN(void) const;
114
115         /**
116          * @see                 NetAccountManager::GetNetAccountNamesN()
117          */
118         Tizen::Base::Collection::IList* GetNetAccountNamesN(void) const;
119
120         /**
121          * @see                 NetAccountManager::GetNetPreference()
122          */
123         NetPreferenceType GetNetPreference(void) const;
124
125         /**
126          * @see                 NetAccountManager::SetNetPreference()
127          */
128         result SetNetPreference(NetPreferenceType netPreference);
129
130 public:
131     /**
132      * Gets the Impl instance.
133      *
134      * @since 2.1
135      * @return              The pointer to _NetAccountManagerImpl
136      * @param[in]   netAccountManager            An instance of NetAccountManager
137      */
138         static _NetAccountManagerImpl* GetInstance(NetAccountManager& netAccountManager);
139
140     /**
141      * Gets the Impl instance.
142      *
143      * @since 2.1
144      * @return              The pointer to  _NetAccountManagerImpl
145      * @param[in]   netAccountManager     An instance of NetAccountManager
146      */
147         static const _NetAccountManagerImpl* GetInstance(const NetAccountManager& netAccountManager);
148
149 public:
150         static void* GetPsProfileHandleN(const Tizen::Base::String& profileName);
151         static void* GetWifiProfileHandleN(void);
152         static _NetProfileInfo GetInternetProfileInfo(void);
153         static _NetProfileInfo GetMmsProfileInfo(void);
154         static Tizen::Base::Collection::IList* GetAppProfileNamesN(void);
155         static Tizen::Base::Collection::IList* GetAllProfileInfosN(void);
156         static NetAccountInfo* CreateWifiNetAccountInfoN(void* pProfileInfo);
157
158 private:
159         /**
160          * This is the copy constructor for this class. @n
161          * Do @b not use directly.
162          *
163          * @param[in]   rhs                     An instance of _NetAccountManagerImpl
164          */
165         _NetAccountManagerImpl(const _NetAccountManagerImpl& rhs);
166
167         /**
168          * This is the assignment operator. Do @b not use directly.
169          *
170          * @param[in]   rhs                     An instance of _NetAccountManagerImpl
171          */
172         _NetAccountManagerImpl& operator =(const _NetAccountManagerImpl& rhs);
173
174 private:
175         std::unique_ptr<void, _ConnectionDeleter> __pConnectionHandle;
176
177         friend class NetAccountManager;
178
179 }; // _NetAccountManagerImpl
180
181 }  }  // Tizen::Net
182
183 #endif // _FNET_INTERNAL_NET_ACCOUNT_MANAGER_IMPL_H_