maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   I need to run a script when answering my phone call. (https://talk.maemo.org/showthread.php?t=63992)

WhiteWolf 2010-10-18 16:20

I need to run a script when answering my phone call.
 
Hello,

I need to run a script when answering my phone call. Without using python. The idea is to use QBW or a script in bash / sh.

How I can detect this event? An example please ...

AlMehdi 2010-10-18 16:37

Re: I need to run a script when answering my phone call.
 
MuhammadAG made a prog for this.. "phone.." something i think it was named. It's in the repos... To make dbus-calls easier to use for scripts like this.

stephano21 2010-10-18 16:42

Re: I need to run a script when answering my phone call.
 
Quote:

Originally Posted by WhiteWolf (Post 844246)
Hello,

I need to run a script when answering my phone call. Without using python. The idea is to use QBW or a script in bash / sh.

How I can detect this event? An example please ...

suggest this wiki

http://wiki.maemo.org/Phone_control

Pigro 2010-10-18 16:46

Re: I need to run a script when answering my phone call.
 
No help to OP, but IIRC "phone-control" doesn't detect an incoming call, so you can't use it in a script as it doesn't actually know if/when there is a call there to answer (though it *does* allow you to answer one if it happens to be present when your run phone-control --answercall).

MohammadAG 2010-10-18 16:52

Re: I need to run a script when answering my phone call.
 
This might of some help, part of out-call-vibro
Code:

MohammadAG-N900:~# cat /usr/bin/out-call-vibro.sh
#!/bin/sh


if [ -f /var/run/out-call-vibro/out-call-vibro.pid ]
then
        echo Process is already running...
        exit 1
fi

echo $$ > /var/run/out-call-vibro/out-call-vibro.pid


vibro() {
        if grep -q "Call answered"; then
            if [ `cat /sys/devices/platform/gpio-switch/proximity/state` = "open" ]; then
              echo 150 > /sys/class/leds/twl4030:vibrator/brightness
              gsleep 0.5
              echo 0 > /sys/class/leds/twl4030:vibrator/brightness
            fi
        fi
        }

monitor() {
          dbus-monitor --session type='signal',interface='org.freedesktop.Telepathy.Channel.Interface.Group',member='MembersChanged' | while read line ; do vibro ; done
          }

monitor

# End


AlMehdi 2010-10-18 16:53

Re: I need to run a script when answering my phone call.
 
ahh.. didn't think about that.. then dbus-monitor would solve it ;)

WhiteWolf 2010-10-19 10:32

Re: I need to run a script when answering my phone call.
 
Thanks.

Tests will realize the code.

Also I have to see how to make a daemon that is pending from starting.


All times are GMT. The time now is 15:10.

vBulletin® Version 3.8.8