update header for Doxygen
[framework/osp/bluetooth.git] / inc / FNetBtBluetoothSppAcceptor.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 /**
19  * @file        FNetBtBluetoothSppAcceptor.h
20  * @brief       This is the header file for the %BluetoothSppAcceptor class.
21  *
22  * This header file contains the declarations of the %BluetoothSppAcceptor class.
23  */
24 #ifndef _FNET_BT_BLUETOOTH_SPP_ACCEPTOR_H_
25 #define _FNET_BT_BLUETOOTH_SPP_ACCEPTOR_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FBaseUuId.h>
30 #include <FNetBtBluetoothTypes.h>
31
32 namespace Tizen { namespace Base
33 {
34 class ByteBuffer;
35 } }
36
37 namespace Tizen { namespace Net { namespace Bluetooth
38 {
39
40 // forward declarations
41 class IBluetoothSppAcceptorEventListener;
42 class _BluetoothSppAcceptorImpl;
43
44 /**
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.
48  * @since   2.0
49  *
50  * The %BluetoothSppAcceptor class provides the methods to handle the %Bluetooth Serial Port Profile (SPP) acceptor, such as an
51  * incoming connection request.
52  *
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>.
55  */
56 class _OSP_EXPORT_ BluetoothSppAcceptor
57         : public Tizen::Base::Object
58 {
59 public:
60         /**
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.
63          *
64          * @since       2.0
65          */
66         BluetoothSppAcceptor(void);
67
68         /**
69          * This destructor overrides Tizen::Base::Object::~Object().
70          *
71          * @since       2.0
72          */
73         virtual ~BluetoothSppAcceptor(void);
74
75         /**
76          * Initializes this instance of %BluetoothSppAcceptor with the specified listener.
77          *
78          * @since       2.0
79          * @feature     %http://tizen.org/feature/network.bluetooth
80          *
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&).
92          */
93         result Construct(IBluetoothSppAcceptorEventListener& listener);
94
95         /**
96          * Accepts a connection request from a remote SPP initiator. @n
97          * The %AcceptConnection() method establishes a connection.
98          *
99          * @since       2.0
100          * @privlevel   public
101          * @privilege   %http://tizen.org/privilege/bluetooth.spp
102          *
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
107          *                                      not activated.
108          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
109          *                                      operation. @n
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()
116          */
117         result AcceptConnection(void);
118
119         /**
120          * Rejects a connection request from a remote SPP initiator.
121          *
122          * @since       2.0
123          * @privlevel   public
124          * @privilege   %http://tizen.org/privilege/bluetooth.spp
125          *
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
130          *                                      not activated.
131          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
132          *                                      operation. @n
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()
139          */
140         result RejectConnection(void);
141
142         /**
143          * Starts the SPP service with the default service UUID - BT_SVC_UUID_SPP.
144          *
145          * @since       2.0
146          * @privlevel   public
147          * @privilege   %http://tizen.org/privilege/bluetooth.spp
148          *
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
153          *                                      not activated.
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.
160          */
161         result StartService(void);
162
163         /**
164          * Starts the SPP service with the specified service UUID.
165          *
166          * @since 2.0
167          * @privlevel   public
168          * @privilege   %http://tizen.org/privilege/bluetooth.spp
169          *
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
175          *                                      not activated.
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.
183          */
184         result StartService(const Tizen::Base::UuId& serviceUuid);
185
186         /**
187          * Stops the SPP service. @n
188          * The %StopService() method disconnects the current connection before stopping the service.
189          *
190          * @since       2.0
191          * @privlevel   public
192          * @privilege   %http://tizen.org/privilege/bluetooth.spp
193          *
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
198          *                                      not activated.
199          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
200          *                                      operation. @n
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.
205          */
206         result StopService(void);
207
208         /**
209          * Disconnects the current connection.
210          *
211          * @since       2.0
212          * @privlevel   public
213          * @privilege   %http://tizen.org/privilege/bluetooth.spp
214          *
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
219          *                                      not activated.
220          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
221          *                                      operation. @n
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()
229          */
230         result Disconnect(void);
231
232         /**
233          * Sends the data.
234          *
235          * @since       2.0
236          * @privlevel   public
237          * @privilege   %http://tizen.org/privilege/bluetooth.spp
238          *
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
245          *                                      not activated.
246          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified
247          *                                      operation. @n
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()
256          */
257         result SendData(const Tizen::Base::ByteBuffer& buffer);
258
259 private:
260         //
261         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying
262         // of objects.
263         //
264         BluetoothSppAcceptor(const BluetoothSppAcceptor& value);
265
266         //
267         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit
268         // copying of objects.
269         //
270         BluetoothSppAcceptor& operator =(const BluetoothSppAcceptor& value);
271
272 private:
273         _BluetoothSppAcceptorImpl* __pImpl;
274
275 }; // BluetoothSppAcceptor
276
277 } } }
278 #endif // _FNET_BT_BLUETOOTH_SPP_ACCEPTOR_H_