The msg_out object definition – Echelon Neuron C User Manual

Page 133

Advertising
background image

Neuron C Programmer’s Guide

121

and one incoming message (or response) at any one time. For example, you

cannot build up two messages in parallel and send them both. Nor can you parse
two input messages at the same time.

The msg_out Object Definition

An outgoing message is predefined as shown below:

typedef enum {FALSE, TRUE} boolean;
typedef enum {ACKD, UNACKD_RPT,

UNACKD, REQUEST} service_type;


struct {

boolean priority_on; // TRUE if a priority message

//

(default:FALSE)

msg_tag tag;

// message tag (required)

int code;

// message code (required)

int data[MAXDATA] // message data (default:none)

boolean authenticated; // TRUE if to be authenticated

//

(default:FALSE)

service_type service; // service type (default:ACKD)

msg_out_addr dest_addr; // see include file msg_addr.h

//

(optional

field)

} msg_out;

priority_on When set to TRUE, sends the message as a priority message. Specify

FALSE, or do not assign to this field, if the message is not a priority

message. If used, this field must be the first field set in the message

object, even before the tag. The default is FALSE (that is,
nonpriority).

tag

A message tag identifier for the message. This field is required. See

Message Tags

on page 122.

code

A numeric message code. This field is required. See

Message Codes

on page 123.

data

The application's data. This field is optional; a message can consist of
only a message tag and message code. Because of network buffer

overhead, MAXDATA must never exceed 228. MAXDATA is a
function of the app_buf_out_size pragma (see Chapter 8,

Memory

Management

, on page 173):

MAXDATA = app_buf_out_size – 6

or

MAXDATA = app_buf_out_size – 17
(if explicit addressing is used for messages or network variables in
this program)
Note: The Neuron firmware observes which locations in the data

array have assignments and automatically sets the length of the
outgoing message accordingly.

authenticated

A TRUE value specifies that the message is to be

authenticated. You can specify FALSE, or not assign to this field, if

Advertising