Add '-D_SECURE_LOG'
[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 public:
57         /**
58      *  This is the default constructor for this class.
59      *
60      * @since 2.1
61      */
62         _NetworkManagerImpl(void);
63
64         /**
65      *  This is the destructor for this class.
66      *
67      * @since 2.1
68      */
69         virtual ~_NetworkManagerImpl(void);
70
71         /**
72      * @see NetworkManager::Construct()
73      */
74         result Construct(ITelephonyNetworkEventListener* pListener);
75
76         /**
77      * @see NetworkManager::GetNetworkStatus()
78      */
79         result GetNetworkStatus(NetworkStatus& networkStatus) const;
80
81         /**
82      * @see NetworkManager::GetNetworkInfo()
83      */
84         result GetNetworkInfo(NetworkInfo& networkInfo) const;
85
86     /**
87      * @see NetworkManager::SetNetworkSettingListener()
88      */
89     result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener);
90
91     /**
92      * @see NetworkManager::GetNetworkSelectionMode()
93      */
94     result GetNetworkSelectionMode(void);
95
96     /**
97      * @see NetworkManager::SelectNetwork()
98      */
99     result SelectNetwork(const NetworkInfo& networkInfo);
100
101     /**
102      * @see NetworkManager::SelectNetwork()
103      */
104     result SelectNetwork(void);
105
106     /**
107      * @see NetworkManager::SearchNetwork()
108      */
109     result SearchNetwork(void);
110
111
112     void OnTelephonyNetworkSelectionModeReceived(bool isManual, result r);
113
114     void OnTelephonyNetworkSelectionCompleted(result r);
115
116     void OnTelephonyNetworkSearchCompleted(Tizen::Base::String message, result r);
117
118     /**
119      * Checks the network state of the data network service.
120      */
121         bool IsDataAvailable(void);
122
123     /**
124      * Checks the data roaming is on or off.
125      */
126         bool IsRoaming(void);
127
128     /**
129      * Checks the network state of the telephony service.
130      */
131         static bool IsServiceAvailable(bool checkEmergency = false);
132
133         /**
134      * Checks the enabled state of flight mode.
135      */
136         static bool IsNetworkAvailable(void);
137
138         /**
139      * Called when the state of data service is changed.
140      *
141      * @param[in] type      The type of current network connection
142      * @param[in] pUserData The user data passed from the callback registration function
143      */
144         static void OnDataServiceStateChangedCallback(connection_type_e type, void* pUserData);
145
146         /**
147      * Called when the state of call service is changed.
148      *
149      * @param[in] serviceState  The state of telephony service
150      * @param[in] pUserData      The user data passed from the callback registration function
151      */
152         static void OnCallServiceStateChangedCallback(network_info_service_state_e serviceState, void* pUserData);
153
154     /**
155      * Called when the state of roaming is changed.
156      *
157      * @param[in] isRoaming The roaming state
158      * @param[in] pUserData  The user data passed from the callback registration function
159      */
160         static void OnRoamingStateChangedCallback(bool isRoaming, void* pUserData);
161
162         /**
163      * Gets the Impl instance.
164      *
165      * @since 2.1
166      * @return The pointer to _NetworkManagerImpl
167      * @param[in] networkManager   An instance of NetworkManager
168      */
169         static _NetworkManagerImpl* GetInstance(NetworkManager& networkManager);
170
171         /**
172      * Gets the Impl instance.
173      *
174      * @since 2.1
175      * @return The pointer to _NetworkManagerImpl
176      * @param[in] networkManager   An instance of NetworkManager
177      */
178         static const _NetworkManagerImpl* GetInstance(const NetworkManager& networkManager);
179
180
181 private:
182         /**
183      * This is the copy constructor for the %_NetworkManagerImpl class.
184      *
185      * @param[in]   rhs   An instance of %_NetworkManagerImpl
186      */
187         _NetworkManagerImpl(const _NetworkManagerImpl& rhs);
188
189         void OnTelephonyNetworkStatusChanged(void);
190
191         Tizen::Base::Collection::IList* ParsingMessageN(const Tizen::Base::String& message);
192
193         NetworkInfo* GenerateNetworkInfoN(const Tizen::Base::String& message, int& currentIndex);
194
195         Tizen::Base::String MessageToString(const Tizen::Base::String& message, int& currentIndex);
196
197         Tizen::Base::String MessageWithLengthToString(const Tizen::Base::String& message, int& currentIndex);
198
199         /**
200      * This is the assignment operator.
201      * Do @b not use directly.
202      *
203      * @param[in]   rhs An instance of %_NetworkManagerImpl
204      */
205         _NetworkManagerImpl& operator =(const _NetworkManagerImpl& rhs);
206
207 private:
208         std::unique_ptr<void, _ConnectionDeleter> __pConnectionHandle;
209         std::unique_ptr<_NetworkManagerEvent> __pNetworkManagerEvent;
210         std::unique_ptr<_NetworkSettingEvent> __pNetworkSettingEvent;
211     _TelephonyIpcProxy* __pTelephonyServiceProxy;
212     ITelephonyNetworkSettingListener* __pSettingListener;
213
214         bool __isCallServiceAvailable;
215         bool __isDataServiceAvailable;
216         bool __isRoaming;
217
218 }; // _NetworkManagerImpl
219
220 }} // Tizen::Telephony
221 #endif // _FTEL_INTERNAL_NETWORK_MANAGER_IMPL_H_