Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


To receive notification of successful or unsuccessful completion of a previously initiated propagation of an output datapoint, subscribe to the onComplete() event.

This section consists of the following:

Table of Contents

Device Datapoints Events

To receive notification of a successful completion of a device datapoint update, create a datapoint update event handler function, and register this event handler with the datapoint. To register an update event handler with a device input datapoint, use the onUpdate() attribute. To register a completion event handler with a device output datapoint, use the onComplete() attribute.

Example 1

Code Block
#include "IzotDev.h"   

SNVT_volt(input) input; //@Izot datapoint(direction=Input) onUpdate(updateEvent) 
SNVT_volt(output) output ; //@Izot datapoint onComplete(completionEvent)   

void updateEvent(const unsigned index, const IzotReceiveAddress *constpSource) { 
// Example number crunching algorithm: = 3 *;   

void completionEvent (const unsignedindex, const IzotBoolsuccess) {   
	// The 'output' datapoint completed  propagating.   
	// For example, maintain success/failure  rates and raise an error   
	// when the error rate exceeds a reasonable  percentage  of the total   
	// number of updates.     



The updateEvent and completionEvent handlers, shown in the example above, are supplied with an index argument, which can be used to identify the corresponding datapoint by inspecting the datapoint's global index attribute. This allows using one update event handler with multiple datapoints.  For event handlers registered only with one datapoint (as shown in the example) the value of the index argument always matches the datapoint's global index value.

Block Datapoint Events

To register an onUpdate or onComplete event for a member of a block, use the onUpdate() and onComplete() attributes with two arguments: the first argument identifies the block member just as with the implement() attribute, the second identifies the event handler in the same way as the device datapoint events discussed above.

Example 2

This example defines two blocks, an implementation of a standard open loop sensor and an open loop actuator block, using the SNVT_temp_fstandard datapoint type for both. The application then defines the update event handler with the actuator_update() function (whose prototype must match a function prototype defined by the IzoT Device Stack API), and registers this update event handler. When new data arrives for the actuator's nviValue member, the event handler executes, then multiplies the new input value with the current value of the nciGain property, and writes that result to the sensor's nvoValue output.  The event handler notifies the IzoT Device Stack that this output datapoint has been updated and is ready for propagation.