Tizen 2.1 base
[platform/framework/native/telephony.git] / src / FTel_NetworkManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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    FTel_NetworkManagerImpl.h
19  * @brief   This is the header file for the _NetworkManagerImpl class.
20  *
21  * This header file contains the declaration of the _NetworkManagerImpl class.
22  */
23 #ifndef _FTEL_INTERNAL_NETWORK_MANAGER_IMPL_H_
24 #define _FTEL_INTERNAL_NETWORK_MANAGER_IMPL_H_
25
26 #include <unique_ptr.h>
27 #include <net_connection.h>
28 #include <telephony_network_type.h>
29 #include <FBaseObject.h>
30 #include "FTel_TelephonyUtility.h"
31
32
33 namespace Tizen { namespace Base
34 {
35 class String;
36
37 namespace Collection
38 {
39 class IList;
40 }}}
41
42 namespace Tizen { namespace Telephony
43 {
44 class ITelephonyNetworkEventListener;
45 class ITelephonyNetworkSettingListener;
46 class NetworkInfo;
47 class NetworkStatus;
48 class NetworkManager;
49 class _NetworkManagerEvent;
50 class _NetworkSettingEvent;
51 class _TelephonyIpcProxy;
52
53 class _NetworkManagerImpl
54         : public Tizen::Base::Object
55 {
56         /**
57      * @enum _NetworkEventType
58      * Defines the network event type.
59      */
60         enum _NetworkEventType
61         {
62             _NETWORK_EVENT_CALL,
63             _NETWORK_EVENT_DATA,
64             _NETWORK_EVENT_ROAMING
65         };
66
67 public:
68         /**
69      *  This is the default constructor for this class.
70      *
71      * @since 2.1
72      */
73         _NetworkManagerImpl(void);
74
75         /**
76      *  This is the destructor for this class.
77      *
78      * @since 2.1
79      */
80         virtual ~_NetworkManagerImpl(void);
81
82         /**
83      * @see NetworkManager::Construct()
84      */
85         result Construct(ITelephonyNetworkEventListener* pListener);
86
87         /**
88      * @see NetworkManager::GetNetworkStatus()
89      */
90         result GetNetworkStatus(NetworkStatus& networkStatus) const;
91
92         /**
93      * @see NetworkManager::GetNetworkInfo()
94      */
95         result GetNetworkInfo(NetworkInfo& networkInfo) const;
96
97     /**
98      * @see NetworkManager::SetNetworkSettingListener()
99      */
100     result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener);
101
102     /**
103      * @see NetworkManager::GetNetworkSelectionMode()
104      */
105     result GetNetworkSelectionMode(void);
106
107     /**
108      * @see NetworkManager::SelectNetwork()
109      */
110     result SelectNetwork(const NetworkInfo& networkInfo);
111
112     /**
113      * @see NetworkManager::SelectNetwork()
114      */
115     result SelectNetwork(void);
116
117     /**
118      * @see NetworkManager::SearchNetwork()
119      */
120     result SearchNetwork(void);
121
122
123     void OnTelephonyNetworkSelectionModeReceived(bool isManual, result r);
124
125     void OnTelephonyNetworkSelectionCompleted(result r);
126
127     void OnTelephonyNetworkSearchCompleted(Tizen::Base::String message, result r);
128
129
130     /**
131      * Checks the network state of the telephony service.
132      */
133         static bool IsServiceAvailable(bool checkEmergency = false);
134
135         /**
136      * Checks the enabled state of flight mode.
137      */
138         static bool IsNetworkAvailable(void);
139
140         /**
141      * Called when the state of data service is changed.
142      *
143      * @param[in] type      The type of current network connection
144      * @param[in] pUserData The user data passed from the callback registration function
145      */
146         static void OnDataServiceStateChangedCallback(connection_type_e type, void* pUserData);
147
148         /**
149      * Called when the state of call service is changed.
150      *
151      * @param[in] serviceState  The state of telephony service
152      * @param[in] pUserData      The user data passed from the callback registration function
153      */
154         static void OnCallServiceStateChangedCallback(network_info_service_state_e serviceState, void* pUserData);
155
156     /**
157      * Called when the state of roaming is changed.
158      *
159      * @param[in] isRoaming The roaming state
160      * @param[in] pUserData  The user data passed from the callback registration function
161      */
162         static void OnRoamingStateChangedCallback(bool isRoaming, void* pUserData);
163
164         /**
165      * Gets the Impl instance.
166      *
167      * @since 2.1
168      * @return The pointer to _NetworkManagerImpl
169      * @param[in] networkManager   An instance of NetworkManager
170      */
171         static _NetworkManagerImpl* GetInstance(NetworkManager& networkManager);
172
173         /**
174      * Gets the Impl instance.
175      *
176      * @since 2.1
177      * @return The pointer to _NetworkManagerImpl
178      * @param[in] networkManager   An instance of NetworkManager
179      */
180         static const _NetworkManagerImpl* GetInstance(const NetworkManager& networkManager);
181
182
183 private:
184         /**
185      * This is the copy constructor for the %_NetworkManagerImpl class.
186      *
187      * @param[in]   rhs   An instance of %_NetworkManagerImpl
188      */
189         _NetworkManagerImpl(const _NetworkManagerImpl& rhs);
190
191         /**
192      * Gets the string of network event type.
193      *
194      * @param[in]   type    The value of _NetworkEventType
195      */
196         const char* GetStringOfNetworkEventType(_NetworkEventType type) const;
197
198         /**
199      * Notifies when the status of the telephony network is changed.
200      */
201         void OnTelephonyNetworkStatusChanged(_NetworkEventType type, bool data);
202
203
204         Tizen::Base::Collection::IList* ParsingMessageN(const Tizen::Base::String& message);
205
206         NetworkInfo* GenerateNetworkInfoN(const Tizen::Base::String& message, int& currentIndex);
207
208         Tizen::Base::String MessageToString(const Tizen::Base::String& message, int& currentIndex);
209
210         Tizen::Base::String MessageWithLengthToString(const Tizen::Base::String& message, int& currentIndex);
211
212         /**
213      * This is the assignment operator.
214      * Do @b not use directly.
215      *
216      * @param[in]   rhs An instance of %_NetworkManagerImpl
217      */
218         _NetworkManagerImpl& operator =(const _NetworkManagerImpl& rhs);
219
220 private:
221         std::unique_ptr<void, _ConnectionDeleter> __pConnectionHandle;
222         std::unique_ptr<_NetworkManagerEvent> __pNetworkManagerEvent;
223         std::unique_ptr<_NetworkSettingEvent> __pNetworkSettingEvent;
224     _TelephonyIpcProxy* __pTelephonyServiceProxy;
225     ITelephonyNetworkSettingListener* __pSettingListener;
226
227 }; // _NetworkManagerImpl
228
229 }} // Tizen::Telephony
230 #endif // _FTEL_INTERNAL_NETWORK_MANAGER_IMPL_H_