CAU

- The Model Railway
- - Software
- - - libRailControl
- - - - Constants/Functions
- - - - - Constants
- - - - - Initialisation
- - - - - Block Sections
- - - - - Points
- - - - - Signals
- - - - - Relay
- - - - - Velocity Meters
- - - - - Station Lighting
- - - - - Handling

Handling Functions

enginecarcar
In order to simplify programming with libRailControl in particular and writing model railway control applications in general, libRailControl provides a set of additional functions which make life a bit easier.

int get_cmd(char *BUFFER);

The function get_cmd() allows for non-blocking keyboard input. All input is stored in an internal buffer. A call to get_cmd() copies this input into the string buffer BUFFER which must be allocated before. get_cmd() always returns immediately. The return value 0 signals that no new input is present while a return value different from 0 signals a new user command. Non-blocking keyboard input is a prerequisite for user interaction while an application program still continues to control the model railway.

char *get_name_block(int BLOCK);
char *get_name_point(int POINT);
char *get_name_signal(int SIGNAL);
char *get_name_direction(int DIRECTION);
char *get_name_relay_pos(int RELAYPOS);
char *get_name_point_pos(int POINTPOS);
char *get_name_signal_pos(int SIGNALPOS);

These functions convert symbolic constants provided by libRailControl into strings. Each function returns a pointer to a statically allocated string buffer. These functions are particularly useful for producing diagnostic output.


Clemens Grelck
generated on: Mon May 31 10:20:52 MET DST 1999