Offline event, Syntax, Example – Echelon Neuron C User Manual
Page 35
Neuron C Reference Guide
15
nvoHumidity3;
...
nvoHumidity2 = 32;
...
when (nv_update_succeeds(nvoHumidity1 .. nvoHumidity3))
{
...
}
offline Event
The offline event evaluates to TRUE only if the device is online and an
Offline
network management message is received from a network tool, or when a
program calls go_offline( ). The offline event is handled as the first priority when
clause. It can be used in no more than one when
clause in a program.
The offline state can be used in case of an emergency, for maintenance prior to
modifying configuration properties, or in response to some other system-wide
condition. After execution of this event and its task, the application program
halts until the device is reset or brought back online. While it is offline, a device
can respond to certain messages, but only
Reset
or
Online
messages from a
network tool are processed by the application. For example, network variables on
an offline device cannot be polled using a network variable poll request message
but they can be polled using a
Network Variable Fetch
network management
message.
If this event is checked for outside of a when clause, the programmer can confirm
to the scheduler that the application program is ready to go offline by calling the
offline_confirm( ) function (see
Going Offline in Bypass Mode
in Chapter 7,
Additional Features
, of the
Neuron C Programmer's Guide
).
When an application goes offline, all outstanding transactions are terminated.
To ensure that any outstanding transactions complete normally before the
application goes offline, the application can call flush_wait( ) in the when(offline)
task.
Syntax
offline
Example
when (offline)
{
flush_wait();
// process shut-down command
}
when (online)
{
// start-up again
}