Application module


Detailed Description

This module manages the application stuff from bringing up the TCPIP Stack, doing all the user interactions for this, searching for a SRCP server and open and manages the TCP connection to this server.


Files

file  appl.c
 This file implements the eWicht application module.
file  appl.h
 This file includes the eWicht application module API.
file  appldefs.h
 This file defines some basic structures and enumerators for the application module.
file  dialog.c
 This file implements the dialog module.
file  dialog.h
 This file includes the dialog module API.
file  eeprom_adds.h
 This file includes a global address partion table for the eWicht EEPROM.
file  error.c
 This file implements error print functions.
file  error.h
 This file includes some common error codes.

Data Structures

struct  SPAPPLDATA
 This typedef defines the peristent structure for common application settings. More...

Defines

#define BOOTUP_EEPROM_ADD   (0x0000u)
 EEPROM byte address for application network data.
#define APPL_EEPROM_ADD   (0x0100u)
 EEPROM byte address for common application data.

Enumerations

enum  _SEARCH_MODES { SEARCH_UNKNOWN = 0, SEARCH_IP, SEARCH_NAME, SEARCH_SERVICE }
 This typedef defines the different ways to find and connect a server. More...

Functions

void ApplInit (void)
 Call this function to initialize the application module.
void ApplMain (void)
 Call this function periodically to execute the application module.
IP_ADDR * ApplGetServerIP (void)
 Call this function to determine the IP address of the configured server for this device.
NODE_INFOApplGetServerNodeInfo (void)
 Call this function to determine the node info (MAC and IP address) of the configured server for this device.
WORD_VAL ApplGetServerPort (void)
 Call this function to determine the port (TCP/UDP) of the configured server for this device.
BOOL ApplIsConnected (void)
 This proxy function delivers the connect state of the current project.
void ApplResetToFactory (BOOL KeepBootup)
 This function restores the EEPROM content to a well known state.
void ApplShutDown (void)
 The function initiates the shut down sequence while the application is still running.
BOOL ApplIsRunning (void)
 The function is the indicator for the running application.
void ApplStop (void)
 This function finally stops the application, i.e.
void ApplChangeLocoDirMode (BOOL Mode)
 Call this function to change the current mode for changing the direction of a controlled loco.
void ApplRestart (BOOL ResetToFactory)
 This function initiate a restart of the device.

Variables

SPAPPLDATA sPApplConfig
 The persistent data field for common application data.
BYTE u8ApplTimer
 The application timer runs backwards in units of 10 ms if different from zero.


Define Documentation

#define APPL_EEPROM_ADD   (0x0100u)

EEPROM byte address for common application data.

See SPAPPLDATA for a detailed documentation of the structure elements. On startup the data is loaded into RAM (sPApplConfig).

Definition at line 26 of file eeprom_adds.h.

#define BOOTUP_EEPROM_ADD   (0x0000u)

EEPROM byte address for application network data.

See PCOMMON_CONFIG for a detailed documentation of the structure elements. On startup the data is loaded into RAM (sPCommonConfig).

Definition at line 18 of file eeprom_adds.h.


Enumeration Type Documentation

This typedef defines the different ways to find and connect a server.

Enumerator:
SEARCH_UNKNOWN  Placeholder for initial startups and factory resets.

SEARCH_IP  The search uses the prior set IP address and TCP port.
SEARCH_NAME  The search uses the prior set network name and TCP port.
SEARCH_SERVICE  The search uses the prior set service name.

Definition at line 61 of file appl.h.


Function Documentation

void ApplChangeLocoDirMode ( BOOL  Mode  ) 

Call this function to change the current mode for changing the direction of a controlled loco.

Parameters:
Mode See TOGGLEDIRMODE_CLICK and TOGGLEDIRMODE_ZERO for details.

Definition at line 594 of file appl.c.

IP_ADDR* ApplGetServerIP ( void   ) 

Call this function to determine the IP address of the configured server for this device.

Returns:
A pointer to the 32 bit IP address of the server.

Definition at line 133 of file appl.c.

NODE_INFO* ApplGetServerNodeInfo ( void   ) 

Call this function to determine the node info (MAC and IP address) of the configured server for this device.

Returns:
A pointer to the node info structure (NODE_INFO).

Definition at line 141 of file appl.c.

WORD_VAL ApplGetServerPort ( void   ) 

Call this function to determine the port (TCP/UDP) of the configured server for this device.

Returns:
The configured TCP/UDP port

Definition at line 149 of file appl.c.

BOOL ApplIsConnected ( void   ) 

This proxy function delivers the connect state of the current project.

It calls the appropriate project function for this.

Return values:
TRUE The application is in connected state.
FALSE The application is not in connected state.

Definition at line 157 of file appl.c.

BOOL ApplIsRunning ( void   ) 

The function is the indicator for the running application.

Return values:
TRUE The application module is running.
FALSE The application has reached the final state (shut down).

Definition at line 539 of file appl.c.

void ApplMain ( void   ) 

Call this function periodically to execute the application module.

Definition at line 197 of file appl.c.

void ApplResetToFactory ( BOOL  KeepBootup  ) 

This function restores the EEPROM content to a well known state.

Parameters:
KeepBootup If TRUE the bootup content is restored from RAM after deleting the EEPROM content, if FALSE the bootup content is also reseted.

Definition at line 554 of file appl.c.

void ApplRestart ( BOOL  ResetToFactory  ) 

This function initiate a restart of the device.

Parameters:
ResetToFactory If TRUE, the content of the EEPROM is restored to a well known state, if FALSE only a restart is performed.

Definition at line 608 of file appl.c.

void ApplShutDown ( void   ) 

The function initiates the shut down sequence while the application is still running.

Definition at line 518 of file appl.c.

void ApplStop ( void   ) 

This function finally stops the application, i.e.

in case of shut down.

Definition at line 173 of file appl.c.


Variable Documentation

The persistent data field for common application data.

The field stores common settings of the eWicht application. ApplInit loads the data which is stored in the data EEPROM into this SRAM field. The SRCP Menu, the eWicht web interface or the function BootupResetToFactory can change this fields and store it back to the EEPROM.

Definition at line 119 of file appl.h.

The application timer runs backwards in units of 10 ms if different from zero.

Simply write a value to it to start it

Definition at line 125 of file appl.h.


Generated on Sun Nov 27 20:02:40 2011 for eWicht by  doxygen 1.5.5