Application messages, Constructing a message – Echelon Neuron C User Manual
Page 132

120
How Devices Communicate Using Application Messages
Application Messages
You can explicitly create a message using Neuron C. Rather than using the
implicit messaging capability provided by network variables, you can manually
construct and send a message. This type of message is called an
explicit
message. You must identify the type of this explicit message using a message
code. The
message code
identifies the message as an application message,
foreign-frame message, or network variable message. The following sections
describe how to use the objects, functions, and events used with application
messages. The request/response mechanism, a special use of application
messages, is described following the generalized description of application
messages. The same mechanisms used for application messaging can also be
used to create and send foreign-frame messages (for proprietary gateways) and
explicitly addressed network variable messages.
You must construct an application message using a predefined message object,
and then process it using function calls and predefined events. Following is a
brief list of the steps described in the following sections. Objects, functions, and
events are itemized for each section.
Functional Step
Neuron C Feature
1
Constructing a message
msg_out object
2
Sending a message
msg_send( ) function
msg_cancel( ) function
3 Receiving
a
message
msg_arrives event
msg_receive( ) function
msg_in object
4
After sending a message
with the acknowledged
service
msg_completes event
msg_succeeds event
msg_fails event
5
Sending a response to a
message with the
request/response service
resp_out object
resp_send( ) function
resp_cancel( ) function
resp_arrives event
resp_receive( ) function
resp_in object
6 Allocating
buffers
explicitly
msg_alloc( ) function
msg_alloc_priority( ) function
msg_free( ) function
resp_alloc( ) function
resp_free( ) function
Constructing a Message
You can construct an application message using the msg_out outgoing message
object. This definition is built into Neuron C. Use the msg_send( ) function to
send the message. You can only construct one outgoing message (or response)