Example #1
0
/*!
 \brief translate_capabilities() converts a stringlist into a mask of 
 enumerations and returns it
 \param string (gchar *) listing of capabilities in textual format
 \returns an integer mask of the capabilites
 */
G_MODULE_EXPORT gint translate_capabilities(const gchar *string)
{
	gchar **vector = NULL;
	gint i = 0;
	gint value = 0;
	gint tmpi = 0;


	if (!string)
	{
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": translate_capabilities()\n\tstring fed is NULLs\n"));
		return -1;
	}

	vector = g_strsplit(string,",",0);
	dbg_func_f(INTERROGATOR,g_strdup_printf(__FILE__": translate_capabilities()\n\tstring fed is %s\n",string));
	while (vector[i] != NULL)
	{
		dbg_func_f(INTERROGATOR,g_strdup_printf(__FILE__": translate_capabilities()\n\tTrying to translate %s\n",vector[i]));
		tmpi = translate_string_f(vector[i]);
		dbg_func_f(INTERROGATOR,g_strdup_printf(__FILE__": translate_capabilities()\n\tTranslated value of %s is %i\n",vector[i],value));
		value += tmpi;
		i++;
	}

	g_strfreev(vector);
	return value;
}
Example #2
0
/*!
 \brief translate_capabilities() converts a stringlist into a mask of 
 enumerations and returns it
 \param string is a listing of capabilities in textual format
 \returns an integer mask of the capabilites
 */
G_MODULE_EXPORT gint translate_capabilities(const gchar *string)
{
	gchar **vector = NULL;
	gint i = 0;
	gint value = 0;
	gint tmpi = 0;

	if (!string)
	{
		MTXDBG(INTERROGATOR|CRITICAL,_("String fed is NULL!\n"));
		return -1;
	}

	vector = g_strsplit(string,",",0);
	MTXDBG(INTERROGATOR,_("String fed is %s\n"),string);
	while (vector[i] != NULL)
	{
		MTXDBG(INTERROGATOR,_("Trying to translate %s\n"),vector[i]);
		tmpi = translate_string_f(vector[i]);
		MTXDBG(INTERROGATOR,_("Translated value of %s is %i\n"),vector[i],value);
		value += tmpi;
		i++;
	}

	g_strfreev(vector);
	return value;
}
Example #3
0
/*! 
  \brief handles runtime variables with complex ECU/Family specific handlers
  \param object is a pointer to the object to store the data within
  \param cfgfile is a pointer to the ConfigFile structure
  \param section is the section within the file
  \param symbol is the symbol name within the section
  \param type is an enumeration representing the type of RT var
  */
