beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 96

background image

82

Creating Freely Programmable Modules

}

}

Reading Structured Data Points

To read the value of a structured data point, you first need to store the data point field in a temporary
data point variable. Note that you use the -> operator (element selection through pointer) to reference
the fields of a structured data point. The following code demonstrates how to read the fields of a
structured data point:

void CUFPTHVACController::Work()
{

SNVT_switch tmpSwitch;

tmpSwitch.state = nvoAirConditioner_OnOff->state;
tmpSwitch.value = nvoAirConditioner_OnOff->value;

if (tmpSwitch.state == 0)
{

//insert code here

}

if (tmpSwitch.value >= 145)
{

//insert code here

}

}

Reading Enumerated Data Points

To read the value of an enumerated data point, you need to use the values of the corresponding
enumeration type. The following code demonstrates how to read the following enumeration types:

• An hvac_t enumeration in the standard.h file in the

LonWorks\iLON\Development\include folder

• A pointStatus enumeration in the FPM_variable.h file in the

LonWorks\iLON\Development\eclipse\plugins\com.echelon.eclipse.ilon100.fpm_0.9.0\
compiler\echelon\fpm\include folder.

DECLARE(_0000000000000000_0_::SNVT_temp_f, nviSetPoint, INPUT_DP)
DECLARE(_0000000000000000_0_::SNVT_hvac_mode, nviHVACMode, INPUT_DP)

.........
void CUFPTHVACController::Work()
{

FPM::Dp::PointStatus nviSetPoint_status = FPM::Dp::AL_NUL;

if (nviHVACmode == hvac_t::HVAC_HEAT) //HVAC_HEAT

{

nviSetPoint_status = (FPM::Dp::PointStatus)
nviSetPoint.GetDpPropertyAsPointStatus
(FPM::Dp::dataUCPTstatus);

}

if (nviSetPoint_status == FPM::Dp::AL_NO_CONDITION)

{

//insert code here

}

}