• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

Plugin Development

Heffo

New member
Hi,

I would like to write a plugin capable of logging fan/sensor data into a file or a database. Looking at the list of existing CC2 plugins and their descriptions, it seems possible.

Would somone be able to point me in the right direction on getting this started, the plugin sdk docs are very light on information.

Thanks
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Mark

Administrator
The 631/633/635 plugins can already log fan & temp sensor information to a CSV type text file.

Or are you after something else?
 

Heffo

New member
I was wanting to log to a database (MySQL, Access, ODBC, etc) plus not specifically limit the data logged to just the fan & temp sensor data, but any extra data other plugins may supply (provided that is possible)
 
Last edited:

CF Mark

Administrator
Ok, a new plugin would be required to do this.

First, do you have a later version of MSVC you can compile the SDK with?
The first step would be to get that compiled and test it out with CC2 to make sure you can create valid plugins.
 

Heffo

New member
CrystalControl Admin said:
Ok, a new plugin would be required to do this.

First, do you have a later version of MSVC you can compile the SDK with?
The first step would be to get that compiled and test it out with CC2 to make sure you can create valid plugins.
I have MSVC 7 and had no trouble building the textfile plugin which worked fine in my CC2 service.
 

CF Mark

Administrator
Ok.

Well the SDK is missing the information you need on getting data from other plugins.

Code:
BOOL (*ext_data)(data_data *data) = NULL;

//---------------------------------------------------------------------------
void DLLEXPORT _DllSetGetDataAddr(void *pointer)
	//set addr for getdata in main
{
	ext_data = (BOOL (__cdecl *)(data_data *))pointer;
}
//---------------------------------------------------------------------------
BOOL get_value(DWORD id, double *value)
{
	BYTE		buf[0xFFFF];
	data_data	get;

	get.id = id;
	get.data = buf;

	if (ext_data == NULL)
		return FALSE;

	if (ext_data(&get) == FALSE)
		return FALSE;

	if (get.data_type == IDATA_LINE)
		*value = get.num_value;
	else
		return FALSE;

	return TRUE;
}
//---------------------------------------------------------------------------
When used in a plugin, the code above will allow you to get data from other plugins.

When the plugin is loaded, CC will call _DllSetGetDataAddr which then sets the address of the function (ext_data) that you call to get data for an ID.

The "get_value" function makes getting the information from "ext_data" a little nicer.

So, for example, in your update function:
Code:
BOOL ret;
double value;
DWORD id = 3842834 //the ID number for the information you wish to get

ret = get_value(id, &value);
if (ret == TRUE)
{
   //the number value for the ID is in "value"
}
else
{
  //no plugin recognised the ID number
}
Does that help?
 

Heffo

New member
I have not been able to spend the time on the plugin that I have liked (almost none).

A Vision Therapy program I have been developing for a client of mine over the last 18 months gets released at a conference in Sydney tomorrow (21st Apr) and I have been fairly occupied finishing it off.

I will be going to spend some serious time on this as soon as my time becomes available (about 7pm tonight, he he)

Robert Heffernan
 
Top