Skip to contentSkip to conversation

plugins: Add allowed APN list

PATCH In review Nishanth V 2 participants 2 messages Apr 20, 2016 Kbuild

lore
Share & tools
lore

Nishanth V

author
#0 lore raw

PATCH 1/1 plugins: Add allowed APN list

---
 Makefile.am                     |   9 +-
 doc/allowed-apns-api.txt        |  17 +++
 plugins/allowed-apns.c          | 272 ++++++++++++++++++++++++++++++++++++++++
 src/simutil.c                   |   1 +
 test/list-allowed-access-points |  25 ++++
 5 files changed, 322 insertions(+), 2 deletions(-)
 create mode 100644 doc/allowed-apns-api.txt
 create mode 100644 plugins/allowed-apns.c
 create mode 100755 test/list-allowed-access-points
Makefile.am +7 -2
index 5cd9766..5215b2e 100644
@@ -572,6 +572,9 @@ builtin_sources += plugins/smart-messaging.c
 builtin_modules += push_notification
 builtin_sources += plugins/push-notification.c
 
+builtin_modules += allowed_apns
+builtin_sources += plugins/allowed-apns.c
+
 sbin_PROGRAMS = src/ofonod
 
 src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
@@ -646,7 +649,8 @@ doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
 			doc/location-reporting-api.txt \
 			doc/certification.txt doc/siri-api.txt \
 			doc/telit-modem.txt \
-			doc/networkmonitor-api.txt
+			doc/networkmonitor-api.txt \
+			doc/allowed-apns-api.txt
 
 
 test_scripts = test/backtrace \
@@ -745,7 +749,8 @@ test_scripts = test/backtrace \
 		test/register-operator \
 		test/set-sms-smsc \
 		test/set-sms-bearer \
-		test/get-serving-cell-info
+		test/get-serving-cell-info \
+		test/list-allowed-access-points
 
 if TEST
 testdir = $(pkglibdir)/test
doc/allowed-apns-api.txt new file +17 -0
new file mode 100644
index 0000000..6bc95d0
@@ -0,0 +1,17 @@
+Allowed APNs hierarchy
+=========================
+
+Service		org.ofono
+Interface	org.ofono.AllowedAccessPoints
+Object path	[variable prefix]/{modem0,modem1,...}
+
+Methods		array{string} GetAllowedAccessPoints()
+
+			Get the list of allowed access points provided
+			in the SIM card.
+
+			This method returns an array of strings which
+			contains a list of Access Point Names supported
+			by network provider. Returns with an error if
+			SIM reading failed or an empty list if there
+			are no access points listed on the SIM.
plugins/allowed-apns.c new file +272 -0

272 lines not on this page · raw message

src/simutil.c +1 -0
index a7745ae..5f8c8b8 100644
@@ -95,6 +95,7 @@ static struct sim_ef_info ef_db[] = {
 {	0x6F4D, 0x7F20, 0x7FFF, EF, RECORD, 0,		PIN,	PIN2	},
 {	0x6F50, 0x7F20, 0x7FFF, EF, BINARY, 0,		PIN,	PIN	},
 {	0x6F56, 0x0000, 0x7FFF, EF, BINARY, 0,		PIN,	PIN2	},
+{	0x6F57,	0x7F20,	0x7FFF,	EF, BINARY, 0,		PIN,	PIN2	},
 {	0x6FAD, 0x7F20, 0x7FFF, EF, BINARY, 0,		ALW,	ADM	},
 {	0x6FAE, 0x7F20, 0x0000, EF, BINARY, 1,		ALW,	ADM	},
 {	0x6FB7, 0x7F20, 0x7FFF, EF, BINARY, 0,		ALW,	ADM	},
test/list-allowed-access-points new file +25 -0
new file mode 100755
index 0000000..c7bb50c
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+						'org.ofono.Manager')
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+	if "org.ofono.AllowedAccessPoints" not in properties["Interfaces"]:
+		continue
+
+	allowedAccessPoints = dbus.Interface(bus.get_object('org.ofono',
+					path), 'org.ofono.AllowedAccessPoints')
+
+	apns = allowedAccessPoints.GetAllowedAccessPoints()
+
+	print("Allowed Access Points for [ %s ]" % (path))
+	for apn in apns:
+		print("    [ %s]" % (apn))
+
+print("")
Signature · 1 line
1.9.1
#1 lore raw

Hi Nishanth,

Quoted 11 lines · Nishanth V
---
  Makefile.am                     |   9 +-
  doc/allowed-apns-api.txt        |  17 +++
  plugins/allowed-apns.c          | 272 ++++++++++++++++++++++++++++++++++++++++
  src/simutil.c                   |   1 +
  test/list-allowed-access-points |  25 ++++
  5 files changed, 322 insertions(+), 2 deletions(-)

create mode 100644 doc/allowed-apns-api.txt create mode 100644 plugins/allowed-apns.c create mode 100755 test/list-allowed-access-points

Looks good, but please submit this as a series. Remember our patch submission guidelines can be found in HACKING 'Submitting patches' section.

So:
- one patch for doc/allowed-apns-api.txt + makefile specific changes
- one patch for simutil.c changes
- one patch for the plugin + required makefile changes
- one patch for test script + required makefile makefile

Regards,
-Denis