From 4483dd4e69826e6d2d184119830c88068bd7397d Mon Sep 17 00:00:00 2001
From: Arun Muthusamy <arun.muthusamy@inteno.se>
Date: Fri, 8 Jun 2018 10:15:16 +0200
Subject: [PATCH] libmobile wrapper using func ptr

---
 libmobile_wrapper.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 libmobile_wrapper.c

diff --git a/libmobile_wrapper.c b/libmobile_wrapper.c
new file mode 100644
index 0000000..ed432da
--- /dev/null
+++ b/libmobile_wrapper.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+typedef struct write_result *(*func_ptr)(char *, char *);
+
+//Example...
+struct write_result *mobile_pin_set_zte(char *current_pin, char *new_pin)
+{
+	return pin_action("03", current_pin, new_pin, "");
+}
+
+
+struct write_result *mobile_pin_set_hilink(char *current_pin, char *new_pin)
+{
+	return pin_action("03", current_pin, new_pin, "");
+}
+
+
+
+
+struct write_result *mobile_pin_set(char *dongle, char *current_pin, char *new_pin)
+{
+	func_ptr mobile_pin_set_impl = NULL;
+
+	if (strcmp(dongle, "zte") == 0)
+		mobile_pin_set_impl = mobile_pin_set_zte;
+
+	if (strcmp(dongle, "hilink") == 0)
+		mobile_pin_set_impl = mobile_pin_set_hilink;
+
+	if (mobile_pin_set_impl)
+		mobile_pin_set_impl(current_pin, new_pin);
+}
+
+
-- 
GitLab