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 FNetBtBluetoothSppInitiator.h
20 * @brief This is the header file for the %BluetoothSppInitiator class.
22 * This header file contains the declarations of the %BluetoothSppInitiator class.
24 #ifndef _FNET_BT_BLUETOOTH_SPP_INITIATOR_H_
25 #define _FNET_BT_BLUETOOTH_SPP_INITIATOR_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 BluetoothDevice;
42 class IBluetoothSppInitiatorEventListener;
43 class _BluetoothSppInitiatorImpl;
46 * @class BluetoothSppInitiator
47 * @brief This class provides the methods to handle the %Bluetooth Serial Port Profile (SPP) initiator, such as the
48 * outgoing connection requests.
51 * The %BluetoothSppInitiator class provides the methods to handle the %Bluetooth Serial Port Profile (SPP) initiator, such as
52 * the outgoing connection requests.
54 * For more information on the class features, see
55 * <a href="../org.tizen.native.appprogramming/html/guide/net/bluetooth_namespace.htm">Bluetooth Guide</a>.
57 class _OSP_EXPORT_ BluetoothSppInitiator
58 : public Tizen::Base::Object
62 * The object is not fully constructed after this constructor is called. For full construction, the Construct()
63 * method must be called right after calling this constructor.
67 BluetoothSppInitiator(void);
70 * This destructor overrides Tizen::Base::Object::~Object().
74 virtual ~BluetoothSppInitiator(void);
77 * Constructs and initializes this instance of %BluetoothSppInitiator with the specified listener.
80 * @feature %http://tizen.org/feature/network.bluetooth
82 * @return An error code
83 * @param[in] listener The event listener for the SPP initiator
84 * @exception E_SUCCESS The method is successful.
85 * @exception E_OUT_OF_MEMORY The memory is insufficient.
86 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
87 * For more information, see
88 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
89 * Application Filtering</a>.
90 * @exception E_SYSTEM A system error has occurred.
91 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
94 result Construct(IBluetoothSppInitiatorEventListener& listener);
97 * Connects to a remote SPP acceptor with the default service UUID - BT_SVC_UUID_SPP. @n
98 * The %Connect() method establishes a connection after the SPP acceptor accepts the request.
102 * @privilege %http://tizen.org/privilege/bluetooth.spp
104 * @return An error code
105 * @param[in] remoteDevice The remote device to connect
106 * @exception E_SUCCESS The method is successful.
107 * @exception E_INVALID_STATE This instance is in an invalid state. @n
108 * For example, this instance has not been constructed as yet or
109 * %Bluetooth is not activated.
110 * @exception E_IN_PROGRESS The connection process is in progress.
111 * @exception E_ALREADY_CONNECTED The connection with an SPP acceptor has already been established.
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_SERVICE_UNAVAILABLE The SPP connection is unavailable.
115 * @exception E_REMOTE_DEVICE_NOT_FOUND The input device is not found. @n
116 * This exception is currently not in use.
117 * @exception E_FAILURE The method has failed.
118 * @remarks If the local device is not paired with the specified target device, the pairing process starts
119 * internally before the connect request is sent.
120 * @see IBluetoothSppAcceptorEventListener::OnSppConnectionRequested()
122 result Connect(const BluetoothDevice& remoteDevice);
125 * Connects to a remote SPP acceptor with the specified service UUID. @n
126 * The %Connect() method establishes a connection after the SPP acceptor accepts the request.
130 * @privilege %http://tizen.org/privilege/bluetooth.spp
132 * @return An error code
133 * @param[in] remoteDevice The remote device to connect
134 * @param[in] serviceUuid The UUID of SPP service to connect
135 * @exception E_SUCCESS The method is successful.
136 * @exception E_INVALID_STATE This instance is in an invalid state. @n
137 * For example, this instance has not been constructed as yet or
138 * %Bluetooth is not activated.
139 * @exception E_INVALID_ARG A specified input parameter is invalid.
140 * @exception E_IN_PROGRESS The connection process is in progress.
141 * @exception E_ALREADY_CONNECTED The connection with an SPP acceptor has already been established.
142 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
143 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
144 * @exception E_SERVICE_UNAVAILABLE The SPP connection is unavailable.
145 * @exception E_REMOTE_DEVICE_NOT_FOUND The input device is not found. @n
146 * This exception is currently not in use.
147 * @exception E_FAILURE The method has failed.
148 * @remarks If the local device is not paired with the specified target device, the pairing process starts
149 * internally before the connect request is sent.
150 * @see IBluetoothSppAcceptorEventListener::OnSppConnectionRequested()
152 result Connect(const BluetoothDevice& remoteDevice, const Tizen::Base::UuId& serviceUuid);
155 * Disconnects the current connection. @n
156 * If the %Disconnect() method is called before the SPP acceptor accepts the connection request, the
157 * IBluetoothSppInitiatorEventListener::OnSppConnectionResponded() method and its result @c E_SYSTEM is thrown. @n
158 * If this method is called on connection, the IBluetoothSppInitiatorEventListener::OnSppDisconnected() method and
159 * its result @c E_SUCCESS is thrown.
163 * @privilege %http://tizen.org/privilege/bluetooth.spp
165 * @return An error code
166 * @exception E_SUCCESS The method is successful.
167 * @exception E_INVALID_STATE This instance is in an invalid state. @n
168 * For example, this instance has not been constructed as yet or %Bluetooth is
170 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
172 * For example, the connection request is not sent or a connection with a
173 * remote device is not established yet.
174 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
175 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
176 * @exception E_FAILURE The method has failed.
177 * @see IBluetoothSppAcceptorEventListener::OnSppDisconnected()
179 result Disconnect(void);
182 * Sends the specified data.
186 * @privilege %http://tizen.org/privilege/bluetooth.spp
188 * @return An error code
189 * @param[in] buffer The data to send @n
190 * The size of the buffer should not exceed @c 1000 bytes.
191 * @exception E_SUCCESS The method is successful.
192 * @exception E_INVALID_STATE This instance is in an invalid state. @n
193 * For example, this instance has not been constructed as yet or %Bluetooth is
195 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
197 * For example, the connection request is not sent or a connection with a
198 * remote device is not established yet.
199 * @exception E_INVALID_ARG The argument has no data.
200 * @exception E_SYSTEM A system error has occurred.
201 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
202 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
203 * @exception E_FAILURE The method has failed.
204 * @see IBluetoothSppAcceptorEventListener::OnSppDataReceived()
206 result SendData(const Tizen::Base::ByteBuffer& buffer);
210 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying
213 BluetoothSppInitiator(const BluetoothSppInitiator& value);
216 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit
217 // copying of objects.
219 BluetoothSppInitiator& operator =(const BluetoothSppInitiator& value);
222 _BluetoothSppInitiatorImpl* __pImpl;
224 }; // BluetoothSppInitiator
227 #endif // _FNET_BT_BLUETOOTH_SPP_INITIATOR_H_