Merge from 2.2
[platform/framework/native/telephony.git] / inc / FTelNetworkStatus.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        FTelNetworkStatus.h
19  * @brief       This is the header file for the %NetworkStatus class.
20  *
21  * This header file contains the declarations of the %NetworkStatus class.
22  */
23 #ifndef _FTEL_NETWORK_STATUS_H_
24 #define _FTEL_NETWORK_STATUS_H_
25
26 #include <FBase.h>
27
28 namespace Tizen { namespace Telephony
29 {
30 class _NetworkStatusImpl;
31
32 /**
33  * @class       NetworkStatus`
34  * @brief       This class provides the status information of the current network.
35  *
36  * @since       2.0
37  *
38  * The %NetworkStatus class provides methods to obtain the status information of the current network, such as the roaming status, whether the call service is available or not, 
39  * and whether the data service is available or not.
40  *
41  * The following example demonstrates how to use the %NetworkStatus class to obtain the network status information.
42  *
43  * @code
44  *
45  *  #include <FBase.h>
46  *  #include <FTelephony.h>
47  *
48  *   using namespace Tizen::Base;
49  *   using namespace Tizen::Telephony;
50  *
51  *   class MyClass
52  *       : public Object
53  *       , public ITelephonyNetworkEventListener
54  *   {
55  *     public:
56  *       MyClass(void) {}
57  *       ~MyClass(void) {}
58  *
59  *       // ITelephonyNetworkEventListener
60  *       void OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus);
61  *
62  *       void GetNetworkStatus (void);
63  *   };
64  *   void
65  *   MyClass::OnTelephonyNetworkStatusChanged(const NetworkStatus& networkStatus)
66  *   {
67  *      //Do something.
68  *   }
69  *
70  *   void
71  *   MyClass::GetNetworkStatus(void)
72  *   {
73  *       NetworkStatus networkStatus;
74  *
75  *       NetworkManager* pNetworkManager = new (std::nothrow) NetworkManager();
76  *       result r = pNetworkManager->Construct(this);
77  *       if (IsFailed(r))
78  *       {
79  *               delete pNetworkManager;
80  *               return;
81  *       }
82  *
83  *       r = pNetworkManager->GetNetworkStatus(networkStatus);
84  *       if (IsFailed(r))
85  *       {
86  *               delete pNetworkManager;
87  *               return;
88  *       }
89  *
90  *       bool isCallAvailable = networkStatus.IsCallServiceAvailable();
91  *       bool isDataAvailable = networkStatus.IsDataServiceAvailable();
92  *       bool isRoaming = networkStatus.IsRoaming();
93  *
94  *       delete pNetworkManager;
95  *       return;
96  *   }
97  *
98  * @endcode
99  */
100 class _OSP_EXPORT_ NetworkStatus
101         : public Tizen::Base::Object
102 {
103 public:
104         /**
105      * This is the default constructor for this class.
106      *
107      * @since   2.0
108      */
109         NetworkStatus(void);
110
111         /**
112      * This destructor overrides Tizen::Base::Object::~Object().
113      *
114      * @since   2.0
115      */
116         virtual ~NetworkStatus(void);
117
118         /**
119      * Checks whether the current network is in the roaming status or not.
120      *
121      * @since   2.0
122          *
123          * @privlevel   public
124      * @privilege   %http://tizen.org/privilege/telephony @n
125      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
126      *
127      * @return          @c true if the current network is in the roaming status, @n
128      *              else @c false
129      * @exception       E_SUCCESS                       The method is successful.
130      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
131      * @remarks         The specific error code can be accessed using the GetLastResult() method.
132      */
133         bool IsRoaming(void) const;
134
135     /**
136      * Checks whether the call service is available or not.
137      *
138      * @since   2.0
139          *
140          * @privlevel   public
141      * @privilege   %http://tizen.org/privilege/telephony @n
142      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
143      *
144      * @return          @c true if the call service is available, @n
145      *                  else @c false
146      * @exception       E_SUCCESS                       The method is successful.
147      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
148      * @remarks         The specific error code can be accessed using the GetLastResult() method.
149      */
150         bool IsCallServiceAvailable(void) const;
151
152         /**
153      * Checks whether the data service is available or not.
154      *
155      * @since   2.0
156          *
157          * @privlevel   public
158      * @privilege   %http://tizen.org/privilege/telephony @n
159      *                          (%http://tizen.org/privilege/systeminfo is deprecated.)
160      *
161      * @return          @c true if the data service is available, @n
162      *                  else @c false
163      * @exception       E_SUCCESS       The method is successful.
164      * @exception       E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
165      * @remarks         The specific error code can be accessed using the GetLastResult() method.
166      */
167         bool IsDataServiceAvailable(void) const;
168
169 private:
170         /**
171      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
172      *
173      * @param[in]       rhs     An instance of %NetworkStatus
174      */
175         NetworkStatus(const NetworkStatus& rhs);
176
177         /**
178      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
179      *
180      * @param[in]       rhs     An instance of %NetworkStatus
181      */
182         NetworkStatus& operator =(const NetworkStatus& rhs);
183
184 private:
185         _NetworkStatusImpl* __pNetworkStatusImpl;
186
187         friend class _NetworkStatusImpl;
188 }; // NetworkStatus
189
190 }} // Tizen::Telephony
191 #endif // _FTEL_NETWORK_STATUS_H_