From 28d21461a37d67a01a727e1ab5e09e2e1f02e4d7 Mon Sep 17 00:00:00 2001
From: Jakob Olsson <jakobols@kth.se>
Date: Fri, 8 Jun 2018 11:17:45 +0200
Subject: [PATCH] update wrapper to utilize device

---
 libmobile_wrapper.c | 23 +++++++++++------------
 libmobile_wrapper.h | 13 ++++++++++++-
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/libmobile_wrapper.c b/libmobile_wrapper.c
index a1cf901..7cfeec1 100644
--- a/libmobile_wrapper.c
+++ b/libmobile_wrapper.c
@@ -1,12 +1,11 @@
-#include "libmobile_hilink.h"
-#include "libmobile_zte.h"
+#include "libmobile_wrapper.h"
 
 struct json_object *mobile_set_pin(struct device *dev, char *current_pin, char *new_pin)
 {
 	if (strcmp(dev->usb.if_name, "usb0") == 0)
-		return mobile_set_pin_zte(dev->usb.ip, current_pin, new_pin);
+		return mobile_set_pin_zte(dev->ip, current_pin, new_pin);
 	else if (strcmp(dev->usb.if_name, "eth5") == 0)
-		return mobile_set_pin_hilink();
+		//return mobile_set_pin_hilink();
 
 	return NULL;
 }
@@ -14,9 +13,9 @@ struct json_object *mobile_set_pin(struct device *dev, char *current_pin, char *
 struct json_object *mobile_disable_pin(struct device *dev, char *pin)
 {
 	if (strcmp(dev->usb.if_name, "usb0") == 0)
-		return mobile_disable_pin_zte(dev->usb.ip, pin);
+		return mobile_disable_pin_zte(dev->ip, pin);
 	else if (strcmp(dev->usb.if_name, "eth5") == 0)
-		return mobile_disable_pin_hilink(dev->usb.ip, pin);
+		//return mobile_disable_pin_hilink(dev->ip, pin);
 
 	return NULL;
 }
@@ -24,9 +23,9 @@ struct json_object *mobile_disable_pin(struct device *dev, char *pin)
 struct json_object *mobile_verify_pin(struct device *dev, char *pin)
 {
 	if (strcmp(dev->usb.if_name, "usb0") == 0)
-		return mobile_verify_pin_zte(dev->usb.ip, pin);
+		return mobile_verify_pin_zte(dev->ip, pin);
 	else if (strcmp(dev->usb.if_name, "eth5") == 0)
-		return mobile_verify_pin_hilink(dev->usb.ip, pin);
+		//return mobile_verify_pin_hilink(dev->ip, pin);
 
 	return NULL;
 }
@@ -34,9 +33,9 @@ struct json_object *mobile_verify_pin(struct device *dev, char *pin)
 struct json_object *mobile_enable_pin(struct device *dev, char *pin)
 {
 	if (strcmp(dev->usb.if_name, "usb0") == 0)
-		return mobile_enable_pin_zte(dev->usb.ip, pin);
+		return mobile_enable_pin_zte(dev->ip, pin);
 	else if (strcmp(dev->usb.if_name, "eth5") == 0)
-		return mobile_enable_pin_hilink(dev->usb.ip, pin);
+		//return mobile_enable_pin_hilink(dev->ip, pin);
 
 	return NULL;
 }
@@ -44,9 +43,9 @@ struct json_object *mobile_enable_pin(struct device *dev, char *pin)
 struct json_object *mobile_get_remaining_tries(struct device *dev)
 {
 	if (strcmp(dev->usb.if_name, "usb0") == 0)
-		return mobile_get_remaining_tries_zte(dev->usb.ip);
+		return mobile_get_remaining_tries_zte(dev->ip);
 	else if (strcmp(dev->usb.if_name, "eth5") == 0)
-		return mobile_get_remaining_tries_hilink(dev->usb.ip);
+		//return mobile_get_remaining_tries_hilink(dev->ip);
 
 	return NULL;
 }
diff --git a/libmobile_wrapper.h b/libmobile_wrapper.h
index 612c971..3c24490 100644
--- a/libmobile_wrapper.h
+++ b/libmobile_wrapper.h
@@ -1,5 +1,9 @@
+#ifndef LIBWRAPPER_H
+#define LIBWRAPPER_H
 #include <libubox/list.h>
 
+#include "libmobile_hilink.h"
+#include "libmobile_zte.h"
 /* ORIGINALLY FROM DONGLE.H - WHERE DOES IT BELONG? */
 struct USB {
 	char *product;
@@ -16,4 +20,11 @@ struct device {
 	char *ip;
 	int missing; //counter
 	bool present;
-};
\ No newline at end of file
+};
+
+struct json_object *mobile_set_pin(struct device *dev, char *current_pin, char *new_pin);
+struct json_object *mobile_disable_pin(struct device *dev, char *pin);
+struct json_object *mobile_verify_pin(struct device *dev, char *pin);
+struct json_object *mobile_enable_pin(struct device *dev, char *pin);
+struct json_object *mobile_get_remaining_tries(struct device *dev);
+#endif
\ No newline at end of file
-- 
GitLab