Example, Resp_send( ) built-in function, Syntax – Echelon Neuron C User Manual

Page 145: Retrieve_status( ) function

Advertising
background image

Neuron C Reference Guide

125

Example

void f(void)
{
...
if (resp_receive()) {
// Process message
...
resp_free();
}
...
}

resp_send( )

Built-in Function

The resp_send( ) built-in function sends a response using the resp_out object. See

Chapter 6,

How Devices Communicate Using Application Messages,

of the

Neuron C Programmer's Guide

for more information.

Syntax

void

resp_send (void);

Example

# define DATA_REQUEST 0
# define OK 1

when (msg_arrives(DATA_REQUEST)))
{
unsigned x, y;
x = msg_in.data[0];
y = get_response(x);
resp_out.code = OK;
// msg_in no longer available
resp_out.data[0] = y;
resp_send();
}

retrieve_status( )

Function

The retrieve_status( ) function returns diagnostic status information to the

Neuron C application. This information is also available to a network tool over

the network, through the

Query Status

network diagnostics message. The

status_struct structure, defined in <status.h>, is shown below.

Syntax

#include <status.h>

void retrieve_status (status_struct *

p

);

typedef struct status_struct {
unsigned long status_xmit_errors;
unsigned long status_transaction_timeouts;

Advertising