module = eina_hash_find(g_handle->modules, name);
if (!module) return EINA_FALSE;
-
+
if (module->shutdown)
module->shutdown();
* the downside that the sensor creation takes longer. But that is only a
*initial cost.
*/
- if (module->read(sens->type, sens))
+ if (module->read(sens))
return sens;
free(sens);
if (!module) return EINA_FALSE;
if (module->read)
- return module->read(sens->type, sens);
+ return module->read(sens);
return EINA_FALSE;
}
Eina_Bool (*init)(void); /**< Pointer to module init function */
Eina_Bool (*shutdown)(void); /**< Pointer to module shutdown function */
Eina_Bool (*async_read)(Eeze_Sensor_Type sensor_type, void *user_data); /**< Pointer to module async_read function */
- Eina_Bool (*read)(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *obj); /**< Pointer to module read function */
+ Eina_Bool (*read)(Eeze_Sensor_Obj *obj); /**< Pointer to module read function */
Eina_List *sensor_list; /**< List of sensor objects attached to the module */
} Eeze_Sensor_Module;
}
static Eina_Bool
-fake_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
+fake_read(Eeze_Sensor_Obj *obj)
{
- Eeze_Sensor_Obj *obj = NULL;
-
- obj = eeze_sensor_obj_get(sensor_type);
- if (obj == NULL)
- {
- ERR("No matching sensor object found in list");
- return EINA_FALSE;
- }
-
- switch (sensor_type)
+ switch (obj->type)
{
case EEZE_SENSOR_TYPE_ACCELEROMETER:
case EEZE_SENSOR_TYPE_GRAVITY:
default:
ERR("Not possible to read from this sensor type.");
- free(obj);
return EINA_FALSE;
}
- memcpy(lobj, obj, sizeof(Eeze_Sensor_Obj));
- free(obj);
-
return EINA_TRUE;
}
* the system. Normally it is better to use the asynchronous reading functions.
*/
static Eina_Bool
-eeze_sensor_tizen_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
+eeze_sensor_tizen_read(Eeze_Sensor_Obj *obj)
{
sensor_data_accuracy_e accuracy;
float x, y, z;
float azimuth, pitch, roll, lux, distance, yaw;
bool supported;
sensor_type_e type;
- Eeze_Sensor_Obj *obj;
- type = eeze_to_tizen(sensor_type);
+ type = eeze_to_tizen(obj->type);
/* Don't attempt to do anything if the sensor is not available on the system
* we are running on.
}
sensor_start(sensor_handle, type);
- obj = eeze_sensor_obj_get(sensor_type);
- if (obj == NULL)
- {
- ERR("No matching sensor object found in list.");
- return EINA_FALSE;
- }
switch (type)
{
default:
ERR("Not possible to read from this sensor type.");
- free(obj);
return EINA_FALSE;
}
- memcpy(lobj, obj, sizeof(Eeze_Sensor_Obj));
- free(obj);
sensor_stop(sensor_handle, type);
return EINA_TRUE;
}
}
static Eina_Bool
-udev_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
+udev_read(Eeze_Sensor_Obj *obj)
{
- Eeze_Sensor_Obj *obj = NULL;
-
- obj = eeze_sensor_obj_get(sensor_type);
- if (obj == NULL)
- {
- ERR("No matching sensor object found in list");
- return EINA_FALSE;
- }
-
- switch (sensor_type)
+ switch (obj->type)
{
case EEZE_SENSOR_TYPE_TEMPERATURE:
obj->accuracy = -1;
default:
ERR("Not possible to read from this sensor type.");
- free(obj);
return EINA_FALSE;
}
- memcpy(lobj, obj, sizeof(Eeze_Sensor_Obj));
- free(obj);
-
return EINA_TRUE;
}