diff --git a/libmobile_hilink.c b/libmobile_hilink.c index 93d797d3884abe2cae53c7452de274856c5bf3ff..0946dabbc5b989dc4724f9eb59bf8992f1adc4a6 100644 --- a/libmobile_hilink.c +++ b/libmobile_hilink.c @@ -634,6 +634,33 @@ fail_result: return NULL; } +struct json_object *mobile_unlock_sim_hilink(char *pin, char *puk) +{ + char *api_url = "http://192.168.8.1/api/pin/operate"; + char post_query[1024]; + struct write_result *result; + struct json_object *result_json; + + snprintf(post_query, 1023, "<request><OperateType>4</OperateType><CurrentPin>%s</CurrentPin><NewPin>%s</NewPin><PukCode>%s</PukCode></request>", pin, pin, puk); + + result = post_request(sess_tok_url, api_url, post_query); + if (!result) + goto fail_result; + + result_json = xml_to_json_converter(result); + if (!result_json) + goto fail_converter; + + if (result) + free(result); + + return result_json; + +fail_converter: + free(result); +fail_result: + return NULL; +} struct json_object *mobile_delete_apn_profile_hilink(int profile_name_location) { diff --git a/libmobile_hilink.h b/libmobile_hilink.h index 8e77d4e142e1cb3ea433b2ed8cb5bb22cce9345b..168c5949f9f82e443e48b4e221ee14b6f49b8071 100644 --- a/libmobile_hilink.h +++ b/libmobile_hilink.h @@ -70,6 +70,8 @@ struct json_object *mobile_create_apn_profile_hilink(char *name, char *apn_name, struct json_object *mobile_set_apn_profile_hilink(char *name, char *apn_name, char *username, char *password); +struct json_object *mobile_unlock_sim_hilink(char *pin, char *puk); + struct json_object *mobile_delete_apn_profile_hilink(int profile_name_location); struct json_object *mobile_sms_read_hilink(int sms_location); diff --git a/libmobile_wrapper.c b/libmobile_wrapper.c index 6c11dc7267852a0331ba660c4b5944283214bc68..a5f97cd605958d1e34d0b4c2c415605fd1c6251a 100644 --- a/libmobile_wrapper.c +++ b/libmobile_wrapper.c @@ -55,7 +55,7 @@ struct json_object *mobile_unlock_sim(struct device *dev, char *pin, char *puk) if (strcmp(dev->usb.if_name, "usb0") == 0) return mobile_unlock_sim_zte(dev->ip, pin, puk); else if (strcmp(dev->usb.if_name, "eth5") == 0) - //return mobile_unlock_sim_hilink(dev->ip, pin, puk); + return mobile_unlock_sim_hilink(pin, puk); return NULL; }