#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->ip, current_pin, new_pin);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_set_pin_hilink(current_pin, new_pin);

	return NULL;
}

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->ip, pin);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_disable_pin_hilink(pin);

	return NULL;
}

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->ip, pin);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_set_pin_hilink(pin, pin);

	return NULL;
}

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->ip, pin);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_enable_pin_hilink(pin);

	return NULL;
}

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->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_get_pin_status_hilink();

	return NULL;
}

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(pin, puk);

	return NULL;
}

struct json_object *mobile_get_apn_profiles(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_get_apn_profiles_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_get_apn_profiles_hilink();

	return NULL;
}

struct json_object *mobile_delete_apn_profile(struct device *dev, char *name)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_delete_apn_profile_zte(dev->ip, name);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_delete_apn_profile_hilink(0);

	return NULL;
}

struct json_object *mobile_set_apn_profile(struct device *dev, char *name)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_set_apn_profile_zte(dev->ip, name);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_set_apn_profile_hilink(name, name, name, 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(profile_name, profile_name, profile_name,profile_name);

		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_apn_profiles_hilink();

		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_device_signal_hilink();

		return NULL;
}

struct json_object *mobile_connect_network(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_connect_network_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_connect_network_hilink();

		return NULL;
}

struct json_object *mobile_disconnect_network(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_disconnect_network_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_disconnect_network_hilink();

		return NULL;
}

struct json_object *mobile_get_modem_state(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_get_modem_state_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_get_provider_hilink();

		return NULL;
}

struct json_object *mobile_enable_roaming(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_enable_roaming_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_enable_roaming_hilink();

		return NULL;
}

struct json_object *mobile_disable_roaming(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_disable_roaming_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_disable_roaming_hilink();

		return NULL;
}

struct json_object *mobile_get_roam_status(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_get_roam_status_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_get_monitoring_status_hilink();

		return NULL;
}

struct json_object *mobile_get_pin_status(struct device *dev)
{
	if (strcmp(dev->usb.if_name, "usb0") == 0)
		return mobile_get_pin_status_zte(dev->ip);
	else if (strcmp(dev->usb.if_name, "eth5") == 0)
		return mobile_get_pin_status_hilink();

	return NULL;
}