CORDET Framework - C2 Implementation
CrMaMain.c File Reference

Main program for the Master Application of the CORDET Demo. More...

Go to the source code of this file.

Functions

int main ()
 Main program for the Master Application. More...
 

Detailed Description

Main program for the Master 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 CrMaMain.c.

Function Documentation

int main ( )

Main program for the Master 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 Master Application.
  • It executes a loop and in every cycle of the loop commands may be sent to the Slave Applications and reports may be received from them.

The schedule for sending commands to the Slave Applications is as follows:

  • In cycles which are multiples of 5, the command to set the temperature limit in Slave 1 is sent
  • In cycles which are multiples of 6, the command to enable temperature monitoring in Slave 1 is sent
  • In cycles which are multiples of 90, the command to disable temperature monitoring in Slave 1 is sent

In all control cycles, the client socket waiting for reports from the two slave applications is polled through a call to CrDaClientSocketPoll.

Returns
always returns EXIT_SUCCESS

Definition at line 118 of file CrMaMain.c.

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