[content] Change secure log
[platform/framework/native/content.git] / src / FCnt_ContentTransferEvent.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 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  * @file                        FCntContentTransferEvent.h
19  * @brief               This is the header file for the %ContentTransferEvent class.
20  *
21  */
22 #ifndef _FCNT_INTERNAL_CONTENT_TRANSFER_EVENT_H_
23 #define _FCNT_INTERNAL_CONTENT_TRANSFER_EVENT_H_
24
25 #include <unique_ptr.h>
26 #include <FBaseRt_Event.h>
27 #include <FBaseRtIEventArg.h>
28
29 namespace Tizen { namespace Content
30 {
31
32 //
33 // @enum ContentTransferEventType
34 // @brief This represents  ContentTransfer's event type.
35 //
36 enum  ContentTransferEventType
37 {
38         CONTENT_TRANSFER_EVENT_NONE,                    // Event None
39         CONTENT_TRANSFER_EVENT_DOWNLOAD_COMPLETED,                  // Event None
40         CONTENT_TRANSFER_EVENT_CANCELED,
41         CONTENT_TRANSFER_EVENT_DOWNLOAD_TO_BUFFER_COMPLETED,
42         CONTENT_TRANSFER_EVENT_TRANSFER_IN_PROGRESS
43 };
44
45 class _ContentTransferEvent
46         : public Tizen::Base::Runtime::_Event
47 {
48 public:
49         _ContentTransferEvent(void);
50         virtual ~_ContentTransferEvent(void);
51
52 protected:
53         /**
54          *      Finds out and invokes the method of listener corresponding to the specified event argument.
55          *
56          * @return              The error code.
57          * @param[in]   pListener                       An event listener to be invoked. This must be an instance of ICameraEventListener.
58          * @param[in]   arg                                     An argument to be fired.
59          * @exception   E_SUCCESS                       - This method is successful.
60          * @exception   E_OUT_OF_MEMORY         - Failed to allocate the required/requested memory.
61          * @exception   E_INVALID_STATE         - The current state of the camera is inappropriate or invalid for this method.
62          * @exception   E_INVALID_ARG           - The argument passed to a method contains an invalid value.
63          */
64         virtual void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg);
65
66 private:
67         _ContentTransferEvent(const _ContentTransferEvent& rhs);
68         _ContentTransferEvent& operator =(const _ContentTransferEvent& rhs);
69
70 };  // class _ContentTransferEvent
71
72
73 class _ContentTransferEventArg
74         : public Tizen::Base::Runtime::IEventArg
75 {
76 public:
77         _ContentTransferEventArg(void);
78         virtual ~_ContentTransferEventArg(void);
79
80 public:
81         /**
82         *       Get the event type.
83         *
84         *       @return ContentTransfer Event type of this argument.
85         */
86         ContentTransferEventType GetEventType(void) const;
87
88         result GetResult(void) const;
89
90         Tizen::Base::String GetErrorMsg(void) const;
91
92         Tizen::Base::String GetErrorCode(void) const;
93
94         RequestId GetRequestId(void) const;
95
96         ContentId GetContentId(void) const;
97
98         int GetTotalTransferedSize(void) const;
99
100         Tizen::Base::ByteBuffer* GetBuffer(void) const;
101
102         /**
103         *       Set the event type.
104         */
105         void SetEventType(ContentTransferEventType eType);
106
107         void SetResult(result res);
108
109         void SetErrorMsg(const Tizen::Base::String& ErrorCode, const Tizen::Base::String& ErrorMsg);
110
111         void SetRequestId(RequestId requestId);
112
113         void SetContentId(const ContentId& contentId);
114
115         void SetTotalTransferedSize(int totalSize);
116
117         void SetBuffer(Tizen::Base::ByteBuffer* pBuffer);
118
119 private:
120         _ContentTransferEventArg(const _ContentTransferEventArg& rhs);
121         _ContentTransferEventArg& operator =(const _ContentTransferEventArg& rhs);
122
123 private:
124         RequestId __requestId;
125         ContentId __contentId;
126         ContentTransferEventType __contentTransferEventType;
127         int __totalSize;
128         result __res;
129         Tizen::Base::String __errorMsg;
130         Tizen::Base::String __errorCode;
131         std::unique_ptr<Tizen::Base::ByteBuffer> __pBuffer;
132 };  // class _ContentTransferEventArg
133
134 }}  // Tizen::Content
135
136 #endif // _FCNT_INTERNAL_CONTENT_TRANSFER_EVENT_H_