2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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 FNetBtBluetoothSppAcceptor.h
20 * @brief This is the header file for the %BluetoothSppAcceptor class.
22 * This header file contains the declarations of the %BluetoothSppAcceptor class.
24 #ifndef _FNET_BT_BLUETOOTH_SPP_ACCEPTOR_H_
25 #define _FNET_BT_BLUETOOTH_SPP_ACCEPTOR_H_
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FBaseUuId.h>
30 #include <FNetBtBluetoothTypes.h>
32 namespace Tizen { namespace Base
37 namespace Tizen { namespace Net { namespace Bluetooth
40 // forward declarations
41 class IBluetoothSppAcceptorEventListener;
42 class _BluetoothSppAcceptorImpl;
45 * @class BluetoothSppAcceptor
46 * @brief This class provides the methods to handle the %Bluetooth Serial Port Profile (SPP) acceptor, such as an
47 * incoming connection request.
50 * The %BluetoothSppAcceptor class provides the methods to handle the %Bluetooth Serial Port Profile (SPP) acceptor, such as an
51 * incoming connection request.
53 * For more information on the class features, see
54 * <a href="../org.tizen.native.appprogramming/html/guide/net/bluetooth_namespace.htm">Bluetooth Guide</a>.
56 class _OSP_EXPORT_ BluetoothSppAcceptor
57 : public Tizen::Base::Object
61 * The object is not fully constructed after this constructor is called. For full construction, the Construct()
62 * method must be called right after calling this constructor.
66 BluetoothSppAcceptor(void);
69 * This destructor overrides Tizen::Base::Object::~Object().
73 virtual ~BluetoothSppAcceptor(void);
76 * Initializes this instance of %BluetoothSppAcceptor with the specified listener.
79 * @feature %http://tizen.org/feature/network.bluetooth
81 * @return An error code
82 * @param[in] listener The event listener for SPP acceptor
83 * @exception E_SUCCESS The method is successful.
84 * @exception E_OUT_OF_MEMORY The memory is insufficient.
85 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
86 * For more information, see
87 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
88 * Application Filtering</a>.
89 * @exception E_SYSTEM A system error has occurred.
90 * @remarks Before calling this method, check whether the feature is supported by
91 * Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
93 result Construct(IBluetoothSppAcceptorEventListener& listener);
96 * Accepts a connection request from a remote SPP initiator. @n
97 * The %AcceptConnection() method establishes a connection.
101 * @privilege %http://tizen.org/privilege/bluetooth.spp
103 * @return An error code
104 * @exception E_SUCCESS The method is successful.
105 * @exception E_INVALID_STATE This instance is in an invalid state. @n
106 * For example, this instance has not been constructed as yet or %Bluetooth is
108 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
110 * For example, the service is not started yet or the connection request is
111 * not yet received from a remote device.
112 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
113 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
114 * @exception E_FAILURE The method has failed.
115 * @see IBluetoothSppInitiatorEventListener::OnSppConnectionResponded()
117 result AcceptConnection(void);
120 * Rejects a connection request from a remote SPP initiator.
124 * @privilege %http://tizen.org/privilege/bluetooth.spp
126 * @return An error code
127 * @exception E_SUCCESS The method is successful.
128 * @exception E_INVALID_STATE This instance is in an invalid state. @n
129 * For example, this instance has not been constructed as yet or %Bluetooth is
131 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
133 * For example, the service is not started yet or the connection request is
134 * not yet received from a remote device.
135 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
136 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
137 * @exception E_FAILURE The method has failed.
138 * @see IBluetoothSppInitiatorEventListener::OnSppConnectionResponded()
140 result RejectConnection(void);
143 * Starts the SPP service with the default service UUID - BT_SVC_UUID_SPP.
147 * @privilege %http://tizen.org/privilege/bluetooth.spp
149 * @return An error code
150 * @exception E_SUCCESS The method is successful.
151 * @exception E_INVALID_STATE This instance is in an invalid state. @n
152 * For example, this instance has not been constructed as yet or %Bluetooth is
154 * @exception E_IN_PROGRESS The service has already started.
155 * @exception E_ALREADY_CONNECTED The connection with an SPP initiator has already been established.
156 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
157 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
158 * @exception E_SERVICE_UNAVAILABLE The SPP service with the specified UUId is unavailable.
159 * @exception E_FAILURE The method has failed.
161 result StartService(void);
164 * Starts the SPP service with the specified service UUID.
168 * @privilege %http://tizen.org/privilege/bluetooth.spp
170 * @return An error code
171 * @param[in] serviceUuid The UUID of SPP service
172 * @exception E_SUCCESS The method is successful.
173 * @exception E_INVALID_STATE This instance is in an invalid state. @n
174 * For example, this instance has not been constructed as yet or %Bluetooth is
176 * @exception E_INVALID_ARG The specified input parameter is invalid.
177 * @exception E_IN_PROGRESS The service has already started.
178 * @exception E_ALREADY_CONNECTED The connection with an SPP initiator has already been established.
179 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
180 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
181 * @exception E_SERVICE_UNAVAILABLE The SPP service with the specified UUId is unavailable.
182 * @exception E_FAILURE The method has failed.
184 result StartService(const Tizen::Base::UuId& serviceUuid);
187 * Stops the SPP service. @n
188 * The %StopService() method disconnects the current connection before stopping the service.
192 * @privilege %http://tizen.org/privilege/bluetooth.spp
194 * @return An error code
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_INVALID_STATE This instance is in an invalid state. @n
197 * For example, this instance has not been constructed as yet or %Bluetooth is
199 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
201 * For example, the service is not started yet.
202 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
203 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
204 * @exception E_FAILURE The method has failed.
206 result StopService(void);
209 * Disconnects the current connection.
213 * @privilege %http://tizen.org/privilege/bluetooth.spp
215 * @return An error code
216 * @exception E_SUCCESS The method is successful.
217 * @exception E_INVALID_STATE This instance is in an invalid state. @n
218 * For example, this instance has not been constructed as yet or %Bluetooth is
220 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
222 * For example, the service is not started yet or a connection with a remote
223 * device is not established.
224 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
225 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
226 * @exception E_FAILURE The method has failed.
227 * @see IBluetoothSppAcceptorEventListener::OnSppDisconnected()
228 * @see IBluetoothSppInitiatorEventListener::OnSppDisconnected()
230 result Disconnect(void);
237 * @privilege %http://tizen.org/privilege/bluetooth.spp
239 * @return An error code
240 * @param[in] buffer The data to send @n
241 * The size of the buffer should not exceed @c 1000 bytes.
242 * @exception E_SUCCESS The method is successful.
243 * @exception E_INVALID_STATE This instance is in an invalid state. @n
244 * For example, this instance has not been constructed as yet or %Bluetooth is
246 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
248 * For example, the service is not started yet or a connection with a remote
249 * device is not established.
250 * @exception E_INVALID_ARG The specified @c buffer is empty.
251 * @exception E_SYSTEM A system error has occurred.
252 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
253 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
254 * @exception E_FAILURE The method has failed.
255 * @see IBluetoothSppInitiatorEventListener::OnSppDataReceived()
257 result SendData(const Tizen::Base::ByteBuffer& buffer);
261 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying
264 BluetoothSppAcceptor(const BluetoothSppAcceptor& value);
267 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit
268 // copying of objects.
270 BluetoothSppAcceptor& operator =(const BluetoothSppAcceptor& value);
273 _BluetoothSppAcceptorImpl* __pImpl;
275 }; // BluetoothSppAcceptor
278 #endif // _FNET_BT_BLUETOOTH_SPP_ACCEPTOR_H_