View Single Post
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#2
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!!)
Code:
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
or

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
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 

The Following 2 Users Say Thank You to noobmonkey For This Useful Post: