// Register Callback to get the change of contact
MsgInitContactSvc(&MsgContactChangedCallback);
- MsgSoundPlayStart();
+ MsgSoundInitRepeatAlarm();
+
return (void*)0;
}
bool MsgSoundCreateRepeatAlarm(int RepeatTime);
int MsgSoundRepeatAlarmCB(int TimerId, void *pUserParam);
int MsgSoundGetUnreadMsgCnt();
+void MsgSoundInitRepeatAlarm();
#endif // MSG_SOUND_PLAYER_H
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
+
+static gboolean MsgStopAndExit(void* data)
+{
+ MsgSoundPlayStop();
+ if(!bPlaying && !bVibrating)
+ worker_done();
+
+ return FALSE;
+}
+
+static gboolean MsgUninitAndExit(void* data)
+{
+ MsgSoundPlayUninit();
+ if(!bPlaying && !bVibrating)
+ worker_done();
+
+ return FALSE;
+}
+
static gboolean MsgSoundMelodyTimeout(gpointer data)
{
MSG_BEGIN();
{
case MM_MESSAGE_ERROR:
MSG_DEBUG("ERROR is happened.");
- MsgSoundPlayUninit();
+ g_idle_add (MsgUninitAndExit, NULL);
break;
case MM_MESSAGE_BEGIN_OF_STREAM:
MSG_DEBUG("Play is started.");
case MM_MESSAGE_END_OF_STREAM:
case MM_MESSAGE_STATE_INTERRUPTED:
MSG_DEBUG("EOS or Interrupted.");
- MsgSoundPlayStop();
- if(!bPlaying && !bVibrating)
- worker_done();
+ g_idle_add (MsgStopAndExit, NULL);
break;
default:
MSG_DEBUG("message = %d", message);
if (childpid == 0)
{
MSG_DEBUG("Child Process - Run helper app for Sound");
- int nRepeatValue = 0;
- nRepeatValue = MsgSettingGetInt(MSG_ALERT_TONE);
-
- if(nRepeatValue != MSG_ALERT_TONE_ONCE)
- execl("/usr/bin/msg-helper", MSG_SOUND_START, NULL);
+ execl("/usr/bin/msg-helper", MSG_SOUND_START, NULL);
MSG_DEBUG("Faild to run helper app for Sound");
return unreadCnt;
}
+void MsgSoundInitRepeatAlarm()
+{
+ MSG_BEGIN();
+
+ int nRepeatValue = 0;
+ long nRepeatTime = 0;
+
+ g_bRepeat = false;
+
+ if (MsgSoundGetUnreadMsgCnt() <= 0) {
+ MSG_DEBUG("no unread msg");
+ return;
+ }
+
+ nRepeatValue = MsgSettingGetInt(MSG_ALERT_TONE);
+
+ switch (nRepeatValue)
+ {
+ case MSG_ALERT_TONE_ONCE:
+ nRepeatTime = 0;
+ break;
+
+ case MSG_ALERT_TONE_2MINS:
+ nRepeatTime = 2;
+ break;
+
+ case MSG_ALERT_TONE_5MINS:
+ nRepeatTime = 5;
+ break;
+
+ case MSG_ALERT_TONE_10MINS:
+ nRepeatTime = 10;
+ break;
+
+ default:
+ MSG_DEBUG("Invalid Repetition time");
+ break;
+ }
+
+ MSG_DEBUG("nRepeatTime = %d", nRepeatTime);
+
+ if (nRepeatTime > 0)
+ MsgSoundPlayStart();
+
+ MSG_END();
+}