G_MODULE_EXPORT void common_rtv_loader(gconstpointer *object, xmlNode *node, gchar *symbol, ComplexExprType type)
{
	static Firmware_Details *firmware = NULL;
	gchar * name = NULL;
	gint tmpi = 0;
	gchar *tmpbuf = NULL;

	ENTER();
	if (!firmware)
		firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");

	switch (type)
	{
		case ECU_EMB_BIT:
			/* ECU Embedded bitfield 4 params */
			name=NULL;
			name=g_strdup_printf("%s_page",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_EMB_BIT, failure looking for:%s\n"),name);
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_offset",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_EMB_BIT, failure looking for:%s\n"),name);
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_canID",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				tmpi = firmware->canID;
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_bitmask",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_EMB_BIT, failure looking for:%s\n"),name);
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			break;
		case ECU_VAR:
			/* ECU std variable, canID/page/offset/size */
			name=NULL;
			name=g_strdup_printf("%s_canID",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				tmpi = firmware->canID;

			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_page",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_VAR, failure looking for:%s\n"),name);
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_offset",symbol);
			if (!generic_xml_gint_find(node,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_VAR, failure looking for:%s\n"),name);
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_size",symbol);
			if (!generic_xml_gchar_find(node,name,&tmpbuf))
				tmpi = MTX_U08;
			else
			{
				tmpi = translate_string_f(tmpbuf);
				g_free(tmpbuf);
			}
			DATA_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			break;
		default:
			EXIT();
			return;
			break;
	}
	EXIT();
	return;
}
Example #4
0
G_MODULE_EXPORT gboolean load_firmware_details(Firmware_Details *firmware, gchar * filename)
{
	ConfigFile *cfgfile;
	Location_Details *details = NULL;
	GList *locations = NULL;
	gchar *tmpbuf = NULL;
	gchar *section = NULL;
	gchar ** list = NULL;
	gint i = 0;
	gint major = 0;
	gint minor = 0;


	cfgfile = cfg_open_file((gchar *)filename);
	if (!cfgfile)
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": load_firmware_details()\n\tFile \"%s\" NOT OPENED successfully\n",filename));
	get_file_api_f(cfgfile,&major,&minor);
	if ((major != INTERROGATE_MAJOR_API) || (minor != INTERROGATE_MINOR_API))
	{
		thread_update_logbar_f("interr_view","warning",g_strdup_printf(_("Interrogation profile API mismatch (%i.%i != %i.%i):\n\tFile %s will be skipped\n"),major,minor,INTERROGATE_MAJOR_API,INTERROGATE_MINOR_API,filename),FALSE,FALSE);
		cfg_free(cfgfile);
		return FALSE;
	}
	dbg_func_f(INTERROGATOR,g_strdup_printf(__FILE__": load_firmware_details()\n\tfile:%s opened successfully\n",filename));

	firmware->profile_filename = g_strdup(filename);
	cfg_read_string(cfgfile,"interrogation_profile","name",&firmware->name);
	if(cfg_read_string(cfgfile,"parameters","EcuTempUnits",&tmpbuf))
	{
		firmware->ecu_temp_units = translate_string_f(tmpbuf);
		g_free(tmpbuf);
	}
	else
		dbg_func_f(INTERROGATOR,g_strdup_printf(__FILE__": load_firmware_details()\n\tFailed to find EcuTempUnits key in interrogation profile\n"));

	if(!cfg_read_boolean(cfgfile,"parameters","BigEndian",&firmware->bigendian))
	{
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"BigEndian\" key not found in interrogation profile, assuming ECU firmware byte order is big endian, ERROR in interrogation profile\n"));
		firmware->bigendian = TRUE;
	}
	if(!cfg_read_string(cfgfile,"parameters","Capabilities",
				&tmpbuf))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Capabilities\" enumeration list not found in interrogation profile, ERROR\n"));
	else
	{
		firmware->capabilities = translate_capabilities(tmpbuf);
		g_free(tmpbuf);
	}
	/* Commands to map against the comm.xml */
	if(!cfg_read_string(cfgfile,"parameters","RT_Command",&firmware->rt_command))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"RT_Command\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_int(cfgfile,"parameters","RT_total_bytes",
				&firmware->rtvars_size))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"RT_total_bytes\" variable not found in interrogation profile, ERROR\n"));

	if(!cfg_read_string(cfgfile,"parameters","Get_All_Command",
				&firmware->get_all_command))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Get_All_Command\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"parameters","Read_Command",
				&firmware->read_command))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Read_Command\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"parameters","Write_Command",
				&firmware->write_command))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Write_Command\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"parameters","Burn_Command",
				&firmware->burn_command))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Burn_Command\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"parameters","Burn_All_Command",
				&firmware->burn_all_command))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Burn_All_Command\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_boolean(cfgfile,"parameters","ChunkWriteSupport",
				&firmware->chunk_support))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"ChunkWriteSupport\" flag not found in parameters section in interrogation profile, ERROR\n"));
	if (firmware->chunk_support)
	{
		if(!cfg_read_string(cfgfile,"parameters","Chunk_Write_Command",
					&firmware->chunk_write_command))
			dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"Chunk_Write_Command\" flag not found in parameters section in interrogation profile, ERROR\n"));
	}

	/* Gui Section */
	if(!cfg_read_string(cfgfile,"gui","LoadTabs",&tmpbuf))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"LoadTabs\" list not found in interrogation profile, ERROR\n"));
	else
	{
		firmware->tab_list = g_strsplit(tmpbuf,",",0);
		g_free(tmpbuf);
	}
	if(!cfg_read_string(cfgfile,"gui","TabConfs",
				&tmpbuf))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"TabConfs\" list not found in interrogation profile, ERROR\n"));
	else
	{
		firmware->tab_confs = g_strsplit(tmpbuf,",",0);
		g_free(tmpbuf);
	}
	if(!cfg_read_string(cfgfile,"gui","RealtimeMapFile",
				&firmware->rtv_map_file))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"RealtimeMapFile\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"gui","SliderMapFile",
				&firmware->sliders_map_file))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"SliderMapFile\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"gui","RuntimeTextMapFile",
				&firmware->rtt_map_file))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"RuntimeTextMapFile\" variable not found in interrogation profile, ERROR\n"));
	if(!cfg_read_string(cfgfile,"gui","StatusMapFile",
				&firmware->status_map_file))
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup(__FILE__": load_firmware_details()\n\t\"StatusMapFile\" variable not found in interrogation profile, ERROR\n"));


	/* Megatunix Doesn't yet know how to deal with FreeEMS's locationID's
	   which are semi-analagous to Pages in MS-land
	 */
	locations = request_location_ids(NULL);
	if (locations)
	{
		firmware->total_pages = g_list_length(locations);
		firmware->page_params = g_new0(Page_Params *, firmware->total_pages);
		for (i=0;i<firmware->total_pages;i++)
		{
			firmware->page_params[i] = initialize_page_params();
			firmware->page_params[i]->phys_ecu_page = (GINT)g_list_nth_data(locations,i);
			details = request_location_id_details((GINT)g_list_nth_data(locations,i));
			if (details)
			{
				firmware->page_params[i]->length = details->length;
				firmware->page_params[i]->dl_by_default = (details->flags & BLOCK_IS_INDEXABLE);

			}
			g_free(details);
		}
		g_list_free(locations);
	}
	/* MAJOR HACK ALERT,  hardcoded for fred! */
	firmware->total_tables = 3;
	firmware->table_params = g_new0(Table_Params *,firmware->total_tables);
	/* Fuel Table */
	firmware->table_params[0] = initialize_table_params();
	firmware->table_params[0]->x_page = 0;
	firmware->table_params[0]->y_page = 0;
	firmware->table_params[0]->z_page = 0;
	firmware->table_params[0]->x_bincount = 16;
	firmware->table_params[0]->y_bincount = 16;
	firmware->table_params[0]->x_base = 4;
	firmware->table_params[0]->y_base = 58;
	firmware->table_params[0]->z_base = 100;
	firmware->table_params[0]->x_size = MTX_U16;
	firmware->table_params[0]->y_size = MTX_U16;
	firmware->table_params[0]->z_size = MTX_U16;
	firmware->table_params[0]->x_source = g_strdup("RPM");
	firmware->table_params[0]->x_fromecu_mult = g_new0(gfloat, 1);
	firmware->table_params[0]->y_fromecu_mult = g_new0(gfloat, 1);
	firmware->table_params[0]->z_fromecu_mult = g_new0(gfloat, 1);
	*(firmware->table_params[0]->x_fromecu_mult) = 0.5;
	*(firmware->table_params[0]->y_fromecu_mult) = 0.01;
	*(firmware->table_params[0]->z_fromecu_mult) = 0.001953125;
	firmware->table_params[0]->y_source = g_strdup("LoadMain");
	firmware->table_params[0]->z_source = g_strdup("VEMain");
	firmware->table_params[0]->x_suffix = g_strdup("RPM");
	firmware->table_params[0]->y_suffix = g_strdup("kPa");
	firmware->table_params[0]->z_suffix = g_strdup("%");
	firmware->table_params[0]->x_precision = 0;
	firmware->table_params[0]->y_precision = 1;
	firmware->table_params[0]->z_precision = 1;
	firmware->table_params[0]->table_name = g_strdup("FreeEMS very alpha fuel table");;
	/* Lambda Table */
	firmware->table_params[1] = initialize_table_params();
	firmware->table_params[1]->x_page = 6;
	firmware->table_params[1]->y_page = 6;
	/* Assumes location ID's from 0-6 are contiguous */
	firmware->table_params[1]->z_page = 6;
	firmware->table_params[1]->x_bincount = 16;
	firmware->table_params[1]->y_bincount = 16;
	firmware->table_params[1]->x_base = 4;
	firmware->table_params[1]->y_base = 58;
	firmware->table_params[1]->z_base = 100;
	firmware->table_params[1]->x_size = MTX_U16;
	firmware->table_params[1]->y_size = MTX_U16;
	firmware->table_params[1]->z_size = MTX_U16;
	firmware->table_params[1]->x_fromecu_mult = g_new0(gfloat, 1);
	firmware->table_params[1]->y_fromecu_mult = g_new0(gfloat, 1);
	firmware->table_params[1]->z_fromecu_mult = g_new0(gfloat, 1);
	*(firmware->table_params[1]->x_fromecu_mult) = 0.5;
	*(firmware->table_params[1]->y_fromecu_mult) = 0.01;
	*(firmware->table_params[1]->z_fromecu_mult) = 0.000030518;
	firmware->table_params[1]->x_source = g_strdup("RPM");
	firmware->table_params[1]->y_source = g_strdup("LoadMain");
	firmware->table_params[1]->z_source = g_strdup("Lambda");
	firmware->table_params[1]->x_suffix = g_strdup("RPM");
	firmware->table_params[1]->y_suffix = g_strdup("kPa");
	firmware->table_params[1]->z_suffix = g_strdup("Lambda");
	firmware->table_params[1]->x_precision = 0;
	firmware->table_params[1]->y_precision = 1;
	firmware->table_params[1]->z_precision = 2;
	firmware->table_params[1]->table_name = g_strdup("FreeEMS very alpha lambda table");;

	firmware->table_params[2] = initialize_table_params();
	firmware->table_params[2]->x_page = 8;
	firmware->table_params[2]->y_page = 8;
	/* Assumes location ID's from 0-8 are contiguous */
	firmware->table_params[2]->z_page = 8;
	firmware->table_params[2]->x_bincount = 16;
	firmware->table_params[2]->y_bincount = 16;
	firmware->table_params[2]->x_base = 4;
	firmware->table_params[2]->y_base = 58;
	firmware->table_params[2]->z_base = 100;
	firmware->table_params[2]->x_size = MTX_U16;
	firmware->table_params[2]->y_size = MTX_U16;
	firmware->table_params[2]->z_size = MTX_U16;
	firmware->table_params[2]->x_fromecu_mult = g_new0(gfloat, 1);
	firmware->table_params[2]->y_fromecu_mult = g_new0(gfloat, 1);
	firmware->table_params[2]->z_fromecu_mult = g_new0(gfloat, 1);
	*(firmware->table_params[2]->x_fromecu_mult) = 0.5;
	*(firmware->table_params[2]->y_fromecu_mult) = 0.01;
	*(firmware->table_params[2]->z_fromecu_mult) = 0.000976563;
	firmware->table_params[2]->x_source = g_strdup("RPM");
	firmware->table_params[2]->y_source = g_strdup("LoadMain");
	firmware->table_params[2]->z_source = g_strdup("Degrees");
	firmware->table_params[2]->x_suffix = g_strdup("RPM");
	firmware->table_params[2]->y_suffix = g_strdup("kPa");
	firmware->table_params[2]->z_suffix = g_strdup("\302\260BTDC");
	firmware->table_params[2]->x_precision = 0;
	firmware->table_params[2]->y_precision = 1;
	firmware->table_params[2]->z_precision = 3;
	firmware->table_params[2]->table_name = g_strdup("FreeEMS very alpha spark table");;


	if (mem_alloc_f)
		mem_alloc_f();
	else
		dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": load_firmware_details()\n\tFAILED TO LOCATE \"mem_alloc\" function within core/plugins\n"));

	/* Display firmware version in the window... */

	dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": load_firmware_details()\n\tDetected Firmware: %s\n",firmware->name));
	thread_update_logbar_f("interr_view","warning",g_strdup_printf(_("Detected Firmware: %s\n"),firmware->name),FALSE,FALSE);
	thread_update_logbar_f("interr_view","info",g_strdup_printf(_("Loading Settings from: \"%s\"\n"),firmware->profile_filename),FALSE,FALSE);
	cfg_free(cfgfile);

	return TRUE;
}
Example #5
0
/*!
 \brief validate_and_load_tests() loads the list of tests from the system
 checks them for validity, populates and array and returns it
 command tested against the ECU arestored
 \returns a dynamic GArray for commands
 */
