+capi-system-haptic (0.1.0-10) unstable; urgency=low
+
+ * additional fix for lower framework
+ * Git: api/haptic
+ * Tag: capi-system-haptic_0.1.0-10
+
+ -- DongGi Jang <dg0402.jang@samsung.com> Thu, 02 Feb 2012 16:41:18 +0900
+
capi-system-haptic (0.1.0-9) unstable; urgency=low
* patch for lower framework functions
void _haptic_init();
void _haptic_deinit();
-int _haptic_play_monotone(int dev, int duration, haptic_level_e level);
#ifdef __cplusplus
}
id = device_haptic_open(_DEV[i], 0);
if(id < 0) {
for (j=i; i>=0; i--){
- device_haptic_close(_DEV[i]);
+ device_haptic_close(haptic_ids[i]);
}
RETURN_ERR(HAPTIC_ERROR_OPERATION_FAILED);
}
RETURN_ERR(HAPTIC_ERROR_NOT_INITIALIZED);
for(i=0; i<=max_device; i++){
- err = device_haptic_close(_DEV[i]);
+ err = device_haptic_close(haptic_ids[i]);
}
initialize = 0;
if(device_index < 0 || device_index > max_device)
RETURN_ERR(HAPTIC_ERROR_INVALID_PARAMETER);
- device_index = ((device_index < 3) ? _DEV[device_index] : DEV_IDX_ALL); // xxx
+ device_index = ((device_index < 3) ? device_index : 0); // xxx
if(!invalid_ivt(file_name))
RETURN_ERR(HAPTIC_ERROR_NOT_SUPPORTED_FORMAT);
if(device_index < 0 || device_index > max_device)
RETURN_ERR(HAPTIC_ERROR_INVALID_PARAMETER);
- device_index = ((device_index < 3) ? _DEV[device_index] : DEV_IDX_ALL); // xxx
+ device_index = ((device_index < 3) ? device_index : 0); // xxx
if(!initialize)
RETURN_ERR(HAPTIC_ERROR_NOT_INITIALIZED);
if(device_index < 0 || device_index > max_device)
RETURN_ERR(HAPTIC_ERROR_INVALID_PARAMETER);
- device_index = ((device_index < 3) ? _DEV[device_index] : DEV_IDX_ALL); // xxx
+ device_index = ((device_index < 3) ? device_index : 0); // xxx
if(!initialize)
RETURN_ERR(HAPTIC_ERROR_NOT_INITIALIZED);
if(device_index < 0 || device_index > max_device)
RETURN_ERR(HAPTIC_ERROR_INVALID_PARAMETER);
- device_index = ((device_index < 3) ? _DEV[device_index] : DEV_IDX_ALL); // xxx
+ device_index = ((device_index < 3) ? device_index : 0); // xxx
if(!initialize)
RETURN_ERR(HAPTIC_ERROR_NOT_INITIALIZED);
g_array_index(pattern_table, struct _vibe_pattern *, index) = NULL;
}
+static int _haptic_play_monotone(int device_index, long duration, haptic_level_e level)
+{
+ int ret;
+
+ if(device_index < 0 || device_index > max_device)
+ RETURN_ERR(HAPTIC_ERROR_INVALID_PARAMETER);
+
+ device_index = ((device_index < 3) ? device_index : 0); // xxx
+
+ if(!initialize)
+ RETURN_ERR(HAPTIC_ERROR_NOT_INITIALIZED);
+
+
+ ret = device_haptic_play_monotone_with_feedback_level(haptic_ids[device_index], duration, _LEVEL[level]);
+
+ if(ret < 0){
+ if(ret == -2)
+ RETURN_ERR(HAPTIC_ERROR_OPERATION_FAILED);
+ else
+ RETURN_ERR(HAPTIC_ERROR_INVALID_PARAMETER);
+ }
+
+ return HAPTIC_ERROR_NONE;
+}
+
static gboolean _haptic_play_iter(gpointer data)
{
int err;
level = HAPTIC_LEVEL_5;
if(level != HAPTIC_LEVEL_0 || time != 0){
-// err = _haptic_play_monotone(device, time, level);
- err = haptic_vibrate_monotone(device, time);
+ err = _haptic_play_monotone(device, time, level);
if(err<0){
pattern->error = err;
return false;
static int immersion;
-static int IMM_LEVEL[] = {
- 0, 0, 2000, 4000, 6000, 8000, 10000
-};
-
-static int ETC_LEVEL[] = {
- 0,0, 55, 60, 65, 70, 80
-};
-
void _haptic_init()
{
immersion = access(IMMERSION_DRV_NODE, F_OK) == 0;
{
}
-int _haptic_play_monotone(int dev, int duration, haptic_level_e level)
-{
- int status;
- int input = 0;
- unsigned int cmd;
-
- if(duration < 1 || duration > INPUT_PARM_MAX)
- return HAPTIC_ERROR_INVALID_PARAMETER;
-
- dev = DEV_IDX_ALL; // xxx
-
- if(dev != DEV_IDX_ALL && dev != DEV_IDX_0 && dev != DEV_IDX_1)
- return HAPTIC_ERROR_INVALID_PARAMETER;
-
- if(level == HAPTIC_LEVEL_0)
- return HAPTIC_ERROR_NONE;
-
- if(level < HAPTIC_LEVEL_1 || level > HAPTIC_LEVEL_5)
- return HAPTIC_ERROR_INVALID_PARAMETER;
-
- input = immersion ? IMM_LEVEL[level] : ETC_LEVEL[level];
- if(input == 0)
- return HAPTIC_ERROR_NONE;
-
- if (immersion) {
- cmd = COMP_CMD(dev, input);
- status = device_set_property(DEVTYPE_EFFECT_HAPTIC,
- CMD_PROPERTY_SET_STRENGTH, (int)cmd);
-// printf("capi [%d - %d - %d] [%d %d]\n", DEVTYPE_EFFECT_HAPTIC, CMD_PROPERTY_SET_STRENGTH, cmd, dev, input);
- if (status < 0) {
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
-
- cmd = COMP_CMD(dev, 0x05);
- status =
- device_set_property(DEVTYPE_EFFECT_HAPTIC,
- CMD_PROPERTY_SET_PRIORITY, (int)cmd);
- if (status < 0) {
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
- }
-
- if (immersion) {
- cmd = COMP_CMD(dev, duration);
- status =
- device_set_property(DEVTYPE_EFFECT_HAPTIC,
- CMD_SET_NORMAL_PLAY, (int)cmd);
- if (status < 0) {
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
- } else {
- status =
- device_set_property(DEVTYPE_HAPTIC, HAPTIC_PROP_LEVEL,
- input);
- if (status < 0) {
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
-
- status =
- device_set_property(DEVTYPE_HAPTIC, HAPTIC_PROP_ONESHOT,
- duration);
- if (status < 0) {
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
- }
- return HAPTIC_ERROR_NONE;
-}