diff --git a/dongle_infrastructure.c b/dongle_infrastructure.c index 1b4e024370795380644b17c12b89e327c1fffef9..77490499235be0657b746df45ea861afc3031f70 100644 --- a/dongle_infrastructure.c +++ b/dongle_infrastructure.c @@ -303,7 +303,7 @@ int unlock_sim(struct ubus_context *ctx, struct ubus_object *obj, if (rv < 0) goto fail_input; printf("survived puk format\n"); - response = mobile_unlock_sim(global_dev->ip, pin, puk); + response = mobile_unlock_sim(global_dev, pin, puk); if (!response) goto fail_unknown; printf("did not survive the library\n"); @@ -421,7 +421,7 @@ int create_apn_profile(struct ubus_context *ctx, struct ubus_object *obj, goto fail_argument; } - response = mobile_create_apn_profile_zte(global_dev->ip, profile_name, wan_apn, pdp_type); + response = mobile_create_apn_profile(global_dev, profile_name, wan_apn, pdp_type); if (!response) goto fail_unknown; @@ -438,7 +438,7 @@ int show_current_apn(struct ubus_context *ctx, struct ubus_object *obj, { struct json_object *response; - response = mobile_get_current_apn_zte(global_dev->ip); + response = mobile_get_current_apn(global_dev); if (!response) goto fail_unknown; @@ -449,16 +449,13 @@ fail_unknown: } //dongle_network.. - -char *dongle_ip; - int get_signal_strength(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) { struct json_object *response; - response = mobile_get_rssi_zte(global_dev->ip); + response = mobile_get_rssi(global_dev); if (!response) goto fail_unknown; diff --git a/libmobile_hilink.h b/libmobile_hilink.h index 343c97c13a295748d5ca16a25adafc3bf9f069cf..ae330f3c30fca448abbd04d38b8b12e7ec03b048 100644 --- a/libmobile_hilink.h +++ b/libmobile_hilink.h @@ -65,7 +65,7 @@ struct json_object *mobile_get_notification_hilink(); struct json_object *mobile_get_sms_count_hilink(); struct json_object *mobile_get_language_hilink(); -struct json_object *mobile_create_apn_profile(char *name, char *apn_name, char *username, char *password); +struct json_object *mobile_create_apn_profile_hilink(char *name, char *apn_name, char *username, char *password); struct json_object *mobile_set_apn_profile_default_hilink(char *name, char *apn_name, char *username, char *password); diff --git a/libmobile_wrapper.c b/libmobile_wrapper.c index 436b733cbc120ce2d9ec7ebfa21c75e98a981b6e..f619e439fc066d6fb3781650d07d73bbdd291de4 100644 --- a/libmobile_wrapper.c +++ b/libmobile_wrapper.c @@ -88,4 +88,34 @@ struct json_object *mobile_set_apn_profile(struct device *dev, char *name) //return mobile_set_apn_profile_hilink(dev->ip, name); return NULL; +} + +struct json_object *mobile_create_apn_profile(struct device *dev, char *profile_name, char *wan_apn, char *pdp_type) +{ + if (strcmp(dev->usb.if_name, "usb0") == 0) + return mobile_create_apn_profile_zte(dev->ip, profile_name, wan_apn, pdp_type); + else if (strcmp(dev->usb.if_name, "eth5") == 0) + //return mobile_create_apn_profile_hilink(dev->ip, profile_name, wan_apn, pdp_type); + + return NULL; +} + +struct json_object *mobile_get_current_apn(struct device *dev) +{ + if (strcmp(dev->usb.if_name, "usb0") == 0) + return mobile_get_current_apn_zte(dev->ip); + else if (strcmp(dev->usb.if_name, "eth5") == 0) + //return mobile_get_current_apn_hilink(dev->ip); + + return NULL; +} + +struct json_object *mobile_get_rssi(struct device *dev) +{ + if (strcmp(dev->usb.if_name, "usb0") == 0) + return mobile_get_rssi_zte(dev->ip); + else if (strcmp(dev->usb.if_name, "eth5") == 0) + //return mobile_get_rssi_hilink(dev->ip); + + return NULL; } \ No newline at end of file diff --git a/libmobile_wrapper.h b/libmobile_wrapper.h index 58d772154b9d662cbef6fa66f8ac16b14958ea0f..d3dec3af7a66b174b18338e78b36d0a33631bd36 100644 --- a/libmobile_wrapper.h +++ b/libmobile_wrapper.h @@ -27,7 +27,11 @@ 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); +struct json_object *mobile_unlock_sim(struct device *dev, char *pin, char *puk); struct json_object *mobile_get_apn_profiles(struct device *dev); struct json_object *mobile_delete_apn_profile(struct device *dev, char *name); struct json_object *mobile_set_apn_profile(struct device *dev, char *name); +struct json_object *mobile_create_apn_profile(struct device *dev, char *profile_name, char *wan_apn, char *pdp_type); +struct json_object *mobile_get_current_apn(struct device *dev); +struct json_object *mobile_mobile_get_rssi(struct device *dev); #endif \ No newline at end of file