summaryrefslogtreecommitdiffstats
path: root/binding/telephony-binding.c
diff options
context:
space:
mode:
authorsaman <mahmoudi.saman1@gmail.com>2020-11-30 09:11:27 +0330
committersaman <mahmoudi.saman1@gmail.com>2020-12-19 09:50:33 +0330
commit067ffa5ef915499fed17a2ed67ad2fe689fdea81 (patch)
tree5c19bc7380a00537cdf60529b60935ac4cbcce60 /binding/telephony-binding.c
parent58aa4fbd91ca721994b6efe176ea94ccaee324ca (diff)
Getting network registration of connected phone device.koi_10.92.0koi/10.92.010.92.0
Is used ofono service and NetworkRegistration interface. Add NeworkRegistration interface to provide access to the connected phone's network registration properties (registration mode, status, technology, strength) Bug-AGL: SPEC-3721 Signed-off-by: saman <mahmoudi.saman1@gmail.com> Change-Id: I9c4be0366f97b39056af3b5bc9e861097a48ed44
Diffstat (limited to 'binding/telephony-binding.c')
-rw-r--r--binding/telephony-binding.c22
1 files changed, 22 insertions, 0 deletions
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,
},