Phone control

(From Python :)
(From Python :)
Line 18: Line 18:
     csd_call = dbus.Interface(bus.get_object('com.nokia.csd',
     csd_call = dbus.Interface(bus.get_object('com.nokia.csd',
                                             '/com/nokia/csd/call'),
                                             '/com/nokia/csd/call'),
-
                              'com.nokia.csd.Call')
+
                                            'com.nokia.csd.Call')
     csd_call.CreateWith(str(number), dbus.UInt32(0))
     csd_call.CreateWith(str(number), dbus.UInt32(0))

Revision as of 21:42, 8 January 2010

Contents

[hide]

DBUS

Here's a number of dbus examples that can be run as simple shell scripts. When running them they should be run with `run-standalone.sh` in front of them to set up the environment correctly. Otherwise they may barf when run from cron, startup, install scripts, etc. They run fine when run as user "user" without `run-standalone.sh`. Example:

run-standalone.sh dbus-send /foo bar 'boo'

dbus-send-call

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

With this fantastic command you can make a fone call from the command line. Change $1 to whatever number you want, or if you put this in a shell script, run it and use the number you want to call as the option, ala:

dbus-send-call 15555551234

From Python :

 import dbus
 def place_call(number):
   bus = dbus.SystemBus()
   csd_call = dbus.Interface(bus.get_object('com.nokia.csd',
                                            '/com/nokia/csd/call'),
                                            'com.nokia.csd.Call')
   csd_call.CreateWith(str(number), dbus.UInt32(0))

dbus-send-call-start-ui

dbus-send --print-reply --type=method_call --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:'rtcom-call-ui'

dbus-release-call

dbus-send --system --dest=com.nokia.csd.Call --print-reply \
/com/nokia/csd/call com.nokia.csd.Call.Release

This will release/end/hangup/reject the current call (or possibly all calls if more then one call is active - needs testing to verify behavior when more then 1 call active) or do nothing if no calls are active.

dbus-send-activate-led

dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate string:PatternCommunicationIM

dbus-send-deactivate-led

dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate string:PatternCommunicationIM

dbus-send-disconnect-net

dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true

dbus-send-email-new

dbus-send --print-reply --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.MailTo string:mailto:

dbus-send-email-tx-rx

Doesn't work

dbus-send --session --type=method_call --dest=com.nokia.osso_email /com/nokia/osso_email com.nokia.osso_email.send_and_receive

dbus-send-get-imei

dbus-send --system --print-reply --type=method_call --dest=com.nokia.phone.SIM /com/nokia/phone/SIM/security Phone.Sim.Security.get_imei

dbus-send-google

dbus-send --system --type=method_call --dest="com.nokia.osso_browser" --print-reply /com/nokia/osso_browser/request com.nokia.osso_browser.load_url string:"google.com"

dbus-send-hello-world

dbus-send --print-reply  \
--type=method_call --dest=org.freedesktop.Notifications  \
/org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog  \
string:'Hello, world!' uint32:0 string:'NAO OK!'

dbus-send-im-here

dbus-send --type=method_call --print-reply --dest=org.freedesktop.Telepathy.MissionControl /org/freedesktop/Telepathy/MissionControl org.freedesktop.Telepathy.MissionControl.SetPresence uint32:2 string:"I'm here"

dbus-send-lock

dbus-send --print-reply --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:'com.nokia.mce' string:'/com/nokia/mce/request' string:'com.nokia.mce.request' string:'devlock_callback' uint32:'3'

dbus-send-media-play

dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"file:///$1"

dbus-send-music-pause

dbus-send --dest=com.nokia.osso_media_server /com/nokia/osso_media_server com.nokia.osso_media_server.music.pause

dbus-send-notification

Usage:

dbus-send-notification "foo bar boo bah bang"
dbus-send --print-reply  \
--type=method_call --dest=org.freedesktop.Notifications  \
/org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog  \
string:"$1" uint32:0 string:'NAO OK!'

From Python :

 import dbus
 def show_notification_dialog(message, mode="single"):
   bus = dbus.SystemBus()
   iface = dbus.Interface(bus.get_object('org.freedesktop.Notifications',
                                         '/org/freedesktop/Notifications'),
                                         'org.freedesktop.Notifications')
   if mode == "single":
       iface.SystemNoteInfoprint(message)
   elif mode == "multiline":
       iface.SystemNoteDialog(str(message), dbus.UInt32(0), 'Ok')

This function allows you to show notification either with multiline (on maemo pre-5 it will show a dialog with an "Ok" button) or single line (tiny notifications hiding automatically).

dbus-send-pause-panucci

dbus-send --type="method_call" --dest=org.panucci.panucciInterface /panucciInterface org.panucci.panucciInterface.playPause

dbus-send-reboot

dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.req_reboot

dbus-send-regist-status

dbus-send --system --print-reply --type=method_call --dest='com.nokia.phone.net' /com/nokia/phone/net Phone.Net.get_registration_status

dbus-send-show_conn

dbus-send --print-reply --system --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:true

dbus-send-shutdown

dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.req_shutdown

dbus-send-speaker-off

dbus-send --type=method_call --dest=com.nokia.osso_hp_ls_controller /com/nokia/osso_hp_ls_controller com.nokia.osso_hp_ls_controller.loudspeaker.force_ loudspeaker_off

dbus-send-speaker-on

dbus-send --type=method_call --dest=com.nokia.osso_hp_ls_controller /com/nokia/osso_hp_ls_controller com.nokia.osso_hp_ls_controller.loudspeaker.force_ loudspeaker_on

dbus-send-task-switcher

dbus-send --type=signal --session /com/nokia/hildon_desktop com.nokia.hildon_desktop.exit_app_view

dbus-send-unlock

dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"unlocked"

dbus-send-unlock2

dbus-send --print-reply --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_close string:'com.nokia.mce' string:'/com/nokia/mce/request' string:'com.nokia.mce.request' string:'devlock_callback' uint32:'0'