The director function – Echelon Neuron C User Manual

Page 125

Advertising
background image

Neuron C Programmer’s Guide

113

between the internal and external names of configuration properties, you should

preserve some degree of similarity between the internal and external names.

Example:

SCPTbrightness cp_family cpBrightness;

This example above implements a configuration property family with the internal

name

cpBrightness

of type name

SCPTbrightness

. The type name is likely to

appear as an external, textual, reference to that property, depending on the

implementation of the network tool.

The Director Function

You can create a

director function

for each functional block. A director function

is a function that can provide actions associated with the functional block such as

enable, disable, reset, or test. The association with the functional block enables

easy implementation of the standard request functions defined by Node Object
functional block. These request functions allow a network tool to send a request

to a device to enable, disable, reset, or test any functional block on the device.

The Node Object implementation can vector these requests to the appropriate
functional block function through the use of the director function. The Node

Object implementation generated by the NodeBuilder Code Wizard includes code
to call the functional block director functions based on inputs from the Node

Object Request input.
A director function must match the function prototype shown below. The first
parameter is the global index of the functional block for which the director is

being called, and the second parameter is a command code upon which the

director is to act.

void

director-name

(unsigned

fbIndex

, unsigned

command

);

You attach a director function to a functional block with an optional declaration

statement at the end of the member list of the functional block. You do not need
to declare a director function. You can also share one director function among

multiple functional blocks, but all elements of a functional block array must

share the same director function.

Example:

void myDirector (unsigned fbIndex, unsigned command);

fblock . . . {

/* Member NVs, “implements” . . . */


director

myDirector;

} myFB;

void myDirector (unsigned fbIndex, unsigned command) {
. . . /* whatever */
}

The director function simplifies implementation of functional block commands

received through the Node Object functional block by promoting modular
development. Each functional block is a functional unit, a collection of network

variables and properties. A network tool can send a request to a device’s Node

Object to enable, disable, reset, or test any functional block on the device. The

Advertising