Example, Go_offline( ) function, Syntax – Echelon Neuron C User Manual

Page 106

Advertising
background image

86

Functions

Example

void f(void)
{

unsigned int start, delta;


start = get_tick_count();

...

delta = get_tick_count() - start;

}

go_offline( )

Function

The go_offline( ) function takes an application offline. This function call has the
same effect on the device as receiving an

Offline

network management message.

The offline request takes effect as soon as the task that called go_offline( ) exits.

When that task exits, the when(offline) task is executed and the application
stops.
When an

Online

network management message is received, the when(online)

task is executed and the application resumes execution.
When an application goes offline, all outstanding transactions are terminated.

To ensure that any outstanding transactions complete normally, the application
can call flush_wait( ) in the when(offline) task.

Syntax

#include <control.h>

void go_offline (void);

Example

boolean maintenanceMode;

...

when (maintenanceMode)
{
go_offline();
}

when (offline)
{
// process shut-down command
flush_wait();
io_out(maintenanceLed, 0);
}

when (online) {
...
// re-start suspended operation, I/O devices,
// interrupts, etc
io_out(maintenanceLed, 1);
}

Advertising