SRCP Client


Detailed Description

This group implements a complete SRCP client (SRCP version 0.8.X).

It handles the handshaking, the input of new GA and GL data, the consistence view of the server data and all user inputs which changes the server data.


Files

file  srcp/projectdefs.h
 This file defines some basic structures and enumerators for SRCP handling.
file  srcp.c
 This file implements the SRCP client module.
file  srcp.h
 This file defines the SRCP API which can be called by the web interface (Web interface) and eWicht application modules.

Data Structures

struct  SPSRCPCONFIG
 The fields in this structure configure the common SRCP handling. More...
struct  _PERS_PROTOCOL_CONFIG
 The structure elements define a SRCP protocol like it is stored in EEPROM. More...
struct  SPSET
 The structure elements define a SRCP object (GA or GL) stored in EEPROM. More...
SPSRCPCONFIG sPSRCPConfig
 The persistent data field for common SRCP configuration data.

Defines

#define PROJECT_ID   SRCP_PROJECT
 The project identifier.
#define PROJECT_NAME   "srcp"
 The project name used by the display and the web interface.
#define PROJECT_SERVICE_NAME   "_srcp"
 The name of the service to search for (used by the MDNS module).
#define PROJECT_DEFAULT_PORT   (4303u)
 The standard port for SRCP servers.
#define SRCP_NAME_MAXLEN   16
 Maximum supported name length here (protocol names, descriptions).
#define SRCP_PROTO_MAXLEN   3
 Maximum length of SRCP protocol specifiers (i.e. "N 1").
#define SRCP_SERVERCACHE_ID   0xFE
 Internal identifier for a configuration set (loco data) from server cache.
#define SRCP_EEPROMSET_ID   0xFF
 Internal identifier for a configuration set from persistent storage.
#define MAX_PROTO_SLOTS   8
 Maximum count of supported protocols (N for GL and N for GA).
#define MAX_SRCP_FUNCTIONS   13
 Maximum supported loco functions (F0 inclusive).
#define MAX_SRCP_SPEEDSTEPS   128
 Maximum supported loco speed steps.
#define SRCP_EEPROMSET_COUNT   32
 Count of maximum configurations in EEPROM (shared between GAs and GLs).
#define SRCP_GLEEPROMSET_COUNT   16
 Count of maximum GL configurations in EEPROM.
#define SRCP_GAEEPROMSET_COUNT   4
 Count of maximum GA configurations in EEPROM.
#define SRCP_EEPROMSET_IDX_MASK   0x0F
 Mask for generating the device independent EEPROM set ID.
#define SRCP_EEPROMSET_GA_MASK   0x10
 Simple identifier mask for an GA EEPROM set.
#define SRCP_CONFIG_EEPROM_ADD   (0x0200u)
 EEPROM byte address for common SRCP configuration data.
#define SRCP_PROTOS_EEPROM_ADD   (0x0300u)
 EEPROM byte address for SRCP protocol data.
#define SRCP_SETS_EEPROM_ADD   (0x0800u)
 EEPROM byte address for SRCP set data.
#define PROJECT_SOCKET_CONFIGURATION
 This macro defines the used sockets for this project.
#define PROJECT_INITIAL_INIT   SRCPInitialInit
 This macro is used as hook in the ApplInit function.
#define PROJECT_LOCO_DIR_MODE_HAS_CHANGED   SRCPLocoDirModeHasChanged
 This macro is used as hook in the ApplChangeLocoDirMode function.
#define PROJECT_HANDLE_SERVER_CONNECTION   SRCPHandleServerConnection
 This macro is used as hook in the main task of the APPL Module.
#define PROJECT_RESET_TO_FACTORY   SRCPRestoreToFactory
 This macro is used as hook in the ApplResetToFactory function.
#define PROJECT_PREPARE_CONNECTION   SRCPPrepareConnection
 This macro is used as hook in the main task of the APPL Module.
#define PROJECT_START_DISCONNECT   SRCPStartDisconnect
 This macro is used as hook in the disconnect function of the APPL module.
#define PROJECT_IS_CONNECTED   SRCPIsConnected
 This macro is used as hook in the ApplIsConnected function.
#define PROJECT_MAIN   SRCPMain
 This macro is used as hook in the main task of the APPL Module.
#define PROJECT_WEBSITES
 Defines the sites for this project.

Functions

void SRCPRestoreToFactory (void)
 Resets the SRCP related stuff to a well known start configuration.
BOOL SRCPIsConnected (void)
 Delivers if the SRCP client is actually connected with the server.
void SRCPInitialInit (void)
 This function must be called on startup to load the persistent SRCP configuration data into RAM and to do some initialization.
void SRCPStartDisconnect (void)
 Start disconnecting from server.
void SRCPPrepareConnection (void)
 Prepare internal state before starting a connect to the SRCP server.
APPL_CONNECTING_RETCODE SRCPHandleServerConnection (void)
 State machine is called during connecting and handshaking to or disconnecting from SRCP server.
BOOL SRCPMain (void)
 The main state machine of the SRCP client is called during the client is connected with the SRCP server.
void SRCPLocoDirModeHasChanged (void)
 Takes changes on the changed direction mode for locos.


Define Documentation

#define PROJECT_HANDLE_SERVER_CONNECTION   SRCPHandleServerConnection

This macro is used as hook in the main task of the APPL Module.

Definition at line 121 of file srcp/projectdefs.h.

#define PROJECT_INITIAL_INIT   SRCPInitialInit

This macro is used as hook in the ApplInit function.

Definition at line 115 of file srcp/projectdefs.h.

#define PROJECT_IS_CONNECTED   SRCPIsConnected

This macro is used as hook in the ApplIsConnected function.

Definition at line 133 of file srcp/projectdefs.h.

#define PROJECT_LOCO_DIR_MODE_HAS_CHANGED   SRCPLocoDirModeHasChanged

This macro is used as hook in the ApplChangeLocoDirMode function.

Definition at line 118 of file srcp/projectdefs.h.

#define PROJECT_PREPARE_CONNECTION   SRCPPrepareConnection

This macro is used as hook in the main task of the APPL Module.

Definition at line 127 of file srcp/projectdefs.h.

#define PROJECT_RESET_TO_FACTORY   SRCPRestoreToFactory

This macro is used as hook in the ApplResetToFactory function.

Definition at line 124 of file srcp/projectdefs.h.

#define PROJECT_SOCKET_CONFIGURATION

Value:

{TCP_PURPOSE_DEFAULT, TCP_ETH_RAM, 300, 1500}, \
                                        {TCP_PURPOSE_DEFAULT, TCP_ETH_RAM, 300, 1000}
This macro defines the used sockets for this project.

Definition at line 111 of file srcp/projectdefs.h.

#define PROJECT_START_DISCONNECT   SRCPStartDisconnect

This macro is used as hook in the disconnect function of the APPL module.

Definition at line 130 of file srcp/projectdefs.h.

#define PROJECT_WEBSITES

Value:

{STRTBLID_SYSTEMSTATE, "index.htm", NAV_CLOSE},         \
                                {STRTBLID_COMMON, "common.htm", NAV_CLOSE},             \
                                {STRTBLID_SRCP, "srcp.htm", NAV_SUBNAV},                \
                                {STRTBLID_LOCO_PROTOCOLS, "locoproto.htm", NAV_CLOSE},  \
                                {STRTBLID_LOCO_DATABASE, "locos.htm", NAV_CLOSE},       \
                                {STRTBLID_ACC_PROTOCOLS, "accproto.htm", NAV_CLOSE},    \
                                {STRTBLID_ACC_DATABASE, "accs.htm", NAV_SUBNAVEND},     \
                                {STRTBLID_FILE, "file.htm", NAV_END},
Defines the sites for this project.

Definition at line 139 of file srcp/projectdefs.h.

#define SRCP_CONFIG_EEPROM_ADD   (0x0200u)

EEPROM byte address for common SRCP configuration data.

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

Definition at line 92 of file srcp/projectdefs.h.

#define SRCP_PROTOS_EEPROM_ADD   (0x0300u)

EEPROM byte address for SRCP protocol data.

At this address an array of _PERS_PROTOCOL_CONFIG elements is located which defines several protocol data for a specific SRCP server.

Definition at line 99 of file srcp/projectdefs.h.

#define SRCP_SETS_EEPROM_ADD   (0x0800u)

EEPROM byte address for SRCP set data.

At this address an array of SPSET elements is located. The sets store data about special SRCP objects like locos and accessories.

Definition at line 106 of file srcp/projectdefs.h.


Function Documentation

APPL_CONNECTING_RETCODE SRCPHandleServerConnection ( void   ) 

State machine is called during connecting and handshaking to or disconnecting from SRCP server.

Definition at line 3959 of file srcp.c.

void SRCPInitialInit ( void   ) 

This function must be called on startup to load the persistent SRCP configuration data into RAM and to do some initialization.

Definition at line 651 of file srcp.c.

BOOL SRCPIsConnected ( void   ) 

Delivers if the SRCP client is actually connected with the server.

Return values:
TRUE Client is connected.
FALSE Client is disconnected.

Definition at line 4126 of file srcp.c.

void SRCPLocoDirModeHasChanged ( void   ) 

Takes changes on the changed direction mode for locos.

See ApplChangeLocoDirMode for more details.

Definition at line 640 of file srcp.c.

BOOL SRCPMain ( void   ) 

The main state machine of the SRCP client is called during the client is connected with the SRCP server.

Definition at line 663 of file srcp.c.

void SRCPPrepareConnection ( void   ) 

Prepare internal state before starting a connect to the SRCP server.

Definition at line 3932 of file srcp.c.

void SRCPRestoreToFactory ( void   ) 

Resets the SRCP related stuff to a well known start configuration.

Definition at line 502 of file srcp.c.

void SRCPStartDisconnect ( void   ) 

Start disconnecting from server.

Definition at line 4142 of file srcp.c.


Variable Documentation

The persistent data field for common SRCP configuration data.

SRCPInitialInit loads the data which is stored in the data EEPROM into this SRAM field. The eWicht web interface or the function BootupResetToFactory can change these fields and store it back to the EEPROM.

Definition at line 62 of file srcp.h.


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