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 * This 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_SERVICE_UNAVAILABLE The SPP connection is unavailable.
114 * @exception E_REMOTE_DEVICE_NOT_FOUND The input device is not found. @n
115 * This exception is currently not in use.
116 * @exception E_FAILURE The method has failed.
117 * @see IBluetoothSppAcceptorEventListener::OnSppConnectionRequested()
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.
121 result Connect(const BluetoothDevice& remoteDevice);
124 * Connects to a remote SPP acceptor with the specified service UUID. @n
125 * This method establishes a connection after the SPP acceptor accepts the request.
129 * @privilege %http://tizen.org/privilege/bluetooth.spp
131 * @return An error code
132 * @param[in] remoteDevice The remote device to connect
133 * @param[in] serviceUuid The UUID of SPP service to connect
134 * @exception E_SUCCESS The method is successful.
135 * @exception E_INVALID_STATE This instance is in an invalid state. @n
136 * For example, this instance has not been constructed as yet or
137 * %Bluetooth is not activated.
138 * @exception E_INVALID_ARG A specified input parameter is invalid.
139 * @exception E_IN_PROGRESS The connection process is in progress.
140 * @exception E_ALREADY_CONNECTED The connection with an SPP acceptor has already been established.
141 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
142 * @exception E_SERVICE_UNAVAILABLE The SPP connection is unavailable.
143 * @exception E_REMOTE_DEVICE_NOT_FOUND The input device is not found. @n
144 * This exception is currently not in use.
145 * @exception E_FAILURE The method has failed.
146 * @see IBluetoothSppAcceptorEventListener::OnSppConnectionRequested()
147 * @remarks If the local device is not paired with the specified target device, the pairing process starts
148 * internally before the connect request is sent.
150 result Connect(const BluetoothDevice& remoteDevice, const Tizen::Base::UuId& serviceUuid);
153 * Disconnects the current connection. @n
154 * If this method is called before the SPP acceptor accepts the connection request, the
155 * IBluetoothSppInitiatorEventListener::OnSppConnectionResponded() and its result @c E_SYSTEM is thrown. @n
156 * If this method is called on connection, the IBluetoothSppInitiatorEventListener::OnSppDisconnected() and
157 * its result @c E_SUCCESS is thrown.
161 * @privilege %http://tizen.org/privilege/bluetooth.spp
163 * @return An error code
164 * @exception E_SUCCESS The method is successful.
165 * @exception E_INVALID_STATE This instance is in an invalid state. @n
166 * For example, this instance has not been constructed as yet or %Bluetooth is
168 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
170 * For example, the connection request is not sent or a connection with a
171 * remote device is not established yet.
172 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
173 * @exception E_FAILURE The method has failed.
174 * @see IBluetoothSppAcceptorEventListener::OnSppDisconnected()
176 result Disconnect(void);
179 * Sends the specified data.
183 * @privilege %http://tizen.org/privilege/bluetooth.spp
185 * @return An error code
186 * @param[in] buffer The data to send. @n
187 * The size of the buffer should not exceed @c 1000 bytes.
188 * @exception E_SUCCESS The method is successful.
189 * @exception E_INVALID_STATE This instance is in an invalid state. @n
190 * For example, this instance has not been constructed as yet or %Bluetooth is
192 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
194 * For example, the connection request is not sent or a connection with a
195 * remote device is not established yet.
196 * @exception E_INVALID_ARG The argument has no data.
197 * @exception E_SYSTEM A system error has occurred.
198 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
199 * @exception E_FAILURE The method has failed.
200 * @see IBluetoothSppAcceptorEventListener::OnSppDataReceived()
202 result SendData(const Tizen::Base::ByteBuffer& buffer);
206 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying
209 BluetoothSppInitiator(const BluetoothSppInitiator& value);
211 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit
212 // copying of objects.
214 BluetoothSppInitiator& operator =(const BluetoothSppInitiator& value);
217 _BluetoothSppInitiatorImpl* __pImpl;
219 }; // BluetoothSppInitiator
222 #endif // _FNET_BT_BLUETOOTH_SPP_INITIATOR_H_