Tizen 2.0 Release
[framework/osp/media.git] / src / FMedia_CameraEventArg.cpp
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 /**
19  * @file                        FMedia_CameraEventArg.cpp
20  * @brief                       This file contains the event arguments from subsystem to FMedia's event listener.
21  *
22  */
23 #include <FBaseSysLog.h>
24 #include "FMedia_CameraEventArg.h"
25
26 using namespace Tizen::Base;
27
28 namespace Tizen { namespace Media
29 {
30
31 _CameraEventArg::_CameraEventArg(void)
32         : __cameraEventType(_CAMERA_EVENT_NONE)
33         , __pCameraData(null)
34         , __result(E_SUCCESS)
35         , __error(CAMERA_ERROR_NONE)
36 {
37
38 }
39
40 _CameraEventArg::~_CameraEventArg(void)
41 {
42         if (__pCameraData != null)
43         {
44                 delete __pCameraData;
45         }
46 }
47
48 void
49 _CameraEventArg::SetEventType(_CameraEventType eType)
50 {
51         __cameraEventType = eType;
52 }
53
54 _CameraEventType
55 _CameraEventArg::GetEventType(void) const
56 {
57         return __cameraEventType;
58 }
59
60 void
61 _CameraEventArg::SetData(const Tizen::Base::ByteBuffer* pData)
62 {
63         if (pData != null)
64         {
65                 __pCameraData = new (std::nothrow) ByteBuffer();
66                 SysTryReturn(NID_MEDIA, __pCameraData !=null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.  The object is not created.");
67                 __pCameraData->Construct(*pData); //shallow copy
68         }
69 }
70
71 Tizen::Base::ByteBuffer*
72 _CameraEventArg::GetData(void) const
73 {
74         return __pCameraData;
75 }
76
77 result
78 _CameraEventArg::GetResult(void) const
79 {
80         return __result;
81 }
82
83 void
84 _CameraEventArg::SetResult(result r)
85 {
86         __result = r;
87 }
88
89 void
90 _CameraEventArg::SetError(CameraErrorReason r)
91 {
92         __error = r;
93 }
94
95 CameraErrorReason
96 _CameraEventArg::GetError(void) const
97 {
98         return __error;
99 }
100
101 }}// Tizen::Media
102