Echelon ISI User Manual

Page 41

Advertising
background image

39

ISI Programmer’s Guide

You can eliminate this additional resource usage by deleting and re-creating a

connection instead of extending it.

You can provide feedback to the user when an invitation is accepted, for example
by changing the state of the Connect light from flashing to solid on when the

connection invitation is accepted. This is typically only done with manual

enrollment. The ISI engine informs your application that a connection invitation
has been accepted by calling the IsiUpdateUserInterface() callback function,

assigning the isiApproved or isiApprovedHost state to the respective assembly.
This allows the application to indicate the accepted connection invitation.

E

XAMPLE

1

The following manual enrollment example accepts a connection invitation
when the user presses a Connect button. The user can press the Connect

button for a long or short period, causing a destructive or constructive

operation. In the context of accepting a connection invitation, the
constructive operation is to accept. No destructive operation exists at this

stage, but once the connection invitation has been accepted but not

implemented yet, the destructive operation would be to cancel out from the
previous acceptance. Using a second button or some other suitable means,

the Connect button’s meaning also can be altered much in the way a Control

or Alt key on a computer keyboard does. In the context of accepting a
connection invitation, the regular operation could be to create a connection by

replacing any previous connection related with the same assembly, if any.
The alternative behavior could be to always extend the connection, thus

preserving any previous connections, if any.

IsiEvent isiState;

void ProcessIsiButton(unsigned Assembly, boolean Constructive,
boolean Alternative) {
switch(isiState)

{

...
case

isiPending:

if

(Constructive)

{

if

(Alternative)

{

IsiExtendEnrollment(Assembly);
}

else

{

IsiCreateEnrollment(Assembly);

}

}

break;

... //Processing for other states
} // end of switch(state)
}

// IsiUpdateUserInterface is called with isiApproved as the
// IsiEvent parameter in response to accepting the enrollment
void IsiUpdateUserInterface(IsiEvent Event, unsigned Parameter) {

... //Optional event processing

isiState = (Event == isiPending || Event == isiApproved

|| Event > isiWarm) ? Event : isiNormal;

}

mtimer repeating IsiTimer = 1000ul / ISI_TICKS_PER_SECOND;

when (timer_expires(IsiTimer)) {
unsigned

Assembly;

Advertising