View Single Post
Old February 2nd, 2014   #2
sblair
Administrator
 
Join Date: Feb 2006
Posts: 433
Send a message via AIM to sblair Send a message via MSN to sblair
Default

Welcome to the forums George!

I'll take the second part first. All the units for Sensors are pre-defined within the protocol. So a controller that supports Sensors should have support for all the unit types listed in Table A-13.

SUPPORTED_PARAMETERS is only used to tell the controller what messages (PIDs) that are implemented in the device. There is very little a controller can do with a device without using SUPPORTED_PARAMETERS to find out the capabilities of the device.

Here's some code snippets that show temperature sensor implementations. Sometimes code is faster than English

Sorry for the whitespace mangling the forums do to it, but it should be somewhat readable. This is how to define a message. Then the SENSOR_VALUE message is used to get the actual values for the sensor after it has been defined.

Code:
 
case
E120_SENSOR_DEFINITION:
switch(pRdmMessage->uData[0])
{
case 0: //CPU Temp
i = 0; ParamData[i++] = 0; //Sens # ParamData[i++] = E120_SENS_TEMPERATURE; //Type ParamData[i++] = E120_UNITS_CENTIGRADE; //Unit ParamData[i++] = E120_PREFIX_NONE; //Prefix ParamData[i++] = (BYTE)(RDM_MINIMUM_TEMPERATURE >> 8); //Range Min Value 16-bit ParamData[i++] = (BYTE)(RDM_MINIMUM_TEMPERATURE); ParamData[i++] = (BYTE)(RDM_MAXIMUM_TEMPERATURE >>8); //Range Max Value 16-bit ParamData[i++] = (BYTE)(RDM_MAXIMUM_TEMPERATURE); ParamData[i++] = (BYTE)(RDM_MINIMUM_TEMPERATURE >> 8); //Normal Min 16-bit ParamData[i++] = (BYTE)(RDM_MINIMUM_TEMPERATURE);
ParamData[i++] = (BYTE)(RDM_MAXIMUM_TEMPERATURE >> 8); //Normal Max/ 16-bit
ParamData[i++] = (BYTE)(RDM_MAXIMUM_TEMPERATURE); ParamData[i++] = 2; //Recorded Value Bit Masks: Bit 1 indicates Max/Min support strcpy((char*)(pParamData+i), "CPU Temp");
BufferSize = (BYTE)(i + 8);
respond = TRUE; //Description variable 32 chars.
break;
__________________
Scott M. Blair
RDM Protocol Forums Admin
sblair is offline   Reply With Quote