1 #include <sys/stat.h>
\r
2 #include <Edje_Multisense_Ui_Module.h>
\r
3 #include <mmf/mm_sound.h>
\r
5 #include <mmf/mm_sound_private.h>
\r
6 #include <devman_haptic.h>
\r
8 int dev_handle = -1 ;
\r
9 Eina_Bool aui_haptic_play(char* filename,int iteration)
\r
13 if(dev_handle!=-1)device_haptic_close(dev_handle) ;
\r
14 dev_handle= device_haptic_open(1,mode);
\r
15 if(dev_handle < 0)return EINA_FALSE ;
\r
16 ret_val = device_haptic_play_file(dev_handle,filename,iteration,3);
\r
22 EAPI Eina_Bool ems_ui_sound_play(Edje_Sound_Info* sinfo, Edje_Sound_Data* sdata, unsigned int it)
\r
24 int volume_level = 0 ;
\r
29 /*Checking for silent profile */
\r
30 if(vconf_get_int(VCONFKEY_SETAPPL_CUR_PROFILE_INT,&sound_profile ) ) ;
\r
31 if( sound_profile==1 )return EINA_FALSE;
\r
32 if( vconf_get_int(VCONFKEY_SETAPPL_PROFILE_NORMAL_CALL_VOLUME_INT,&volume_level)==-1)return EINA_FALSE ;
\r
33 if( sinfo==NULL )return EINA_FALSE ;
\r
34 snprintf(buf,sizeof(buf),"/tmp/%s",sinfo->name) ;
\r
35 /* Sound File already present in the /tmp directory */
\r
36 if (stat(buf,&st) == 0)
\r
38 f = fopen(buf,"wb") ;
\r
41 if (fwrite(sdata->sound_data, sdata->sound_size, 1, f) != 1)
\r
48 mm_sound_play_keysound(buf,volume_level) ;
\r
52 int HexToDec(const char* strHex)
\r
57 for(p = (strHex + strlen(strHex)); p >= strHex; --p)
\r
59 if( p[0] == ' ' || p[0] == 0) continue ;
\r
60 if(p[0] < 'A') nRetVal += nFactor * (p[0] - '0');
\r
61 else if(p[0] < 'a') nRetVal += nFactor * (p[0] - 'A' + 10);
\r
62 else nRetVal += nFactor * (p[0] - 'a' + 10);
\r
69 EAPI Eina_Bool ems_ui_haptic_play(Edje_Haptic_Info *haptic, unsigned int iterations)
\r
71 char *pattern =NULL ;
\r
72 pattern=(char*)malloc(strlen(haptic->pattern)) ;
\r
73 strcpy(pattern, haptic->pattern);
\r
83 snprintf(buf,sizeof(buf),"/tmp/%s.ivt",haptic->name) ;
\r
84 FILE *f=fopen(buf,"w") ;
\r
93 while (a <= counter)
\r
95 test[0]= pattern[i] ;
\r
96 test[1]=pattern[i+1] ;
\r
98 data=HexToDec(test) ;
\r
104 if(aui_haptic_play(buf,iterations)==EINA_TRUE) ;
\r