Libtrap: Internal development docs
1.16.1
|
Macros | |
#define | TRAP_DEFAULT_SIGNAL_HANDLER(stop_cmd) |
Define default signal handler function Defines function to handle SIGTERM and SIGINT signals. When a signal is received, it runs the specified command and calls trap_terminate(). Place this macro before your main function. More... | |
#define | TRAP_REGISTER_DEFAULT_SIGNAL_HANDLER() |
Register default signal handler. Register function defined by TRAP_DEFAULT_SIGNAL_HANDLER as handler of SIGTERM and SIGINT signals. Place this macro between TRAP initialization and the main loop. More... | |
#define | TRAP_DEFAULT_INITIALIZATION(argc, argv, module_info) |
Initialize TRAP using command-line parameters and handle errors. Generates code that parses command-line parameters using trap_parse_params, intializes TRAP library using trap_init and handle possible errors. It calls exit(1) when an error has occured. Place this macro at the beginning of your main function. More... | |
#define | TRAP_DEFAULT_FINALIZATION() trap_finalize(); |
Generate TRAP cleanup code. Only calls trap_finalize function. Place this macro at the end of your main function. More... | |
#define | TRAP_DEFAULT_GET_DATA_ERROR_HANDLING(ret_code, timeout_cmd, error_cmd) |
Handle possible errors after call to trap_recv(). More... | |
#define | TRAP_DEFAULT_RECV_ERROR_HANDLING(ret_code, timeout_cmd, error_cmd) |
Handle possible errors after call to trap_recv. More... | |
#define | TRAP_DEFAULT_SEND_DATA_ERROR_HANDLING(ret_code, timeout_cmd, error_cmd) |
Handle possible errors after call to trap_send_data. More... | |
#define | TRAP_DEFAULT_SEND_ERROR_HANDLING(ret_code, timeout_cmd, error_cmd) |
Handle possible errors after call to trap_send. More... | |
Set of preprocessor macros for rapid NEMEA module development.
#define TRAP_DEFAULT_FINALIZATION | ( | ) | trap_finalize(); |
#define TRAP_DEFAULT_GET_DATA_ERROR_HANDLING | ( | ret_code, | |
timeout_cmd, | |||
error_cmd | |||
) |
Handle possible errors after call to trap_recv().
[in] | ret_code | Return code of trap_recv(). |
timeout_cmd | Command to run when a timeout has occured, e.g. "continue". | |
error_cmd | Command to run when an error has occured or interface was terminated, e.g. "break". |
#define TRAP_DEFAULT_INITIALIZATION | ( | argc, | |
argv, | |||
module_info | |||
) |
Initialize TRAP using command-line parameters and handle errors. Generates code that parses command-line parameters using trap_parse_params, intializes TRAP library using trap_init and handle possible errors. It calls exit(1) when an error has occured. Place this macro at the beginning of your main function.
[in,out] | argc | Number of command-line parameters. |
[in,out] | argv | List of command-line parameters. |
[in] | module_info | trap_module_info_t structure containing information about the module. |
#define TRAP_DEFAULT_RECV_ERROR_HANDLING | ( | ret_code, | |
timeout_cmd, | |||
error_cmd | |||
) |
Handle possible errors after call to trap_recv.
[in] | ret_code | Return code of trap_recv. |
timeout_cmd | Command to run when a timeout has occured, e.g. "continue". | |
error_cmd | Command to run when an error has occured or interface was terminated, e.g. "break". |
#define TRAP_DEFAULT_SEND_DATA_ERROR_HANDLING | ( | ret_code, | |
timeout_cmd, | |||
error_cmd | |||
) |
Handle possible errors after call to trap_send_data.
[in] | ret_code | Return code of trap_send_data. |
timeout_cmd | Command to run when a timeout has occured, e.g. "0" to do nothing. | |
error_cmd | Command to run when an error has occured or interface was terminated, e.g. "break". |
#define TRAP_DEFAULT_SEND_ERROR_HANDLING | ( | ret_code, | |
timeout_cmd, | |||
error_cmd | |||
) |
Handle possible errors after call to trap_send.
[in] | ret_code | Return code of trap_send. |
timeout_cmd | Command to run when a timeout has occured, e.g. "0" to do nothing. | |
error_cmd | Command to run when an error has occured or interface was terminated, e.g. "break". |
#define TRAP_DEFAULT_SIGNAL_HANDLER | ( | stop_cmd | ) |
Define default signal handler function Defines function to handle SIGTERM and SIGINT signals. When a signal is received, it runs the specified command and calls trap_terminate(). Place this macro before your main function.
[in] | stop_cmd | Command which stops operation of a module. Usually setting a variable which is tested in module's main loop. |
#define TRAP_REGISTER_DEFAULT_SIGNAL_HANDLER | ( | ) |
Register default signal handler. Register function defined by TRAP_DEFAULT_SIGNAL_HANDLER as handler of SIGTERM and SIGINT signals. Place this macro between TRAP initialization and the main loop.