1 /* Copyright (c) 2013, The Linux Foundataion. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 */ 29 30 #ifndef __QCAMERA_THERMAL_ADAPTER__ 31 #define __QCAMERA_THERMAL_ADAPTER__ 32 33 namespace qcamera { 34 35 typedef enum { 36 QCAMERA_THERMAL_NO_ADJUSTMENT = 0, 37 QCAMERA_THERMAL_SLIGHT_ADJUSTMENT, 38 QCAMERA_THERMAL_BIG_ADJUSTMENT, 39 QCAMERA_THERMAL_SHUTDOWN 40 } qcamera_thermal_level_enum_t; 41 42 typedef enum { 43 QCAMERA_THERMAL_ADJUST_FPS, 44 QCAMERA_THERMAL_ADJUST_FRAMESKIP, 45 } qcamera_thermal_mode; 46 47 class QCameraThermalCallback 48 { 49 public: 50 virtual int thermalEvtHandle(qcamera_thermal_level_enum_t *level, 51 void *userdata, void *data) = 0; ~QCameraThermalCallback()52 virtual ~QCameraThermalCallback() {} 53 qcamera_thermal_level_enum_t *getThermalLevel(); 54 void setThermalLevel(qcamera_thermal_level_enum_t level); 55 56 private: 57 qcamera_thermal_level_enum_t mLevel; 58 }; 59 60 class QCameraThermalAdapter 61 { 62 public: 63 static QCameraThermalAdapter& getInstance(); 64 65 int init(QCameraThermalCallback *thermalCb); 66 void deinit(); 67 68 private: 69 static char mStrCamera[]; 70 static char mStrCamcorder[]; 71 72 static int thermalCallback(int level, void *userdata, void *data); 73 74 QCameraThermalCallback *mCallback; 75 void *mHandle; 76 int (*mRegister)(char *name, 77 int (*callback)(int, void *userdata, void *data), void *data); 78 int (*mUnregister)(int handle); 79 int mCameraHandle; 80 int mCamcorderHandle; 81 82 QCameraThermalAdapter(); 83 QCameraThermalAdapter(QCameraThermalAdapter const& copy); // not implemented 84 QCameraThermalAdapter& operator=(QCameraThermalAdapter const& copy); // not implemented 85 86 }; 87 88 }; // namespace qcamera 89 90 #endif /* __QCAMERA_THERMAL_ADAPTER__ */ 91