| 1 | #!/usr/bin/python |
|---|
| 2 | |
|---|
| 3 | import dbus |
|---|
| 4 | |
|---|
| 5 | apns = { |
|---|
| 6 | 'S COMVIQ': 'internet.parlino.se', |
|---|
| 7 | # 'S COMVIQ': 'internet.tele2.se', |
|---|
| 8 | 'TELIA S': 'internet.telia.se', |
|---|
| 9 | 'vodafone SE': 'services.vodafone.net' |
|---|
| 10 | } |
|---|
| 11 | username = 'x' |
|---|
| 12 | password = 'x' |
|---|
| 13 | |
|---|
| 14 | sbus = dbus.SystemBus() |
|---|
| 15 | obj = 'org.freesmartphone.frameworkd' |
|---|
| 16 | objpath = '/org/freesmartphone/GSM/Device' |
|---|
| 17 | proxy = sbus.get_object(obj, objpath) |
|---|
| 18 | status = proxy.GetStatus(dbus_interface='org.freesmartphone.GSM.Network') |
|---|
| 19 | |
|---|
| 20 | if (status['registration'] != 'home'): |
|---|
| 21 | print "Illegal GSM network registration state: " + status['registration']; |
|---|
| 22 | print "You might want to mdbus -s org.freesmartphone.ophoned /org/freesmartphone/GSM/Device org.freesmartphone.GSM.Network.Register" |
|---|
| 23 | else: |
|---|
| 24 | apn = apns[status['provider']] |
|---|
| 25 | proxy.ActivateContext(apn, username, password, dbus_interface='org.freesmartphone.GSM.PDP') |
|---|