G_MODULE_EXPORT gboolean validate_and_load_tests(GArray **tests, GHashTable **tests_hash)
{
	ConfigFile *cfgfile;
	Detection_Test *test = NULL;
	gchar * filename = NULL;
	gchar *section = NULL;
	gchar * tmpbuf = NULL;
	gchar ** vector = NULL;
	gint total_tests = 0;
	gint result = 0;
	gint major = 0;
	gint minor = 0;
	gint i = 0;
	gint j = 0;

	filename = get_file(g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"tests.cfg",NULL),NULL);
	if (!filename)
	{
		update_logbar_f("interr_view","warning",g_strdup_printf(_("Interrogation profile tests file %s not found!\n"),filename),FALSE,FALSE,TRUE);
		return FALSE;
	}

	cfgfile = cfg_open_file(filename);
	if (!cfgfile)
		return FALSE;
	get_file_api_f(cfgfile,&major,&minor);
	if ((major != INTERROGATE_MAJOR_API) || (minor != INTERROGATE_MINOR_API))
	{
		update_logbar_f("interr_view","warning",g_strdup_printf(_("Interrogation profile tests API mismatch (%i.%i != %i.%i):\n\tFile %s.\n"),major,minor,INTERROGATE_MAJOR_API,INTERROGATE_MINOR_API,filename),FALSE,FALSE,TRUE);
		return FALSE;
	}

	*tests_hash = g_hash_table_new_full(g_str_hash,g_str_equal,NULL,test_cleanup);

	dbg_func_f(INTERROGATOR,g_strdup_printf(__FILE__": validate_and_load_tests()\n\tfile %s, opened successfully\n",filename));
	*tests = g_array_new(FALSE,TRUE,sizeof(Detection_Test *));
	cfg_read_int(cfgfile,"interrogation_tests","total_tests",&total_tests);
	for (i=0;i<total_tests;i++)
	{
		test = g_new0(Detection_Test, 1);
		section = g_strdup_printf("test_%.2i",i);
		if (!cfg_read_string(cfgfile,section,"test_name",&test->test_name))
		{
			dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": validate_and_load_tests(),\n\ttest_name for %s is NULL\n",section));
			g_free(section);
			break;
		}
		if (!cfg_read_string(cfgfile,section,"test_result_type",&tmpbuf))
		{
			dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": validate_and_load_tests(),\n\ttest_result_type for %s is NULL\n",section));
			g_free(section);
			break;
		}
		else
		{
			test->result_type=translate_string_f(tmpbuf);
			g_free(tmpbuf);
		}
		if (!cfg_read_string(cfgfile,section,"test_func",&test->test_func))
		{
			dbg_func_f(INTERROGATOR|CRITICAL,g_strdup_printf(__FILE__": validate_and_load_tests(),\n\ttest_function for %s is NULL\n",section));
			g_free(section);
			break;
		}
		get_symbol_f(test->test_func,(void *)&test->function);
		cfg_read_string(cfgfile,section,"test_desc",
				&test->test_desc);
		g_free(section);
		g_array_append_val(*tests,test);
		g_hash_table_insert(*tests_hash,test->test_name,test);
	}
	cfg_free(cfgfile);
	g_free(filename);
	return TRUE;
}
Example #6
0
/*! 
  \brief handles runtime variables with complex ECU/Family specific handlers
  \param object is a pointer to the object to store the data within
  \param cfgfile is a pointer to the ConfigFile structure
  \param section is the section within the file
  \param symbol is the symbol name within the section
  \param type is an enumeration representing the type of RT var
  */
