2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @author Karol Majewski (k.majewski@samsung.com)
22 #ifndef WRTDEVICEAPIS_CAMERA_API_ICAMERA_H_
23 #define WRTDEVICEAPIS_CAMERA_API_ICAMERA_H_
27 #include <dpl/shared_ptr.h>
28 #include <Commons/ThreadPool.h>
29 #include <Commons/EventReceiver.h>
30 #include <Commons/IExternEventCanceler.h>
31 #include "EventBeginRecording.h"
32 #include "EventEndRecording.h"
33 #include "EventTakePicture.h"
34 #include "EventGetPreviewNode.h"
37 namespace WrtDeviceApis {
41 typedef Commons::EventRequestReceiver<EventTakePicture>
42 EventSupportTakePicture;
43 typedef Commons::EventRequestReceiver<EventBeginRecording>
44 EventSupportBeginRecording;
45 typedef Commons::EventRequestReceiver<EventEndRecording>
46 EventSupportEndRecording;
47 typedef Commons::EventRequestReceiver<EventGetPreviewNode>
48 EventSupportGetPreviewNode;
50 typedef Commons::IExternEventCanceler<EventBeginRecording>
51 SupportCancelRecording;
52 typedef Commons::IExternEventCanceler<EventTakePicture>
53 SupportCancelTakePicture;
54 typedef Commons::IExternEventCanceler<EventGetPreviewNode>
55 SupportCancelGetPreview;
56 typedef Commons::ThreadEnum Thread;
58 class ICamera : public EventSupportTakePicture,
59 public EventSupportBeginRecording,
60 public EventSupportEndRecording,
61 public EventSupportGetPreviewNode,
62 public SupportCancelRecording,
63 public SupportCancelTakePicture,
64 public SupportCancelGetPreview
68 EventSupportTakePicture(Thread::CAMERA_THREAD),
69 EventSupportBeginRecording(Thread::CAMERA_THREAD),
70 EventSupportEndRecording(Thread::CAMERA_THREAD),
71 EventSupportGetPreviewNode(Thread::CAMERA_THREAD)
75 virtual std::string getDescription() const
83 void takePicture(const EventTakePictureSharedPtr &event)
85 EventSupportTakePicture::PostRequest(event);
91 virtual void beginRecording(const EventBeginRecordingSharedPtr &event)
93 EventSupportBeginRecording::PostRequest(event);
99 virtual void endRecording(const EventEndRecordingSharedPtr &event,
102 EventSupportEndRecording::PostRequest(event,delay);
106 * Requests preview window
108 void createPreview(const EventGetPreviewNodeSharedPtr &event)
110 EventSupportGetPreviewNode::PostRequest(event);
113 virtual void OnCancelEvent(const EventBeginRecordingSharedPtr& /*event*/) {}
114 virtual void OnCancelEvent(const EventTakePictureSharedPtr& /*event*/) {}
115 virtual void OnCancelEvent(const EventGetPreviewNodeSharedPtr& /*event*/) {}
117 virtual void OnRequestReceived(
118 const EventTakePictureSharedPtr &event) = 0;
119 virtual void OnRequestReceived(
120 const EventBeginRecordingSharedPtr &event) = 0;
121 virtual void OnRequestReceived(
122 const EventEndRecordingSharedPtr &event) = 0;
123 virtual void OnRequestReceived(
124 const EventGetPreviewNodeSharedPtr &event) = 0;
131 typedef DPL::SharedPtr<ICamera> ICameraSharedPtr;