summaryrefslogtreecommitdiff
path: root/src/FNetBt_BluetoothOppClientEventArg.h
blob: 22988deb689369f17eb7bbed2004a822be924c56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//
// Open Service Platform
// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
 * @file    FNetBt_BluetoothOppClientEventArg.h
 * @brief   This is the header file for the _BluetoothOppClientEventArg class.
 *
 * This header file contains the declarations of the _BluetoothOppClientEventArg class which includes information to be
 * passed to the event listeners
 */
#ifndef _FNET_BT_INTERNAL_BLUETOOTH_OPP_CLIENT_EVENT_ARG_H_
#define _FNET_BT_INTERNAL_BLUETOOTH_OPP_CLIENT_EVENT_ARG_H_

#include <FBaseObject.h>
#include <FBaseResult.h>
#include <FBaseString.h>
#include <FOspConfig.h>
#include <FBaseRtIEventArg.h>

namespace Tizen { namespace Net { namespace Bluetooth
{

// Forward declaration
class BluetoothDevice;

/**
  * @enum    _BluetoothOppClientEventType
  * Type for specifying the type of _BluetoothOppClientEvent
  */
enum _BluetoothOppClientEventType
{
	_BT_OPP_CLIENT_EVENT_PUSH_RESPONDED,      /**< For notifying the OPP server responded to the push request */
	_BT_OPP_CLIENT_EVENT_TRANSFER_DONE,       /**< For notifying the file transfer has finished */
	_BT_OPP_CLIENT_EVENT_TRANSFER_PROGRESS,       /**< For notifying the file is being transferred */
};

/**
 * @class   _BluetoothOppClientEventArg
 * @brief   This class is used as an argument for callback methods of the _IBluetoothOppClientEventListener class.
 *
 * When a _BluetoothOppClientEvent occurs, the _BluetoothOppClientEvent finds a _IBluetoothOppClientEventListener instance
 * which is registered for the _BluetoothOppClientEvent and calls an appropriate method of the listener.
 * @see     _IBluetoothOppClientEventListener
 */
class _BluetoothOppClientEventArg
	: public Tizen::Base::Object
	, public Tizen::Base::Runtime::IEventArg
{
public:
	/**
	 * This is a class constructor for _BT_OPP_CLIENT_EVENT_PUSH_RESPONDED event.
	 *
	 * @param[in]   r                    The result of the event
	 * @exception   E_SUCCESS            The connection is established successfully.
	 * @exception   E_SYSTEM             The connection fails.
	 */
	_BluetoothOppClientEventArg(result r);

	/**
	 * This is a class constructor for  _BT_OPP_CLIENT_EVENT_TRANSFER_DONE event.
	 *
	 * @param[in]   filePath            The path of the transferred file
	 * @param[in]   fileSize            The size of the transferred file
	 * @param[in]   isCompleted         Set to @c true if the transfer is successfully completed, @n
	 *                                  else @c false
	 */
	 _BluetoothOppClientEventArg(const Tizen::Base::String& filePath, int fileSize, bool isCompleted);

	/**
	 * This is a class constructor for _BT_OPP_CLIENT_EVENT_TRANSFER_PROGRESS event.
	 *
	 * @param[in]   percent         The progress in percentage ranging from @c 1 to @c 100 percent
	 */
	 _BluetoothOppClientEventArg(int percent);

	/**
	 * This is the class destructor.
	 */
	~_BluetoothOppClientEventArg(void);

	/**
	 * Gets the type of this event.
	 *
	 * @return      The type of the event
	 */
	_BluetoothOppClientEventType GetEventType(void) const;

	/**
	 * Gets the error result of this event.
	 *
	 * @return      The result of the event
	 */
	result GetErrorResult(void) const;

	/**
	 * Gets the sent file path.
	 *
	 * @return      The sent file path
	 */
	Tizen::Base::String GetFilePath(void) const;

	/**
	 * Gets the sent file size.
	 *
	 * @return      The sent file size
	 */
	int GetFileSize(void) const;

	/**
	 * Is the file transfer completed.
	 *
	 * @return      @c true if the transfer is successfully completed, @n
	 *              else @c false
	 */
	bool IsTransferCompleted(void) const;

	/**
	 * Gets the progress information as a type of percentage.
	 *
	 * @return      The percentage that represents the progress of file transfer
	 */
	int GetPercent(void) const;

private:
	_BluetoothOppClientEventArg(void);
	_BluetoothOppClientEventArg(const _BluetoothOppClientEventArg& eventArg);
	_BluetoothOppClientEventArg& operator =(const _BluetoothOppClientEventArg& rValue);

private:
	_BluetoothOppClientEventType __evtType;
	result __result;
	Tizen::Base::String __filePath;
	int __fileSize;
	bool __isCompleted;
	int __percent;

}; // _BluetoothOppClientEventArg

} } }
#endif // _FNET_BT_INTERNAL_BLUETOOTH_OPP_CLIENT_EVENT_ARG_H_