Application buffers – Echelon Neuron C User Manual
Page 154

142
How Devices Communicate Using Application Messages
sends any repeated requests to the application and the application must
regenerate the response. This provides the opportunity for the application to
update the response to a repeated request. If the application wants to treat these
repeated request messages as non-idempotent, it can do so by buffering responses
by receive transaction index and re-issuing those responses when duplicate
requests arrive. An example is shown below.
Example:
#define OK 1
#define MAXRESP 10
struct RespBuffer {
int
code;
unsigned int len;
int
data[MAXRESP];
} resp_buffer[16];
when (msg_arrives) {
struct RespBuffer *buf_p;
if (msg_in.service == REQUEST) {
buf_p
=
&resp_buffer[msg_in.rcvtx];
if
(!msg_in.duplicate)
{
int
i;
//
Process
initial
request
//
.
.
.
//
Now
save
response
buf_p->code
=
OK;
buf_p->len
=
MAXRESP;
for (i=0; i buf_p->data[i] = get_resp_data(); } } // Generate the response. resp_out.code = buf_p->code; memcpy(resp_out.data, buf_p->data, buf_p->len); resp_send(); The above example also shows that the rcvtx field of the msg_in object specifies the receive transaction index to which the request belongs. Application Buffers You can set the number of incoming and outgoing buffers available for use by a Neuron Chip and the Smart Transceivers, except the Neuron 3120 Chip and the • Two priority application output buffers
}
}
Neuron C application during compilation. The defaults for all models of the
Neuron 3120E1 Chip, are:
• Two nonpriority application output buffers