Echelon Neuron C User Manual
Page 90

78
How Devices Communicate Using Network Variables
#endif
// For all inheriting configuration properties that
// apply to this network variable and that are
// implemented as configuration network variables,
//
repeat
this
type
change.
break;
case
NVT_CAT_INITIAL:
// This is a request to change the type back to its
// initial type (whichever is the initial type).
// For cardinal types with significant scaling
// factors A, B, or C, the application may need to
// restore those scaling factors or to preserve
// that knowledge otherwise; see GetCurrent() or
// SetCurrent() functions, below, for details.
// The sizeof() function always returns the size of
//
the
initial
type.
nvoVolt::nvType.type_length
=
sizeof(nvoVolt);
nvTypeLastGood
=
nvoVolt::nvType;
#ifdef _DEBUG // see text!
nvoVolt::nv_len
=
nvoVolt::nvType.type_length;
#endif
// For all inheriting configuration properties that
// apply to this network variable and that are
// implemented as configuration network variables,
//
repeat
this
type
change.
break;
// Reject all other types. This example implementation
// just refuses the change request and continues to
// operate on the last known good type:
default:
nvoVolt::nvType
=
nvTypeLastGood;
error_log(TYPE_ERROR);
getObjStatus(fbSensor::global_index)->invalid_request
=
TRUE;
updateNode_Status();
} // end of switch
} // any change at all
} // function changeLength()
// The fbSensorDirector() function manages this functional block.
// Because the nvType CP has been declared with the reset_required
// flag, the director must call the changeLength() function as part
// of the reset processing to allow for the type change request to
// be executed.
// The director function is not called automatically, but
// requires a framework that explicitly calls the director.
// The director implementation shown here is incomplete, as it
// ignores all other commands and duties. See the director
// implementation generated by the NodeBuilder Code Wizard
// for a more comprehensive example of a director function, and
// for a complete framework that issues director invocations.
void fbSensorDirector(unsigned uFbIndex, int iCommand) {
if ((TFblock_command)iCommand == FBC_WHEN_RESET) {
changeLength();
setLockedOutBit(uFbIndex,
FALSE);
} // FBC_WHEN_RESET
} // fbSensorDirector()
// Whenever the current length of the changeable network-type variable is
// required by the Neuron firmware, the firmware calls the
// get_nv_length_override() system image extension. This function