Creating a polled connection – Echelon ISI User Manual

Page 72

Advertising
background image

ISI Programmer’s Guide

70

// and a compatible network variable type
return Y;
}
...
}

unsigned IsiGetNvIndex(unsigned Assembly, unsigned Offset) {

unsigned Result;
if (Assembly == Y) {
if (Offset) {
Result = AmBecomingHost ? nviValue::global_index
: nvoValue::global_index;
} else {
Result = AmBecomingHost ? nvoValue::global_index
: nviValue::global_index;
}
} else {
Result = isiGetNvIndex(Assembly, Offset);
}
return Result;

}

The application may also map multiple network variables to the same selector
with the IsiGetNextNvIndex() callback. The default implementation of

IsiGetNextNvIndex() returns ISI_NO_INDEX, indicating that only one network
variable, the one indicated with IsiGetNvIndex(), applies to this assembly and

offset value pair.

Mapping multiple network variables to a single selector value is an advanced

feature that is only used with standard functional profiles that specify its use, or
with manufacturer-specific connections. When using this feature, you must be

able to ensure that selector values remain unique within the set of input network
variables.

When using multiple functional blocks, the majority of the code is the same as
the code for a single functional block. There is no difference between referencing

a network variable as a global variable and as a functional block member
variable, i.e. nvoOne::global_index is the same as fbOne::nvoValue::global_index,

as long as nvoOne implements nvoValue in fbOne.

Creating a Polled Connection

You can create a polled connection where devices with an input network variable

in the connection poll one or more output network variables in the connection.
Two fields in the CSMOEX message are used to support polled output NVs. One

field indicates the direction of the network variable that may be subscribed to the

connection on offer. The direction field may have any of the following values:
isiDirectionInput, isiDirectionOutput, isiDirectionAny, and isiDirectionVarious.

The second field indicates a poll Boolean attribute, which is normally cleared.

This allows for the following combinations:

1. Connection host enrolls local, normal, input network variable:

direction(CSMOEX) = isiDirectionOutput or isiDirectionAny,

poll(CSMOEX) = clear;

Advertising