All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: Add sms bearer set and SMSC set scripts
@ 2016-03-22 10:49 Samrat Guha Niyogi
  2016-03-22 15:34 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Samrat Guha Niyogi @ 2016-03-22 10:49 UTC (permalink / raw)
  To: ofono

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

From: Anirudh Gargi <anirudh.gargi@intel.com>

---
 test/set-sms-bearer | 31 +++++++++++++++++++++++++++++++
 test/set-sms-smsc   | 31 +++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100755 test/set-sms-bearer
 create mode 100755 test/set-sms-smsc

diff --git a/test/set-sms-bearer b/test/set-sms-bearer
new file mode 100755
index 0000000..33e64e3
--- /dev/null
+++ b/test/set-sms-bearer
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import sys
+import dbus
+
+if len(sys.argv) < 2:
+        print("Usage: %s <bearer> Bearer types: <cs-only> <ps-only> <cs-preferred> <ps-preferred>" %\
+                                        (sys.argv[0]))
+        sys.exit(1)
+
+def message_bearer(sms, value):
+	try:
+            sms.SetProperty("Bearer", dbus.String(value))
+	except dbus.DBusException as e:
+            print("Unable to set Bearer[%s] - FAIL" % (value))
+            exit(1)
+
+bus = dbus.SystemBus()
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),'org.ofono.Manager')
+modems = manager.GetModems()
+value  = sys.argv[1]
+
+for path, properties in modems:
+	print("Setting bearer for [ %s ]" % (path))
+
+	if "org.ofono.MessageManager" not in properties["Interfaces"]:
+		continue
+
+        sms = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.MessageManager')
+
+        message_bearer(sms, value)
+        print("SMS Bearer updated for [ %s ]" % (path))
diff --git a/test/set-sms-smsc b/test/set-sms-smsc
new file mode 100755
index 0000000..7fc9e4d
--- /dev/null
+++ b/test/set-sms-smsc
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import sys
+import dbus
+
+if len(sys.argv) < 2:
+        print("Usage: %s <SMSC address>" % (sys.argv[0]))
+        sys.exit(1)
+
+def message_service_center_address(sms, value):
+        try:
+            sms.SetProperty("ServiceCenterAddress", dbus.String(value))
+        except dbus.DBusException as e:
+            print("Unable to set correct Service Center Address - FAIL")
+	    exit(1)
+
+bus = dbus.SystemBus()
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),'org.ofono.Manager')
+modems = manager.GetModems()
+value  = sys.argv[1]
+
+for path, properties in modems:
+	print("Setting SMSC for [ %s ]" % (path))
+
+	if "org.ofono.MessageManager" not in properties["Interfaces"]:
+		continue
+
+	sms = dbus.Interface(bus.get_object('org.ofono', path),
+					'org.ofono.MessageManager')
+        
+        message_service_center_address(sms, value)
+        print("SMSC address Updated for [ %s ]" % (path))
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-22 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 10:49 [PATCH] test: Add sms bearer set and SMSC set scripts Samrat Guha Niyogi
2016-03-22 15:34 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.