46
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include "cxecameradevicecontroldesktop.h"
|
|
18 |
#include "cxeviewfindercontroldesktop.h"
|
|
19 |
#include "cxutils.h"
|
|
20 |
|
|
21 |
CxeCameraDeviceControlDesktop::CxeCameraDeviceControlDesktop() : mIndex(Cxe::PrimaryCameraIndex), mMode(Cxe::ImageMode), mState(Idle)
|
|
22 |
{
|
|
23 |
CX_DEBUG_IN_FUNCTION()
|
|
24 |
}
|
|
25 |
|
|
26 |
CxeCameraDeviceControlDesktop::~CxeCameraDeviceControlDesktop()
|
|
27 |
{
|
|
28 |
CX_DEBUG_IN_FUNCTION()
|
|
29 |
}
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Get current camera mode.
|
|
33 |
*/
|
|
34 |
Cxe::CameraMode CxeCameraDeviceControlDesktop::mode() const
|
|
35 |
{
|
|
36 |
return mMode;
|
|
37 |
}
|
|
38 |
/**
|
|
39 |
* Set current camera mode.
|
|
40 |
*/
|
|
41 |
void CxeCameraDeviceControlDesktop::setMode(Cxe::CameraMode mode)
|
|
42 |
{
|
|
43 |
CX_DEBUG_ENTER_FUNCTION();
|
|
44 |
mMode = mode;
|
|
45 |
CX_DEBUG_EXIT_FUNCTION();
|
|
46 |
}
|
|
47 |
|
|
48 |
void CxeCameraDeviceControlDesktop::init()
|
|
49 |
{
|
|
50 |
CX_DEBUG_ENTER_FUNCTION();
|
|
51 |
setState(CxeCameraDeviceControl::Ready);
|
|
52 |
CX_DEBUG_EXIT_FUNCTION();
|
|
53 |
}
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Reserve camera device for exclusive use.
|
|
57 |
*/
|
|
58 |
void CxeCameraDeviceControlDesktop::reserve()
|
|
59 |
{
|
|
60 |
CX_DEBUG_IN_FUNCTION()
|
|
61 |
}
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Cancel all operations and release camera for other applications to use.
|
|
65 |
* Camera module is also powered off.
|
|
66 |
*/
|
|
67 |
void CxeCameraDeviceControlDesktop::release()
|
|
68 |
{
|
|
69 |
CX_DEBUG_ENTER_FUNCTION();
|
|
70 |
setState(CxeCameraDeviceControl::Idle);
|
|
71 |
CX_DEBUG_EXIT_FUNCTION();
|
|
72 |
}
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Get current camera index (primary or secondary).
|
|
76 |
*
|
|
77 |
* @return Current camera index
|
|
78 |
*/
|
|
79 |
Cxe::CameraIndex CxeCameraDeviceControlDesktop::cameraIndex() const
|
|
80 |
{
|
|
81 |
return mIndex;
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Switch between primary and secondary camera.
|
|
86 |
*
|
|
87 |
* @param index New camera index
|
|
88 |
*/
|
|
89 |
CxeError::Id CxeCameraDeviceControlDesktop::switchCamera(Cxe::CameraIndex index)
|
|
90 |
{
|
|
91 |
CX_DEBUG_ENTER_FUNCTION();
|
|
92 |
mIndex = index;
|
|
93 |
setState(CxeCameraDeviceControl::Ready);
|
|
94 |
return CxeError::None;
|
|
95 |
CX_DEBUG_EXIT_FUNCTION();
|
|
96 |
}
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Get current device control state.
|
|
100 |
*
|
|
101 |
* @return Current state
|
|
102 |
*/
|
|
103 |
CxeCameraDeviceControl::State CxeCameraDeviceControlDesktop::state() const
|
|
104 |
{
|
|
105 |
return mState;
|
|
106 |
}
|
|
107 |
|
|
108 |
void CxeCameraDeviceControlDesktop::setState(CxeCameraDeviceControl::State stateId, CxeError::Id error)
|
|
109 |
{
|
|
110 |
CX_DEBUG_ENTER_FUNCTION();
|
|
111 |
mState = stateId;
|
|
112 |
emit stateChanged(mState, error);
|
|
113 |
CX_DEBUG_EXIT_FUNCTION();
|
|
114 |
}
|
|
115 |
// end of file
|