Constructing a response – Echelon Neuron C User Manual

Page 149

Advertising
background image

Neuron C Programmer’s Guide

137

Important: Because an Interoperable Self-Installation (ISI) network uses

unbounded groups (group size 0), your ISI-enabled application should not poll
network variable values. Using a request/response service with unbounded

groups can significantly degrade network performance.
The functions, events, and objects for constructing, sending, and receiving
responses are analogous to those for constructing, sending, and receiving

messages, described in the previous section. They are also summarized in the
following paragraphs.
An example of sending a request is the following:

msg_tag motor;
#define MOTOR_STATE 1

when (io_changes(switch1) to 0)
{
//send a request to the motor
msg_out.tag = motor;
msg_out.service = REQUEST;
msg_out.code = MOTOR_STATE;
msg_send();
}

The request is packaged as shown in Figure 11 on page 119. The application

program on the receiver device receives the request through a

when clause (or

msg_receive( ) function) and must then formulate a response to this request, as

shown in Figure 13.

Application

Scheduler

Network

MAC

Hardware

Sender Device (writer)

Application

Scheduler

Network

MAC

Hardware

Receiver Device (reader)

= data

Figure 13. Sending a Response

Constructing a Response

You can construct a response to a request message. As shown in Figure 13, the

response contains a data portion that is sent to the application processor of the
sender device. A response is different from an acknowledgment (Figure 12 on

page 131), which does not contain a data portion and is sent only to the network

processor on the sender device.

The name of the outgoing response object is resp_out. The response inherits its

priority and authentication designation from the request to which it is replying.

Advertising