irom static app_action_t application_function_i2c_sensor_dump(application_parameters_t ap)
{
	i2c_sensor_t sensor;
	uint16_t offset;
	bool_t all, verbose;
	char *orig_dst = ap.dst;

	all = false;
	verbose = false;

	if(ap.nargs > 1)
	{
		switch((uint8_t)atoi((*ap.args)[1]))
		{
			case(2):
				verbose = true;
			case(1):
				all = true;
			default:
				(void)0;
		}
	}

	for(sensor = 0; sensor < i2c_sensor_size; sensor++)
	{
		if(all || i2c_sensor_detected(sensor))
		{
			offset = i2c_sensor_read(sensor, verbose, ap.size, ap.dst);
			ap.dst	+= offset;
			ap.size	-= offset;
		}
	}

	if(ap.dst == orig_dst)
		snprintf(ap.dst, ap.size, "%s", "> no sensors detected\n");

	return(app_action_normal);
}
irom static app_action_t application_function_i2c_sensor_dump(const string_t *src, string_t *dst)
{
	i2c_sensor_t sensor;
	int option;
	bool_t all, verbose;
	int original_length = string_length(dst);

	all = false;
	verbose = false;

	if(parse_int(1, src, &option, 0) == parse_ok)
	{
		switch(option)
		{
			case(2):
				verbose = true;
			case(1):
				all = true;
			default:
				(void)0;
		}
	}

	for(sensor = 0; sensor < i2c_sensor_size; sensor++)
	{
		if(all || i2c_sensor_detected(sensor))
		{
			i2c_sensor_read(dst, sensor, verbose);
			string_cat(dst, "\n");
		}
	}

	if(string_length(dst) == original_length)
		string_cat(dst, "> no sensors detected\n");

	return(app_action_normal);
}