CORDET Framework - C2 Implementation
CrS2Main.c File Reference

Main program for the Slave 2 Application of the CORDET Demo. More...

Go to the source code of this file.

Functions

int main ()
 Main program for the Slave 2 Application. More...
 

Detailed Description

Main program for the Slave 2 Application of the CORDET Demo.

The CORDET Demo consists of three applications: the Master Application, the Slave 1 Application and the Slave 2 Application. The two slave applications are responsible for monitoring a temperature sensor. If they find a limit violation, they send a report to the Master Application. The Master Application is responsible for enabling and disabling the monitoring in the slave applications and for setting the monitoring limits.

The CORDET Demo supports one single service: the "Temperature Monitoring Service". The type identifier of the Temperature Monitoring Service is equal to: 64. This service is implemented by the following commands and reports:

  • Sub-Type 1: Command to enable temperature monitoring
  • Sub-Type 2: Command to disable temperature monitoring
  • Sub-Type 3: Command to set the temperature limit
  • Sub-Type 4: Report to report a temperature limit violation

The logical links among the three applications are as follows:

  • The Master Application sends commands to both Slave Applications
  • Each Slave Application sends reports to the Master Application

Note that there is no logical link between the two slaves which are completely independent of each other (see first figure below).

The physical links among the three applications are as follows (see second figure below):

  • There is a socket-based link between the Master Application and Slave 1
  • There is a socket-based link between the Slave 1 and Slave 2

Thus, messages between the Master Application and Slave 2 are routed through Slave 1 (the routing is done by the CORDET Framework).

The Master Application generates the commands to and receives the reports from the Slave Applications.

DA_LogicalLinks.png
DA_PhysicalLinks.png
Author
Vaclav Cechticky vacla.nosp@m.v.ce.nosp@m.chtic.nosp@m.ky@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m
Alessandro Pasetti paset.nosp@m.ti@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m

This file is part of the CORDET Framework.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

For information on alternative licensing, please contact P&P Software GmbH.

Definition in file CrS2Main.c.

Function Documentation

int main ( )

Main program for the Slave 2 Application.

This Main Program performs the following actions:

  • It checks the consistency of the configuration parameters using CrFwAuxConfigCheck.
  • It initializes and configures the InStreams and OutStreams components (note that their initialization action initializes the client socket and this must be synchronized with the initialization of the server socket in the Slave 1 Application).
  • It initializes and configures all framework components used by the Slave 2 Application.
  • It executes a loop and in every cycle of the loop commands may be received from the Master Applications and reports may be sent to it.

In all control cycles, the client socket waiting for commands from the Master Application is polled through a call to CrDaClientSocketPoll.

In principle, in all control cycles, the temperature to be monitored should be acquired from some external device. In this example, instead, the temperature is set to a "low" value in all cycles except those which are multiples of 5 when it is set to a "high" value.

Returns
always returns EXIT_SUCCESS

Definition at line 117 of file CrS2Main.c.

P&P Software GmbH, Copyright 2012-2013, All Rights Reserved