Echelon ISI User Manual

Page 37

Advertising
background image

35

ISI Programmer’s Guide

when (msg_arrives) {
IsiMessage

inMsg;

unsigned

myAssembly;


if (IsiApproveMsg()) {

memcpy(&inMsg,

msg_in.data,

sizeof(IsiMessage));

myAssembly

=

nvoValue::global_index;

if (inMsg.Header.Code == isiCtrq) {

if (inMsg.Ctrq.Control == isiOpen &&

inMsg.Ctrq.Parameter

==

myAssembly)

{

sendControlResponse(TRUE);

IsiOpenEnrollment(myAssemblyNumber);

// Other requests deleted for this example

}

else

{

sendControlResponse(FALSE);

}

} else {
(void) IsiProcessMsgS();

}

}
}

E

XAMPLE

6

The following refines example 1 and provides a more comprehensive example
of opening automatic enrollment for a simple assembly with one network

variable:

// MyCsmoData defines the enrollment details for the automatic ISI
// network variable connection offered by this device.
static const IsiCsmoData MyCsmoData = {

ISI_DEFAULT_GROUP,

// Group

isiDirectionOutput,

//

NV

direction

1,

//

Width

2,

//

Profile

number

(2

=

//

SFPTopenLoopSensor)

76u, //

Network

variable

type

index

//

(76

=

SNVT_freq_hz)

0

//

Variant

(0

=

standard)

};

// Call InitiateAutoEnrollment in response to isiWarm
void IsiUpdateUserInterface(IsiEvent Event, unsigned Parameter) {

if (Event == isiWarm && !IsiIsConnected(myAssemblyNumber)) {

// We waited long enough and we are not connected already,

// so let's open an automatic connection:

IsiInitiateAutoEnrollment(&MyCsmoData,

myAssemblyNumber);

}
}

E

XAMPLE

7

The following example opens automatic enrollment for a compound assembly

with four selectors, offering enrollment for member network variables 1 to 4
of an implementation of the SFPTsceneController profile (the nviScene,

nvoSwitch, nviSetting, and nviSwitch members):

// MyCsmoData defines the enrollment details for the automatic ISI
// network variable connection offered by this device
static const IsiCsmoData MyCsmoData = {

Advertising