G_MODULE_EXPORT void common_rtv_loader_obj(GObject *object, ConfigFile *cfgfile, gchar * section, gchar *symbol, ComplexExprType type)
{
	static Firmware_Details *firmware = NULL;
	gchar * name = NULL;
	gint tmpi = 0;
	gchar *tmpbuf = NULL;

	if (!firmware)
		firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");

	switch (type)
	{
		case ECU_EMB_BIT:
			/* ECU Embedded bitfield 4 params */
			name=NULL;
			name=g_strdup_printf("%s_locID",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_EMB_BIT, failure looking for:%s\n"),name);
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_offset",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_EMB_BIT, failure looking for:%s\n"),name);
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_canID",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				tmpi = firmware->canID;
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_bitmask",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_EMB_BIT, failure looking for:%s\n"),name);
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			break;
		case ECU_VAR:
			/* ECU std variable, canID/locID/offset/size */
			name=NULL;
			name=g_strdup_printf("%s_canID",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				tmpi = firmware->canID;

			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_locID",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_VAR, failure looking for:%s\n"),name);
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_offset",symbol);
			if (!cfg_read_int(cfgfile,section,name,&tmpi))
				MTXDBG(RTMLOADER|COMPLEX_EXPR|CRITICAL,_("ECU_VAR, failure looking for:%s\n"),name);
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			name=g_strdup_printf("%s_size",symbol);
			if (!cfg_read_string(cfgfile,section,name,&tmpbuf))
				tmpi = MTX_U08;
			else
			{
				tmpi = translate_string_f(tmpbuf);
				g_free(tmpbuf);
			}
			OBJ_SET(object,name,GINT_TO_POINTER(tmpi));
			g_free(name);
			name=NULL;
			break;
		default:
			return;
			break;
	}
	return;
}