13d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/* Copyright (c) 2013, 2016, The Linux Foundation. All rights reserved.
23d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *
33d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * Redistribution and use in source and binary forms, with or without
43d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * modification, are permitted provided that the following conditions are
53d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * met:
63d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *     * Redistributions of source code must retain the above copyright
73d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       notice, this list of conditions and the following disclaimer.
83d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *     * Redistributions in binary form must reproduce the above
93d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       copyright notice, this list of conditions and the following
103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       disclaimer in the documentation and/or other materials provided
113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       with the distribution.
123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *     * Neither the name of The Linux Foundation nor the names of its
133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       contributors may be used to endorse or promote products derived
143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       from this software without specific prior written permission.
153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *
163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *
283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel */
293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifndef __QCAMERA_THERMAL_ADAPTER__
313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define __QCAMERA_THERMAL_ADAPTER__
323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelnamespace qcamera {
343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum {
363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_NO_ADJUSTMENT = 0,
373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_SLIGHT_ADJUSTMENT,
383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_BIG_ADJUSTMENT,
393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_MAX_ADJUSTMENT,
403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_SHUTDOWN = 10
413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qcamera_thermal_level_enum_t;
423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum {
443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_ADJUST_FPS,
453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_THERMAL_ADJUST_FRAMESKIP,
463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qcamera_thermal_mode;
473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelclass QCameraThermalCallback
493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{
503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelpublic:
513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int thermalEvtHandle(qcamera_thermal_level_enum_t *level,
523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            void *userdata, void *data) = 0;
533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual ~QCameraThermalCallback() {}
543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    qcamera_thermal_level_enum_t *getThermalLevel();
553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void setThermalLevel(qcamera_thermal_level_enum_t level);
563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelprivate:
583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    qcamera_thermal_level_enum_t mLevel;
593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel};
603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelclass QCameraThermalAdapter
623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{
633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelpublic:
643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static QCameraThermalAdapter& getInstance();
653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int init(QCameraThermalCallback *thermalCb);
673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void deinit();
683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelprivate:
703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static char mStrCamera[];
713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static char mStrCamcorder[];
723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int thermalCallback(int level, void *userdata, void *data);
743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraThermalCallback *mCallback;
763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void *mHandle;
773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int (*mRegister)(char *name,
783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            int (*callback)(int, void *userdata, void *data), void *data);
793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int (*mUnregister)(int handle);
803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int mCameraHandle;
813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int mCamcorderHandle;
823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraThermalAdapter();
843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraThermalAdapter(QCameraThermalAdapter const& copy); // not implemented
853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraThermalAdapter& operator=(QCameraThermalAdapter const& copy); // not implemented
863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel};
883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel}; // namespace qcamera
903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif /* __QCAMERA_THERMAL_ADAPTER__ */
92