Echelon ISI User Manual

Page 36

Advertising
background image

ISI Programmer’s Guide

34

}
}

E

XAMPLE

4

The following example opens manual enrollment for a compound assembly

with four selectors. The isiGetWidth() returns the library’s default value. In
this example, enrollment is being opened in response to the user pressing a

Connect button. Enrollment can only be opened when the ISI engine is in the

normal state. The ProcessIsiButton() function is called in response to the
Connect button being pressed:

IsiEvent isiState;

void IsiCreateCsmo(....) {

// set pCsmoData as desired

}

unsigned IsiGetWidth(unsigned Assembly) {

return Assembly == myAssemblyNumber ?

4 : isiGetWidth(Assembly);
}

void ProcessIsiButton(unsigned Assembly) {
switch(isiState)

{

...
case

isiNormal:

IsiOpenEnrollment(Assembly);
break;
... //Processing for other states
} // end of switch(state)
}

E

XAMPLE

5

The following example opens controlled enrollment for a compound assembly
with four selectors. The isiGetWidth() returns the library’s default value:

IsiEvent isiState;

void IsiCreateCsmo(....) {

// set pCsmoData as desired

}


unsigned IsiGetWidth(unsigned Assembly) {

return Assembly == myAssemblyNumber ?

4 : isiGetWidth(Assembly);
}

void sendControlResponse(boolean success) {
IsiMessage ctrlResp;

ctrlResp.Header.Code = isiCtrp;
ctrlResp.Ctrp.Success = success;
memcpy(ctrlResp.Ctrp.NeuronID,
read_only_data.neuron_id, NEURON_ID_LEN);


resp_out.code = isiApplicationMessageCode;
memcpy(resp_out.data, &ctrlResp,
sizeof(IsiMessageHeader)+sizeof(IsiCtrp));
resp_send();
}

Advertising