mirror of git://git.sysmocom.de/ofono
test: Add scripts for creating Internet and MMS contexts
This commit is contained in:
parent
501f4fd1d8
commit
88ff795fcb
|
@ -356,9 +356,11 @@ doc_files = doc/overview.txt doc/ofono-paper.txt \
|
||||||
|
|
||||||
|
|
||||||
test_scripts = test/backtrace \
|
test_scripts = test/backtrace \
|
||||||
test/create-context \
|
test/create-internet-context \
|
||||||
|
test/create-mms-context \
|
||||||
test/activate-context \
|
test/activate-context \
|
||||||
test/deactivate-context \
|
test/deactivate-context \
|
||||||
|
test/deactivate-all \
|
||||||
test/dial-number \
|
test/dial-number \
|
||||||
test/list-calls \
|
test/list-calls \
|
||||||
test/answer-calls \
|
test/answer-calls \
|
||||||
|
@ -370,7 +372,6 @@ test_scripts = test/backtrace \
|
||||||
test/hangup-all \
|
test/hangup-all \
|
||||||
test/hangup-active \
|
test/hangup-active \
|
||||||
test/set-roaming-allowed \
|
test/set-roaming-allowed \
|
||||||
test/set-context \
|
|
||||||
test/list-contexts \
|
test/list-contexts \
|
||||||
test/list-modems \
|
test/list-modems \
|
||||||
test/list-operators \
|
test/list-operators \
|
||||||
|
@ -409,8 +410,7 @@ test_scripts = test/backtrace \
|
||||||
test/unlock-pin \
|
test/unlock-pin \
|
||||||
test/enable-gprs \
|
test/enable-gprs \
|
||||||
test/disable-gprs \
|
test/disable-gprs \
|
||||||
test/get-icon \
|
test/get-icon
|
||||||
test/deactivate-all
|
|
||||||
|
|
||||||
if TEST
|
if TEST
|
||||||
testdir = $(pkglibdir)/test
|
testdir = $(pkglibdir)/test
|
||||||
|
|
|
@ -18,19 +18,30 @@ for path, properties in modems:
|
||||||
'org.ofono.ConnectionManager')
|
'org.ofono.ConnectionManager')
|
||||||
|
|
||||||
contexts = connman.GetContexts()
|
contexts = connman.GetContexts()
|
||||||
|
path = "";
|
||||||
|
|
||||||
if (len(contexts) == 0):
|
for i, properties in contexts:
|
||||||
|
if properties["Type"] == "internet":
|
||||||
|
path = i
|
||||||
|
break
|
||||||
|
|
||||||
|
if path == "":
|
||||||
path = connman.AddContext("internet")
|
path = connman.AddContext("internet")
|
||||||
|
print "Created new context %s" % (path)
|
||||||
else:
|
else:
|
||||||
path = contexts[0][0]
|
print "Found context %s" % (path)
|
||||||
|
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.ConnectionContext')
|
'org.ofono.ConnectionContext')
|
||||||
|
|
||||||
try:
|
if len(sys.argv) > 1:
|
||||||
context.SetProperty("AccessPointName", sys.argv[1])
|
context.SetProperty("AccessPointName", sys.argv[1])
|
||||||
except IndexError:
|
print "Setting APN to %s" % (sys.argv[1])
|
||||||
print "Usage: %s <apn_name>" % sys.argv[0]
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
print "Setting APN of %s to %s" % (path, sys.argv[1])
|
if len(sys.argv) > 2:
|
||||||
|
context.SetProperty("Username", sys.argv[2])
|
||||||
|
print "Setting username to %s" % (sys.argv[2])
|
||||||
|
|
||||||
|
if len(sys.argv) > 3:
|
||||||
|
context.SetProperty("Password", sys.argv[3])
|
||||||
|
print "Setting password to %s" % (sys.argv[3])
|
|
@ -18,24 +18,30 @@ for path, properties in modems:
|
||||||
'org.ofono.ConnectionManager')
|
'org.ofono.ConnectionManager')
|
||||||
|
|
||||||
contexts = connman.GetContexts()
|
contexts = connman.GetContexts()
|
||||||
|
path = "";
|
||||||
|
|
||||||
if len(contexts) < 1:
|
for i, properties in contexts:
|
||||||
print "No context available"
|
if properties["Type"] == "mms":
|
||||||
exit(1)
|
path = i
|
||||||
|
break
|
||||||
|
|
||||||
|
if path == "":
|
||||||
|
path = connman.AddContext("mms")
|
||||||
|
print "Created new context %s" % (path)
|
||||||
else:
|
else:
|
||||||
path = contexts[0][0]
|
print "Found context %s" % (path)
|
||||||
|
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.ConnectionContext')
|
'org.ofono.ConnectionContext')
|
||||||
|
|
||||||
try:
|
if len(sys.argv) > 1:
|
||||||
context.SetProperty("AccessPointName", sys.argv[1])
|
context.SetProperty("AccessPointName", sys.argv[1])
|
||||||
if len(sys.argv) > 2:
|
print "Setting APN to %s" % (sys.argv[1])
|
||||||
context.SetProperty("Username", sys.argv[2])
|
|
||||||
if len(sys.argv) > 3:
|
|
||||||
context.SetProperty("Password", sys.argv[3])
|
|
||||||
except IndexError:
|
|
||||||
print "Usage: %s <apn_name> [username] [password]" % sys.argv[0]
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
print "Setting APN of %s to %s" % (path, sys.argv[1])
|
if len(sys.argv) > 2:
|
||||||
|
context.SetProperty("Username", sys.argv[2])
|
||||||
|
print "Setting username to %s" % (sys.argv[2])
|
||||||
|
|
||||||
|
if len(sys.argv) > 3:
|
||||||
|
context.SetProperty("Password", sys.argv[3])
|
||||||
|
print "Setting password to %s" % (sys.argv[3])
|
Loading…
Reference in New Issue