Reply
Thread Tools
Posts: 121 | Thanked: 75 times | Joined on Oct 2009
#1
I'm trying to write something where I have to make a notification to a user when they are on a call.
Preferably this would be a sound notification but a small vibration would do. Something like when you get a second call or message.

I'm using QT but the multimedia framework doesn't play on a call. Is there anything I can use to notify a user of an event when they are on a call
 
Posts: 13 | Thanked: 18 times | Joined on Jun 2009 @ India
#2
I am not sure about playing sound, but for vibration I am using following code, You can try that out if works for you.

void Sample::enableVibration()
{
#ifdef Q_WS_MAEMO_5
mDbusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
MCE_REQUEST_IF, QDBusConnection::systemBus(),
this);

mDbusInterface->call(MCE_ENABLE_VIBRATOR);

#endif
}

void Sample::vibrate(int aTimeout)
{
#ifdef Q_WS_MAEMO_5

mDbusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternIncomingCall");
QTimer::singleShot(aTimeout,this,SLOT(stopVibratio n()));
#endif
}

void Sample::stopVibration()
{
#ifdef Q_WS_MAEMO_5
mDbusInterface->call(MCE_DEACTIVATE_VIBRATOR_PATTERN, "PatternIncomingCall");
#endif
}
 

The Following User Says Thank You to kunal_the_one For This Useful Post:
Posts: 44 | Thanked: 28 times | Joined on Mar 2010
#3
Originally Posted by kunal_the_one View Post
I am not sure about playing sound, but for vibration I am using following code, You can try that out if works for you.

void Sample::enableVibration()
{
#ifdef Q_WS_MAEMO_5
mDbusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
MCE_REQUEST_IF, QDBusConnection::systemBus(),
this);

mDbusInterface->call(MCE_ENABLE_VIBRATOR);

#endif
}

void Sample::vibrate(int aTimeout)
{
#ifdef Q_WS_MAEMO_5

mDbusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternIncomingCall");
QTimer::singleShot(aTimeout,this,SLOT(stopVibratio n()));
#endif
}

void Sample::stopVibration()
{
#ifdef Q_WS_MAEMO_5
mDbusInterface->call(MCE_DEACTIVATE_VIBRATOR_PATTERN, "PatternIncomingCall");
#endif
}
Are you able to vibrate the phone while on a call with this?
I tried the exact same thing via python/dbus, but to no avail.
 
Posts: 13 | Thanked: 18 times | Joined on Jun 2009 @ India
#4
Hi,

did not tried this while on call, will try soon and let you know.
 
Posts: 121 | Thanked: 75 times | Joined on Oct 2009
#5
I tested the above while on a call and it didn't do anything
 
Posts: 121 | Thanked: 75 times | Joined on Oct 2009
#6
I found a way to get a vibration when on a call.

If, as root, you call

Code:
echo 100 > /sys/class/leds/twl4030\:vibrator/brightness
it will enable the vibration and it works when on a call

Code:
echo 0 > /sys/class/leds/twl4030\:vibrator/brightness
will disable vibration.

So from C \ C++ you can open the file and write to it to enable vibration. The only potential issue is that your application must be running as root.



For sound notifications I haven't gotten anything working yet.
I've tried creating my own pulsesink as described here and chaning the media.name to some of the tone one's described in the conf file but can get nothing working yet.
 

The Following User Says Thank You to matrim For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 13:00.