2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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
9 // http://floralicense.org/license/
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.
19 * @file FNetINetConnectionEventListener.h
20 * @brief This is the header file for the %INetConnectionEventListener interface.
22 * This header file contains the declarations of the %INetConnectionEventListener interface.
25 #ifndef _FNET_INET_CONNECTION_EVENT_LISTENER_H_
26 #define _FNET_INET_CONNECTION_EVENT_LISTENER_H_
28 #include <FBaseRtIEventListener.h>
30 namespace Tizen { namespace Net
35 * @interface INetConnectionEventListener
36 * @brief This interface implements the listeners for the network connection events.
40 * The %INetConnectionEventListener interface specifies the methods for creating the notifications about the different kinds of network
41 * connection events. These events are only sent when %INetConnectionEventListener is added to a NetConnection instance, by invoking the
42 * NetConnection::AddNetConnectionListener() method. When a network connection event is generated, a method of this class is called.
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/net/managing_network_connections.htm">Managing Network Connections</a>.
46 * The following example demonstrates how to use the %INetConnectionEventListener interface.
49 using namespace Tizen::Net;
50 using namespace Tizen::Base;
54 , public virtual INetConnectionEventListener
61 void OnNetConnectionStarted(NetConnection& netConnection, result r)
63 AppLog("OnStarted\n");
66 void OnNetConnectionStopped(NetConnection& netConnection, result r)
68 AppLog("OnStopped\n");
71 void OnNetConnectionSuspended(NetConnection& netConnection)
73 AppLog("OnSuspended\n");
76 void OnNetConnectionResumed(NetConnection& netConnection)
78 AppLog("OnResumed\n");
83 class _OSP_EXPORT_ INetConnectionEventListener
84 : virtual public Tizen::Base::Runtime::IEventListener
88 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
92 virtual ~INetConnectionEventListener(void) {}
96 * Called to notify the application that the network connection has been opened and connected. @n
97 * An application can send or receive the data.
101 * @param[in] netConnection The network connection
102 * @param[in] r An error code
103 * @exception E_SUCCESS The method is successful.
104 * @exception E_TIMEOUT An attempt to connect to the server has timed out.
105 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
106 * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card.
107 * @exception E_NETWORK_UNAVAILABLE The operation has failed because the device is in the offline mode.
108 * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode.
109 * @exception E_RESOURCE_UNAVAILABLE The network resource is unavailable.
110 * @exception E_AUTHENTICATION The authentication has failed.
111 * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
112 * @exception E_SYSTEM A system error has occurred.
113 * @exception E_NETWORK_FAILED Requested but an error is received from the network.
114 * @exception E_INVALID_SIM_STATE The network has marked SIM as invalid for the CS and/or PS domain.
115 * @exception E_FDN_MODE The FDN is enabled and the number is not listed in the FDN list.
116 * @exception E_DHCP The DHCP operation has failed on WLAN.
117 * @exception E_LINK A link failure has occurred on WLAN.
119 virtual void OnNetConnectionStarted(NetConnection& netConnection, result r) = 0;
122 * Called to notify the application that the network connection has been closed and disconnected.
126 * @param[in] netConnection The network connection
127 * @param[in] r An error code
128 * @exception E_SUCCESS The method is successful.
129 * @exception E_NETWORK_UNAVAILABLE The operation has failed because the device is in the offline mode.
130 * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode.
131 * @exception E_RESOURCE_UNAVAILABLE The network resource is unavailable.
132 * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
133 * @exception E_SYSTEM A system error has occurred.
134 * @exception E_NETWORK_FAILED Requested but an error is received from the network.
135 * @exception E_INVALID_SIM_STATE The network has marked SIM as invalid for the CS and/or PS domain.
136 * @exception E_FDN_MODE The FDN is enabled and the number is not listed in the FDN list.
137 * @exception E_DHCP The DHCP operation has failed on WLAN.
138 * @exception E_LINK A link failure has occurred on WLAN.
139 * @remarks This notification does not imply that the network is stopped permanently and cannot be used.
140 * The network can be restarted using NetConnection::Start().
141 * The NetConnection::Close() method is used to disconnect the connection
142 * from the remote server or gateway permanently.
144 virtual void OnNetConnectionStopped(NetConnection& netConnection, result r) = 0;
147 * Called to notify the application that the connection status has changed or is in an unstable or suspended state. @n
148 * Thus, an application may neither send nor receive data through Socket or Http until the network connection is resumed.
152 * @param[in] netConnection The network connection
155 virtual void OnNetConnectionSuspended(NetConnection& netConnection) = 0;
158 * Called to notify the application that the network has recovered from a suspended state. @n
159 * Thus, an application can send or receive data through Socket or Http from now on.
163 * @param[in] netConnection The network connection
165 virtual void OnNetConnectionResumed(NetConnection& netConnection) = 0;
169 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
171 // This method is reserved and may change its name at any time without prior notice.
175 virtual void INetConnectionEventListener_Reserved1(void) {}
178 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
180 // This method is reserved and may change its name at any time without prior notice.
184 virtual void INetConnectionEventListener_Reserved2(void) {}
185 }; // INetConnectionEventListener
188 #endif // _FNET_INET_CONNECTION_EVENT_LISTENER_H_