aboutsummaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
Diffstat (limited to 'binding')
-rw-r--r--binding/gdbus/ofono_manager.h1
-rw-r--r--binding/telephony-binding.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/binding/gdbus/ofono_manager.h b/binding/gdbus/ofono_manager.h
index c7333d0..cd62736 100644
--- a/binding/gdbus/ofono_manager.h
+++ b/binding/gdbus/ofono_manager.h
@@ -23,6 +23,7 @@
#define OFONO_SERVICE "org.ofono"
#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"
+#define OFONO_NetworkRegistration_INTERFACE OFONO_SERVICE ".NetworkRegistration"
int ofono_manager_init(void);
void ofono_manager_invalidate_default_modem(void);
diff --git a/binding/telephony-binding.c b/binding/telephony-binding.c
index 2f96338..b2dc073 100644
--- a/binding/telephony-binding.c
+++ b/binding/telephony-binding.c
@@ -141,6 +141,24 @@ static void get_battery_level(afb_req_t request)
return;
}
+static void get_network_registration(afb_req_t request)
+{
+ const gchar *device;
+
+ device = ofono_manager_get_default_modem_path();
+ if (!device) {
+ afb_req_fail(request, "failed", "No path find");
+ return;
+ }
+
+ json_object *result = ofono_get_property(device, OFONO_NetworkRegistration_INTERFACE, NULL, NULL);
+ if (!result)
+ afb_req_fail(request, "failed", "Can not find Network Registration object");
+ else
+ afb_req_success(request, result, "OK");
+ return;
+}
+
static void subscribe(afb_req_t request)
{
const char *value = afb_req_value(request, "value");
@@ -397,6 +415,10 @@ static const afb_verb_t verbs[]= {
.callback = get_battery_level,
},
{
+ .verb = "get_network_registration",
+ .callback = get_network_registration,
+ },
+ {
.verb = "subscribe",
.callback = subscribe,
},