View Single Post
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#945
Originally Posted by matristain View Post
Hi , Just starting with QBW I`ll appreciate some help.

I have this code on a call.sh i create a desktop icon to run it.
It does its work but i am looking for a better way to do this:

Call XXXXXXXXXX number , if call is till a active after 275 seconds Hang Up the call and call XXXXXXXXXX again.


PHP Code:
#!/bin/sh

dbus-send --system --type=method_call --print-reply --dest=com.nokia.csd.Call /com/nokia/csd/call com.nokia.csd.Call.CreateWith string:"XXXXXXXXXX" uint32:0

sleep 275

output
=`dbus-send --system --dest=com.nokia.csd.Call --print-reply=literal /com/nokia/csd/call/1 com.nokia.csd.Call.Instance.GetStatus`
if [ 
"$output== "   uint32 8" ]; then
    dbus
-send --system --dest=com.nokia.csd.Call --print-reply /com/nokia/csd/call com.nokia.csd.Call.Release
    sleep 4
    sh 
/home/user/.call/call.sh
    
exit
    
else
    exit
fi 
What i want is to stop the loop at any time becouse when I hang up manualy the call this scripts continue running and It will hung up any other call i make withing the 275 seconds.

NOTE: this is for a toll free number for less than 5 minuts call, and its very useful using Hands Free car kit.

Sorry for my english, still trying to improve it.
As quick suggestions ...
Avoid sleep 275
And in very-very-very-very metacode:
On widget startup (phone on ecc) $QBW_EXEC_REASON=="QBW_STARTUP_UPDATE", explicitly reset beecon timer parameters (delayIndex = 0 customIntervalSecs = 275) via DBUS method call set_param_uint32 see syntax in the wiki; after resetting both parms, issue a reset_rearm_timer method to the widget

On widget click $QBW_EXEC_REASON=="QBW_CLICK" , check if your very specific call active via usual dbus enquiries
If your specific call is not active (didn't dig how to check this) initiate call and explicitly set beecon timer parameters (delayIndex = 9 customIntervalSecs = 275) via DBUS method call set_param_uint32 see syntax in the wiki; after setting both parms, issue a reset_rearm_timer method to the widget
If your specific call is active (didn't dig how to check this) terminate call and reset widget timer as per QBW_STARTUP_UPDATE step

If execution of script is due to $QBW_EXEC_REASON=="QBW_TIMER_UPDATE" , check if specific call active via usual dbus enquiries
If your very specific call is active, drop call, and reinitiate call (275secs timer will still be in place)
If your very specific call is not active, reset timer as per previous steps

Issue specific exit status at the end of every condition if you want to draw different icons according to call status statuses

Hope this helps
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 

The Following User Says Thank You to No!No!No!Yes! For This Useful Post: