summaryrefslogtreecommitdiff
path: root/src/cproxi_sim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cproxi_sim.cpp')
-rw-r--r--src/cproxi_sim.cpp48
1 files changed, 30 insertions, 18 deletions
diff --git a/src/cproxi_sim.cpp b/src/cproxi_sim.cpp
index 61124e5..fa7ebbc 100644
--- a/src/cproxi_sim.cpp
+++ b/src/cproxi_sim.cpp
@@ -54,6 +54,9 @@
#define DISTANCE_LIMIT 8
+#define SENSOR_NAME "Emul_ModelId_Proximity"
+#define SENSOR_VENDOR "Emul_Vendor"
+
const char *cproxi_sim::m_port[] = {"vo","enable"};
cproxi_sim::cproxi_sim()
@@ -466,23 +469,29 @@ long cproxi_sim::set_cmd(int type , int property , long input_value)
int cproxi_sim::get_property(unsigned int property_level , void *property_data)
{
-#ifdef TARGET
- if ( (property_level & 0xFFFF) == 1 ) {
- base_property_struct *return_property;
- return_property = (base_property_struct *)property_data;
- return_property->sensor_unit_idx = IDX_UNIT_STATE_ON_OFF;
- return_property->sensor_min_range = 0.;
- return_property->sensor_max_range = 1.;
- return_property->sensor_resolution = 1.;
- return 0;
-
- } else {
- ERR("Doesnot support property_level : %d\n",property_level);
- return -1;
- }
-#endif
-
- return -1;
+ base_property_struct *return_property;
+ return_property = (base_property_struct *)property_data;
+
+ if ( (property_level & 0xFFFF) == 1 ) {
+ base_property_struct *return_property;
+ return_property = (base_property_struct *)property_data;
+ return_property->sensor_unit_idx = IDX_UNIT_STATE_ON_OFF;
+ return_property->sensor_min_range = 0.;
+ return_property->sensor_max_range = 1.;
+ return_property->sensor_resolution = 1.;
+ snprintf(return_property->sensor_name, sizeof(return_property->sensor_name), SENSOR_NAME );
+ snprintf(return_property->sensor_vendor, sizeof(return_property->sensor_vendor), SENSOR_VENDOR);
+ return 0;
+ } else if ( (property_level & 0xFFFF) == 2 ) {
+ return_property->sensor_unit_idx = IDX_UNIT_CENTIMETER;
+ return_property->sensor_min_range = 0;
+ return_property->sensor_max_range = 8;
+ return_property->sensor_resolution = 1;
+ return 0;
+ } else {
+ ERR("Doesnot support property_level : %d\n",property_level);
+ return -1;
+ }
}
int cproxi_sim::get_struct_value(unsigned int struct_type , void *struct_values)
@@ -497,7 +506,10 @@ int cproxi_sim::get_struct_value(unsigned int struct_type , void *struct_values)
return_struct_value->data_unit_idx = IDX_UNIT_STATE_ON_OFF;
return_struct_value->time_stamp = m_fired_time ;
return_struct_value->values_num = 1;
- return_struct_value->values[0] = m_vo;
+ if(m_vo > 3)
+ return_struct_value->values[0] = PROXIMITY_STATE_FAR;
+ else
+ return_struct_value->values[0] = PROXIMITY_STATE_NEAR;
return 0;
} else {