Esempio n. 1
0
/*!
  \brief ECU specific function to set a value in the representation of ECU 
  memory
  \param canID is the CAN Identifier
  \param page is the MTX page(may not be the same as the ECU page)
  \param offset is the offset in bytes from the beginning of this page
  \param size is the size representation enumeration
  \param new_data is the new value to store
  */
G_MODULE_EXPORT void ms_set_ecu_data(gint canID, gint page, gint offset, DataSize size, gint new_data) 
{
	Firmware_Details *firmware = NULL;
	static gint (*_set_sized_data)(guint8 *, gint, DataSize, gint, gboolean) = NULL;
	if (!_set_sized_data)
		get_symbol_f("_set_sized_data",(void **)&_set_sized_data);
	g_return_if_fail(_set_sized_data);


	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	_set_sized_data(firmware->ecu_data[page],offset,size,new_data,firmware->bigendian);
}
Esempio n. 2
0
/*!
  \brief Sets the ECU data at the coordinates specified in the data pointer
  \param data is the pointer to either a GtkWidget pointer or a 
  gconstpointer object container the coordinate information as to where 
  to store the new data.
  \param new is the pointer to the new data to be stored
  */
G_MODULE_EXPORT void set_ecu_data(gpointer data, gint *new_data)
{
	gint canID = 0;
	gint page = 0;
	gint offset = 0;
	DataSize size = MTX_U08;
	gint value = 0;
	gconstpointer *container = NULL;
	GtkWidget *widget = NULL;
	Firmware_Details *firmware = NULL;
	static gint (*_set_sized_data)(guint8 *, gint, DataSize, gint, gboolean) = NULL;
	if (!_set_sized_data)
		get_symbol_f("_set_sized_data",(void **)&_set_sized_data);

	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	g_return_if_fail(firmware);
	g_return_if_fail(_set_sized_data);

	widget = (GtkWidget *)data;
	container = (gconstpointer *)data;
	if (GTK_IS_WIDGET(widget))
	{
		canID = (GINT)OBJ_GET(widget,"canID");
		page = (GINT)OBJ_GET(widget,"page");
		offset = (GINT)OBJ_GET(widget,"offset");
		size = (DataSize)(GINT)OBJ_GET(widget,"size");
		if (new_data)
			value = *new_data;
		else
			value = (GINT)OBJ_GET(widget,"value");
	}
	else
	{
		canID = (GINT)DATA_GET(container,"canID");
		page = (GINT)DATA_GET(container,"page");
		offset = (GINT)DATA_GET(container,"offset");
		size = (DataSize)(GINT)DATA_GET(container,"size");
		if (new_data)
			value = *new_data;
		else
			value = (GINT)DATA_GET(container,"value");
	}

	_set_sized_data(firmware->ecu_data[page],offset,size,value,firmware->bigendian);
}
Esempio n. 3
0
/*!
  \brief ECU specific function to set a value in the representation of ECU 
  memory
  \param canID is the CAN Identifier
  \param locID is the Location ID
  \param offset is the offset in bytes from thebeginning on this location ID
  \param size is the  size representation enumeration
  \param newval is the new value to store
  */
G_MODULE_EXPORT void libreems_set_ecu_data(gint canID, gint locID, gint offset, DataSize size, gint newval) 
{
	gint page = 0;
	Firmware_Details *firmware = NULL;
	static gint (*_set_sized_data)(guint8 *, gint, DataSize, gint, gboolean) = NULL;
	ENTER();
	if (!_set_sized_data)
		get_symbol_f("_set_sized_data",(void **)&_set_sized_data);


	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	g_return_if_fail(libreems_find_mtx_page(locID, &page));
	g_return_if_fail(firmware);
	g_return_if_fail(firmware->page_params);
	g_return_if_fail(firmware->page_params[page]);
	g_return_if_fail((offset >= 0) && (offset < firmware->page_params[page]->length));

	_set_sized_data(firmware->ecu_data[page],offset,size,newval,firmware->bigendian);
	EXIT();
	return;
}
Esempio n. 4
0
/*!
  \brief Sets the ECU data at the coordinates specified in the data pointer
  \param data is the pointer to either a GtkWidget pointer or a 
  gconstpointer object container the coordinate information as to where 
  to store the new data.
  \param new is the pointer to the new data to be stored
  */
G_MODULE_EXPORT void set_ecu_data(gpointer data, gint *newval)
{
	gint canID = 0;
	gint locID = 0;
	gint page = 0;
	gint offset = 0;
	gint value = 0;
	DataSize size = MTX_U08;
	GtkWidget *widget = NULL;
	gconstpointer *container = NULL;
	Firmware_Details *firmware = NULL;
	static gint (*_set_sized_data)(guint8 *, gint, DataSize, gint, gboolean) = NULL;
	ENTER();
	if (!_set_sized_data)
		get_symbol_f("_set_sized_data",(void **)&_set_sized_data);

	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");
	widget = (GtkWidget *)data;
	container = (gconstpointer *)data;
	if (GTK_IS_WIDGET(data))
	{
		if (OBJ_GET(widget,"location_id"))
		{
			locID = (GINT)OBJ_GET(widget,"location_id");
			g_return_if_fail(libreems_find_mtx_page(locID, &page));
		}
		else if (OBJ_GET(widget,"page"))
			page = (GINT)OBJ_GET(widget,"page");
		canID = (GINT)OBJ_GET(widget,"canID");
		offset = (GINT)OBJ_GET(widget,"offset");
		size = (DataSize)(GINT)OBJ_GET(widget,"size");
		if (newval)
			value = *newval;
		else
			value = (GINT)OBJ_GET(widget,"value");
	}
	else
	{
		if (DATA_GET(container,"location_id"))
		{
			locID = (GINT)DATA_GET(container,"location_id");
			g_return_if_fail(libreems_find_mtx_page(locID, &page));
		}
		else if (DATA_GET(container,"page"))
			page = (GINT)DATA_GET(container,"page");
		canID = (GINT)DATA_GET(container,"canID");
		offset = (GINT)DATA_GET(container,"offset");
		size = (DataSize)(GINT)DATA_GET(container,"size");
		if (newval)
			value = *newval;
		else
			value = (GINT)DATA_GET(container,"value");
	}

	g_return_if_fail(firmware);
	g_return_if_fail(firmware->page_params);
	g_return_if_fail(firmware->page_params[page]);
	g_return_if_fail((offset >= 0) && (offset < firmware->page_params[page]->length));
	_set_sized_data(firmware->ecu_data[page],offset,size,value,firmware->bigendian);
	EXIT();
	return;
}