- Added/updated files to support ultraviolet sensor for Note 4.
- Added build support
- Added API support
- Added configuration for Note 4 UV sensor
Change-Id: I7de07724d3498372c9a39c5da272eec4674e6af2
%define geo_state ON
%define pressure_state ON
%define temperature_state ON
+%define ultraviolet_state ON
%define orientation_state ON
%define gravity_state ON
%define linear_accel_state ON
-DLINEAR_ACCEL=%{linear_accel_state} -DRV=%{rv_state} \
-DGEOMAGNETIC_RV=%{geomagnetic_rv_state} -DGAMING_RV=%{gaming_rv_state} \
-DUNCAL_GYRO=%{uncal_gyro_state} -DAUTO_ROTATION=%{auto_rotation_state} \
- -DTILT=%{tilt_state} -DTEST_SUITE=%{build_test_suite} \
+ -DTILT=%{tilt_state} -DULTRAVIOLET=%{ultraviolet_state} \
+ -DTEST_SUITE=%{build_test_suite} \
-DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir}
%build
<MODULE path = "/usr/lib/sensord/liblight_sensor_hal.so"/>
<MODULE path = "/usr/lib/sensord/libpressure_sensor_hal.so"/>
<MODULE path = "/usr/lib/sensord/libtemperature_sensor_hal.so"/>
+ <MODULE path = "/usr/lib/sensord/libultraviolet_sensor_hal.so"/>
</HAL>
<SENSOR>
<MODULE path = "/usr/lib/sensord/libgaming_rv_sensor.so"/>
<MODULE path = "/usr/lib/sensord/libtilt_sensor.so"/>
<MODULE path = "/usr/lib/sensord/libuncal_gyro_sensor.so"/>
+ <MODULE path = "/usr/lib/sensord/libultraviolet_sensor.so"/>
</SENSOR>
</PLUGIN>
<MIN_RANGE value="0"/>
<MAX_RANGE value="15"/>
</MODEL>
+ <MODEL id="MAX86902_UV">
+ <NAME value="MAX86902_UV" />
+ <VENDOR value="MAXIM"/>
+ <RAW_DATA_UNIT value="0.1"/>
+ <MIN_RANGE value="0"/>
+ <MAX_RANGE value="15"/>
+ </MODEL>
</ULTRAVIOLET>
</SENSOR>
install(FILES sensor_temperature.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_motion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_fusion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
+install(FILES sensor_ultraviolet.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_deprecated.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_uncal_gyro.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, FUSION_SENSOR, 0, 1),
FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, TILT_SENSOR, 0, 1),
FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, UNCAL_GYROSCOPE_SENSOR, 0, 1),
+ FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ULTRAVIOLET_SENSOR, 0, 1),
FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_CALIBRATION_NEEDED_EVENT, 0, 1),
FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_CHANGE_STATE_EVENT, 0,1),
FILL_LOG_ELEMENT(LOG_ID_EVENT, FUSION_EVENT, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, TILT_RAW_DATA_EVENT, 0, 10),
FILL_LOG_ELEMENT(LOG_ID_EVENT, UNCAL_GYRO_RAW_DATA_EVENT, 0, 10),
+ FILL_LOG_ELEMENT(LOG_ID_EVENT, ULTRAVIOLET_RAW_DATA_EVENT, 0, 10),
};
typedef unordered_map<unsigned int, log_attr* > log_map;
#include <sensor_fusion.h>
#include <sensor_tilt.h>
#include <sensor_uncal_gyro.h>
-
+#include <sensor_ultraviolet.h>
typedef void (*sensor_cb_t)(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data);
typedef void (*sensorhub_cb_t)(sensor_t sensor, unsigned int event_type, sensorhub_data_t *data, void *user_data);
#include <sensor_deprecated.h>
#include <sensor_fusion.h>
#include <sensor_tilt.h>
+#include <sensor_ultraviolet.h>
#include <sensor_uncal_gyro.h>
#define MAX_KEY_LEN 30
target_link_libraries(${SENSOR_NAME} ${uv_pkgs_LDFLAGS} "-lm")
target_link_libraries(${SENSOR_HAL_NAME} ${uv_pkgs_LDFLAGS})
-install(TARGETS ${SENSOR_NAME} DESTINATION lib/sensord)
-install(TARGETS ${SENSOR_HAL_NAME} DESTINATION lib/sensord)
+install(TARGETS ${SENSOR_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/sensord)
+install(TARGETS ${SENSOR_HAL_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/sensord)
{
m_name = string(SENSOR_NAME);
- register_supported_event(ULTRAVIOLET_EVENT_RAW_DATA_REPORT_ON_TIME);
+ register_supported_event(ULTRAVIOLET_RAW_DATA_EVENT);
physical_sensor::set_poller(ultraviolet_sensor::working, this);
}
return false;
}
- sensor_properties_t properties;
+ sensor_properties_s properties;
- if (!m_sensor_hal->get_properties(properties)) {
+ if (m_sensor_hal->get_properties(properties) == false) {
ERR("sensor->get_properties() is failed!\n");
return false;
}
m_sensor_hal->get_sensor_data(event.data);
+
AUTOLOCK(m_client_info_mutex);
- if (get_client_cnt(ULTRAVIOLET_EVENT_RAW_DATA_REPORT_ON_TIME)) {
+ if (get_client_cnt(ULTRAVIOLET_RAW_DATA_EVENT)) {
event.sensor_id = get_id();
- event.event_type = ULTRAVIOLET_EVENT_RAW_DATA_REPORT_ON_TIME;
+ event.event_type = ULTRAVIOLET_RAW_DATA_EVENT;
raw_to_base(event.data);
push(event);
}
return stop_poll();
}
-bool ultraviolet_sensor::get_properties(sensor_properties_t &properties)
+bool ultraviolet_sensor::get_properties(sensor_properties_s &properties)
{
return m_sensor_hal->get_properties(properties);
}
if (ret < 0)
return -1;
- if (type == ULTRAVIOLET_BASE_DATA_SET) {
+ if (type == ULTRAVIOLET_RAW_DATA_EVENT) {
raw_to_base(data);
return 0;
}
void ultraviolet_sensor::raw_to_base(sensor_data_t &data)
{
- /*
- double lsb = data.values[0];
- double comp_lsb;
-
- const double c = 0.89;
- const double e = 2.12;
- const double f = -132.8;
-
- if (lsb > 108.8f)
- comp_lsb = e * lsb + f;
- else
- comp_lsb = c * lsb;
-
- data.values[0] = comp_lsb * m_resolution;
- */
data.values[0] = data.values[0] * m_resolution;
data.value_count = 1;
}
virtual ~ultraviolet_sensor();
bool init();
- sensor_type_t get_type(void);
+ virtual sensor_type_t get_type(void);
static bool working(void *inst);
-
- bool set_interval(unsigned long interval);
- virtual bool get_properties(sensor_properties_t &properties);
- int get_sensor_data(unsigned int type, sensor_data_t &data);
-
+ virtual bool set_interval(unsigned long interval);
+ virtual bool get_properties(sensor_properties_s &properties);
+ virtual int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
sensor_hal *m_sensor_hal;
float m_resolution;
using std::ifstream;
-#define SENSOR_TYPE_ULTRAVIOLET "ULTRAVIOLET"
+#define SENSOR_TYPE_ULTRAVIOLET "ULTRAVIOLET"
#define ELEMENT_NAME "NAME"
#define ELEMENT_VENDOR "VENDOR"
#define ELEMENT_RAW_DATA_UNIT "RAW_DATA_UNIT"
++read_input_cnt;
- if (ultraviolet_event.type == EV_REL && ultraviolet_event.code == REL_MISC) {
+ if (ultraviolet_event.type == EV_REL && ultraviolet_event.code == REL_X) {
ultraviolet_raw = (int)ultraviolet_event.value - BIAS;
ultraviolet = true;
} else if (ultraviolet_event.type == EV_SYN) {
{
AUTOLOCK(m_value_mutex);
data.accuracy = SENSOR_ACCURACY_GOOD;
- data.timestamp = m_fired_time ;
+ data.timestamp = m_fired_time;
data.value_count = 1;
data.values[0] = (float) m_ultraviolet;
return 0;
}
-
-bool ultraviolet_sensor_hal::get_properties(sensor_properties_t &properties)
+bool ultraviolet_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long val);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- virtual bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
+
private:
string m_model_id;
string m_vendor;