![]() |
2010-11-29
, 12:29
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#2
|
def funcDevOri(): print "** Start Function - Device Orientation **" bus = dbus.SystemBus() accel = bus.get_object('com.nokia.mce','/com/nokia/mce/request','com.nokia.mce.request') orientation , stand , face , x , y , z = accel.get_device_orientation() return orientation
def funcIMEI(): print "** Start Function - Device IMEI **" b = os.popen('run-standalone.sh dbus-send --system --print-reply --type=method_call --dest=com.nokia.phone.SIM /com/nokia/phone/SIM/security Phone.Sim.Security.get_imei').read() b = str(b) b = b.strip() b = str(b)[-27:] b = b.strip() b = str(b)[:-12] return b
def FMTxPropertiesInterfaceConnect(): bus = dbus.SystemBus() dbus_object = bus.get_object('com.nokia.FMTx', '/com/nokia/fmtx/default', False) dbus_interface = dbus.Interface(dbus_object, dbus_interface='org.freedesktop.DBus.Properties') return dbus_interface
![]() |
2010-12-01
, 23:34
|
Posts: 187 |
Thanked: 41 times |
Joined on May 2010
|
#3
|
Check the current Healthcheck code- it was done in python and uses dbus as well as terminal commands
(It will be replaced with a c++ version shortly though!)
But here's an example of using dbus from within python
Code:def funcDevOri(): print "** Start Function - Device Orientation **" bus = dbus.SystemBus() accel = bus.get_object('com.nokia.mce','/com/nokia/mce/request','com.nokia.mce.request') orientation , stand , face , x , y , z = accel.get_device_orientation() return orientation
Or.....
(This is the one you want, as it gets the IMEI, so not too far from what you need!!)
orCode:def funcIMEI(): print "** Start Function - Device IMEI **" b = os.popen('run-standalone.sh dbus-send --system --print-reply --type=method_call --dest=com.nokia.phone.SIM /com/nokia/phone/SIM/security Phone.Sim.Security.get_imei').read() b = str(b) b = b.strip() b = str(b)[-27:] b = b.strip() b = str(b)[:-12] return b
Code:def FMTxPropertiesInterfaceConnect(): bus = dbus.SystemBus() dbus_object = bus.get_object('com.nokia.FMTx', '/com/nokia/fmtx/default', False) dbus_interface = dbus.Interface(dbus_object, dbus_interface='org.freedesktop.DBus.Properties') return dbus_interface
![]() |
2010-12-02
, 08:53
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#4
|
![]() |
2010-12-02
, 09:58
|
Posts: 187 |
Thanked: 41 times |
Joined on May 2010
|
#5
|
![]() |
2010-12-02
, 10:08
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#6
|
Hi noobmonkey, it is better i explain with examples:
i can turn this dbus-send call
dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"message"
IN
import dbus
bus = dbus.SystemBus()
iface = dbus.Interface(bus.get_object('org.freedesktop.Not ifications',
'/org/freedesktop/Notifications'),
'org.freedesktop.Notifications')
iface.SystemNoteInfoprint('message')
but how can i convert bus-send --system --print-reply --type=method_call --dest=com.nokia.phone.SIM /com/nokia/phone/SIM/security Phone.Sim.Security.get_imei' in to that second way ?
![]() |
2010-12-06
, 10:16
|
Posts: 3 |
Thanked: 2 times |
Joined on Dec 2010
|
#7
|
The Following 2 Users Say Thank You to salatiel For This Useful Post: | ||
dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.SIM /com/nokia/phone/SIM Phone.Sim.get_imsi