Skip to content
Snippets Groups Projects
Commit 4483dd4e authored by Arun Muthusamy's avatar Arun Muthusamy
Browse files

libmobile wrapper using func ptr

parent 9d0ef87b
Branches
No related tags found
No related merge requests found
#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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment