Open Source Telephony
 help / color / mirror / Atom feed
From: Jens Rehsack <jr_extern@vfnet.de>
To: ofono@ofono.org
Subject: New test scripts ...
Date: Tue, 26 Jun 2012 11:24:59 +0200	[thread overview]
Message-ID: <4FE97FEB.3080607@vfnet.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

Hi all,

for personal requirements (debugging) I added 3 simple scripts
(attached) to dump the properties of specific modem interfaces.

Shall I send patches for them or are they useless for the project?
(For the records: I don't mind either)

Best regards,
Jens

[-- Attachment #2: nw-properties.ksh --]
[-- Type: text/plain, Size: 1348 bytes --]

#!/usr/bin/python

# from dbus import SystemBus, Interface, DBusException, UInt32, Int32, UInt64, Int64, Boolean
import sys
import dbus

def dedbustype(v):
	if isinstance(v, bool) or isinstance(v, dbus.Boolean):
		return bool(v)
	elif isinstance(v, float):
		return float(v)
	elif isinstance(v, int) or isinstance(v, dbus.Int64) or isinstance(v, dbus.UInt64) or isinstance(v, dbus.Int32) or isinstance(v, dbus.UInt32):
		return int(v)
	elif isinstance(v, basestring):
		return unicode(v)
	elif isinstance(v, dict):
		return dict([(str(n), dedbustype(m), ) for n, m in v.items()]) # use strings for names to allow **
	elif isinstance(v, list) or isinstance(v, tuple):
		return [dedbustype(m) for m in v]
	else:
		raise Exception('unsupported type %s'% type(v))

bus = dbus.SystemBus()

if len(sys.argv) == 2:
	path = sys.argv[1]
elif len(sys.argv) == 1:
	manager = dbus.Interface(bus.get_object('org.ofono', '/'),
					'org.ofono.Manager')
	modems = manager.GetModems()
	path = modems[0][0]
else:
	print "%s [PATH]" % (sys.argv[0])
	sys.exit(0)

nwmanager = dbus.Interface(bus.get_object('org.ofono', path),
				'org.ofono.NetworkRegistration')
properties = nwmanager.GetProperties()
dd_p = dedbustype(properties)
print '--- nwreg_properties', dd_p
operators = nwmanager.GetOperators()
dd_o = dedbustype(operators)
print '--- nwreg_operators', dd_o

[-- Attachment #3: sim-properties.ksh --]
[-- Type: text/plain, Size: 1247 bytes --]

#!/usr/bin/python

# from dbus import SystemBus, Interface, DBusException, UInt32, Int32, UInt64, Int64, Boolean
import sys
import dbus

def dedbustype(v):
	if isinstance(v, bool) or isinstance(v, dbus.Boolean):
		return bool(v)
	elif isinstance(v, float):
		return float(v)
	elif isinstance(v, int) or isinstance(v, dbus.Int64) or isinstance(v, dbus.UInt64) or isinstance(v, dbus.Int32) or isinstance(v, dbus.UInt32):
		return int(v)
	elif isinstance(v, basestring):
		return unicode(v)
	elif isinstance(v, dict):
		return dict([(str(n), dedbustype(m), ) for n, m in v.items()]) # use strings for names to allow **
	elif isinstance(v, list) or isinstance(v, tuple):
		return [dedbustype(m) for m in v]
	else:
		raise Exception('unsupported type %s'% type(v))

bus = dbus.SystemBus()

if len(sys.argv) == 2:
	path = sys.argv[1]
elif len(sys.argv) == 1:
	manager = dbus.Interface(bus.get_object('org.ofono', '/'),
					'org.ofono.Manager')
	modems = manager.GetModems()
	path = modems[0][0]
else:
	print "%s [PATH]" % (sys.argv[0])
	sys.exit(0)

simmanager = dbus.Interface(bus.get_object('org.ofono', path),
				'org.ofono.SimManager')
properties = simmanager.GetProperties()
dd_p = dedbustype(properties)
print '--- sim_manager_properties', dd_p

[-- Attachment #4: radio-properties.ksh --]
[-- Type: text/plain, Size: 1259 bytes --]

#!/usr/bin/python

# from dbus import SystemBus, Interface, DBusException, UInt32, Int32, UInt64, Int64, Boolean
import sys
import dbus

def dedbustype(v):
	if isinstance(v, bool) or isinstance(v, dbus.Boolean):
		return bool(v)
	elif isinstance(v, float):
		return float(v)
	elif isinstance(v, int) or isinstance(v, dbus.Int64) or isinstance(v, dbus.UInt64) or isinstance(v, dbus.Int32) or isinstance(v, dbus.UInt32):
		return int(v)
	elif isinstance(v, basestring):
		return unicode(v)
	elif isinstance(v, dict):
		return dict([(str(n), dedbustype(m), ) for n, m in v.items()]) # use strings for names to allow **
	elif isinstance(v, list) or isinstance(v, tuple):
		return [dedbustype(m) for m in v]
	else:
		raise Exception('unsupported type %s'% type(v))

bus = dbus.SystemBus()

if len(sys.argv) == 2:
	path = sys.argv[1]
elif len(sys.argv) == 1:
	manager = dbus.Interface(bus.get_object('org.ofono', '/'),
					'org.ofono.Manager')
	modems = manager.GetModems()
	path = modems[0][0]
else:
	print "%s [PATH]" % (sys.argv[0])
	sys.exit(0)

radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
				'org.ofono.RadioSettings')
properties = radiosettings.GetProperties()
dd_r = dedbustype(properties)
print '--- radio_settings_properties', dd_r

             reply	other threads:[~2012-06-26  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26  9:24 Jens Rehsack [this message]
2012-06-26 14:56 ` New test scripts Marcel Holtmann
2012-06-27 10:15   ` Jens Rehsack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE97FEB.3080607@vfnet.de \
    --to=jr_extern@vfnet.de \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox